Tweak some keybindings for nvim

This commit is contained in:
doylet 2024-04-04 12:21:25 +11:00
parent fd79ee377b
commit f0c32fc669

View File

@ -45,6 +45,7 @@ lua <<EOF
local leap = require('leap') local leap = require('leap')
vim.keymap.set({'n', 'x', 'o'}, '<tab>', '<Plug>(leap-forward-to)') vim.keymap.set({'n', 'x', 'o'}, '<tab>', '<Plug>(leap-forward-to)')
vim.keymap.set({'n', 'x', 'o'}, '<S-tab>', '<Plug>(leap-backward-to)') vim.keymap.set({'n', 'x', 'o'}, '<S-tab>', '<Plug>(leap-backward-to)')
require('bigfile').setup() require('bigfile').setup()
require('fzf-lua').setup{ require('fzf-lua').setup{
winopts = { winopts = {
@ -54,12 +55,14 @@ lua <<EOF
} }
-- LSP Setup ===================================================================================== -- LSP Setup =====================================================================================
local devenver_root = vim.fn.getenv('devenver_root')
local lsp_zero = require('lsp-zero') local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr) lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings -- see :help lsp-zero-keybindings
-- to learn the available actions -- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr}) lsp_zero.default_keymaps({
buffer = bufnr,
exclude = {'<F3>'}, -- Disable code-format of current buffer
})
local opts = {buffer = bufnr} local opts = {buffer = bufnr}
vim.keymap.set({'v', 'x'}, 'gq', function() vim.keymap.set({'v', 'x'}, 'gq', function()
@ -93,6 +96,11 @@ lua <<EOF
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(), ['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
['<CR>'] = cmp.mapping.confirm({select = false}), ['<CR>'] = cmp.mapping.confirm({select = false}),
}), }),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
--- (Optional) Show source name in completion menu --- (Optional) Show source name in completion menu
formatting = cmp_format, formatting = cmp_format,
}) })
@ -101,7 +109,7 @@ lua <<EOF
local harpoon = require('harpoon') local harpoon = require('harpoon')
harpoon:setup() harpoon:setup()
vim.keymap.set("n", "<M-0>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) vim.keymap.set("n", "<M-0>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<M-->", function() harpoon:list():append() end) vim.keymap.set("n", "<M-a>", function() harpoon:list():prepend() end)
vim.keymap.set("n", "<M-1>", function() harpoon:list():select(1) end) vim.keymap.set("n", "<M-1>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<M-2>", function() harpoon:list():select(2) end) vim.keymap.set("n", "<M-2>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<M-3>", function() harpoon:list():select(3) end) vim.keymap.set("n", "<M-3>", function() harpoon:list():select(3) end)
@ -277,6 +285,7 @@ nnoremap <leader>R <cmd>FzfLua grep_cword<cr>
nnoremap <leader>t <cmd>FzfLua lsp_live_workspace_symbols<cr> nnoremap <leader>t <cmd>FzfLua lsp_live_workspace_symbols<cr>
nnoremap <leader>T <cmd>FzfLua lsp_finder<cr> nnoremap <leader>T <cmd>FzfLua lsp_finder<cr>
nnoremap <leader>b <cmd>FzfLua buffers<cr> nnoremap <leader>b <cmd>FzfLua buffers<cr>
nnoremap <leader><leader> <cmd>FzfLua<cr>
" Map Ctrl+HJKL to navigate buffer window " Map Ctrl+HJKL to navigate buffer window
nmap <silent> <C-h> :wincmd h<CR> nmap <silent> <C-h> :wincmd h<CR>