From 8cc68ac8a50756dfc21ce269a969bd7897e173fd Mon Sep 17 00:00:00 2001 From: adamstuck Date: Sat, 12 Mar 2022 17:38:32 +0100 Subject: nvim: config cleanup + speedup (lazy load) --- .config/nvim/lua/mappings.lua | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .config/nvim/lua/mappings.lua (limited to '.config/nvim/lua/mappings.lua') diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..81f0614 --- /dev/null +++ b/.config/nvim/lua/mappings.lua @@ -0,0 +1,47 @@ +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', 'J', ":m '>+1gv=gv", opts) +map('v', 'K', ":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', '', ':wincmd h', opts) +map('n', '', ':wincmd j', opts) +map('n', '', ':wincmd k', opts) +map('n', '', ':wincmd l', opts) + +map('n', 'p', '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', 'gd', 'Telescope lsp_definitions', opts) +map('n', 'gD', 'Telescope lsp_declarations', opts) +map('n', 'gr', 'Telescope lsp_references', opts) +map('n', 'gi', 'Telescope lsp_implementations', opts) +map('n', 'K', 'lua vim.lsp.buf.hover()', opts) +map('n', '', 'lua vim.lsp.buf.signature_help()', opts) +map('n', 'rn', 'lua vim.lsp.buf.rename()', 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