From 0f1e82e9130acdb63e985548b750383bacc70df9 Mon Sep 17 00:00:00 2001 From: adamstuck Date: Mon, 11 Oct 2021 12:57:12 +0200 Subject: Setup nvim on laptop --- .config/nvim/lua/binds.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .config/nvim/lua/binds.lua (limited to '.config/nvim/lua/binds.lua') 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', '', ':nohl', opts) +map('n', 'n', 'nzzzv', opts) +map('n', 'N', 'Nzzzv', opts) +map('i', 'kj', '', opts) +map('t', 'kj', '', { noremap = true }) + +map('i', ',', ',u', opts) +map('i', '.', '.u', opts) +map('i', '[', '[u', opts) +map('i', '!', '!u', opts) +map('i', '?', '?u', opts) + +map('v', '', ":m '>+1gv=gv", opts) +map('v', '', ":m '<-2gv=gv", opts) + +map('n', 'h', ':wincmd h', opts) +map('n', 'j', ':wincmd j', opts) +map('n', 'k', ':wincmd k', opts) +map('n', 'l', ':wincmd l', opts) + +map('n', '', ':NvimTreeToggle', opts) +map('n', 'n', ':NvimTreeFindFile', opts) + +map('n', '', 'Telescope find_files', opts) +map('n', 'fg', 'Telescope live_grep', opts) +map('n', 'fb', 'Telescope buffers', opts) +map('n', 'fh', 'Telescope help_tags', opts) + +map('n', 'fu', 'Telescope lsp_references', opts) +map('n', 'gd', 'Telescope lsp_definitions', opts) +map('n', 'rn', 'lua vim.lsp.buf.rename()', opts) +map('n', 'xd', 'Telescope lsp_document_diagnostics', opts) +map('n', 'xD', 'Telescope lsp_workspace_diagnostics', opts) +map('n', 'xn', 'lua vim.lsp.diagnostic.goto_next()', opts) +map('n', 'xN', 'lua vim.lsp.diagnostic.goto_prev()', opts) +map('n', 'xx', 'Telescope lsp_code_actions', opts) +map('n', 'xX', 'Telescope lsp_range_code_actions', opts) -- cgit v1.2.3-70-g09d2