diff options
Diffstat (limited to '.config/nvim/lua/binds.lua')
-rw-r--r-- | .config/nvim/lua/binds.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/.config/nvim/lua/binds.lua b/.config/nvim/lua/binds.lua new file mode 100644 index 0000000..181391e --- /dev/null +++ b/.config/nvim/lua/binds.lua @@ -0,0 +1,44 @@ +vim.g.mapleader = ' ' +vim.b.mapleader = ' ' + +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +map('', 'Y', 'y$', opts) +map('n', '<C-L>', ':nohl<CR><C-L>', opts) +map('n', 'n', 'nzzzv', opts) +map('n', 'N', 'Nzzzv', opts) +map('i', 'kj', '<Esc>', opts) +map('t', 'kj', '<C-\\><C-n>', { noremap = true }) + +map('i', ',', ',<c-g>u', opts) +map('i', '.', '.<c-g>u', opts) +map('i', '[', '[<c-g>u', opts) +map('i', '!', '!<c-g>u', opts) +map('i', '?', '?<c-g>u', opts) + +map('v', '<A-j>', ":m '>+1<CR>gv=gv", opts) +map('v', '<A-k>', ":m '<-2<CR>gv=gv", opts) + +map('n', '<leader>h', ':wincmd h<CR>', opts) +map('n', '<leader>j', ':wincmd j<CR>', opts) +map('n', '<leader>k', ':wincmd k<CR>', opts) +map('n', '<leader>l', ':wincmd l<CR>', opts) + +map('n', '<C-n>', ':NvimTreeToggle<CR>', opts) +map('n', '<leader>n', ':NvimTreeFindFile<CR>', opts) + +map('n', '<C-p>', '<cmd>Telescope find_files<cr>', opts) +map('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', opts) +map('n', '<leader>fb', '<cmd>Telescope buffers<cr>', opts) +map('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', opts) + +map('n', '<leader>fu', '<cmd>Telescope lsp_references<cr>', opts) +map('n', '<leader>gd', '<cmd>Telescope lsp_definitions<cr>', opts) +map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) +map('n', '<leader>xd', '<cmd>Telescope lsp_document_diagnostics<cr>', opts) +map('n', '<leader>xD', '<cmd>Telescope lsp_workspace_diagnostics<cr>', opts) +map('n', '<leader>xn', '<cmd>lua vim.lsp.diagnostic.goto_next()<cr>', opts) +map('n', '<leader>xN', '<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>', opts) +map('n', '<leader>xx', '<cmd>Telescope lsp_code_actions<cr>', opts) +map('n', '<leader>xX', '<cmd>Telescope lsp_range_code_actions<cr>', opts) |