From b876e4afcab3d01f9207f9f4794828fd8b091d9d Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sun, 19 Mar 2023 17:00:55 -0300 Subject: nvim,zzszh,gpg,i3 --- .config/nvim/lua/keymaps.lua | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 .config/nvim/lua/keymaps.lua (limited to '.config/nvim/lua/keymaps.lua') diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua new file mode 100755 index 0000000..16de10f --- /dev/null +++ b/.config/nvim/lua/keymaps.lua @@ -0,0 +1,68 @@ +vim.g.mapleader = " " +local function keymap(mode, lhs, rhs, opts) + opts = opts or { noremap = true, silent = true } + vim.keymap.set(mode, lhs, rhs, opts) +end + +keymap('n', '', + function() require('luasnip').jump(1) end, + {noremap = true, silent = true}) + +-- Map leader + s and v/h to open split +keymap('n', 'sp', ':sp') +keymap('n', 'sv', ':vsp') + +keymap('n', 'q', ':q') + +keymap('n', '', ':mksession!nvim-session:wqa') +keymap('n', '', ':wa:mksession!nvim-session') +keymap('n', '', ':sourcenvim-session') + +keymap('n', 'y', '"+y') +keymap('n', 'd', '"+d') +keymap('n', 'p', '"+p') +keymap('n', 'Y', '"+Y') +keymap('n', 'D', '"+D') +keymap('n', 'P', '"+P') + +keymap('v', 'y', '"+y') +keymap('v', 'd', '"+d') +keymap('v', 'p', '"+p') +keymap('v', 'Y', '"+Y') +keymap('v', 'D', '"+D') +keymap('v', 'P', '"+P') + +keymap('n', '', 'h') +keymap('n', '', 'k') +keymap('n', '', 'j') +keymap('n', '', 'l') + +keymap('v', '<', '', '>gv') + +keymap('i', '', '') + +vim.api.nvim_create_autocmd('User', { + pattern = 'LspAttached', + desc = 'LSP Keymaps', + callback = function() + local function bufmap(mode, lhs, rhs) + keymap(mode, lhs, rhs, { silent = true, noremap = true, buffer = true }) + end + + bufmap('n', 'gD', vim.lsp.buf.declaration) + bufmap('n', 'gd', vim.lsp.buf.definition) + bufmap('n', 'K', vim.lsp.buf.hover) + bufmap('n', 'gi', vim.lsp.buf.implementation) + bufmap('n', '', vim.lsp.buf.signature_help) + bufmap('n', 'wa', vim.lsp.buf.add_workspace_folder) + bufmap('n', 'wr', vim.lsp.buf.remove_workspace_folder) + bufmap('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end) + bufmap('n', 'D', vim.lsp.buf.type_definition) + bufmap('n', 'rn', vim.lsp.buf.rename) + bufmap('n', 'ca', vim.lsp.buf.code_action) + bufmap('n', 'gr', vim.lsp.buf.references) + bufmap('n', 'f', vim.lsp.buf.formatting) + bufmap('n', 'e', vim.diagnostic.open_float) + end +}) -- cgit v1.2.3