diff --git a/.config/nvim/lua/my/keymaps.lua b/.config/nvim/lua/my/keymaps.lua index 48fe4fb..e1f4c9a 100644 --- a/.config/nvim/lua/my/keymaps.lua +++ b/.config/nvim/lua/my/keymaps.lua @@ -2,7 +2,8 @@ function map(mode, shortcut, command) vim.keymap.set(mode, shortcut, command, { noremap = true, silent = true }) end -vim.g.mapleader = ' ' -- +vim.g.mapleader = ' ' -- +vim.g.maplocalleader = ' ' -- (2 spaces) local format = string.format @@ -78,4 +79,4 @@ for _, key in ipairs({ 'Left', 'Up', 'Down', 'Right' }) do map({ 'v' }, format('', key), format('<%s>', key)) end -map('n', '', ':Lexplore 10') -- file explorer +map('n', '', ':Lexplore 20') -- file explorer, 20% width diff --git a/.config/nvim/lua/my/lsp.lua b/.config/nvim/lua/my/lsp.lua index 34e5951..dab0a64 100644 --- a/.config/nvim/lua/my/lsp.lua +++ b/.config/nvim/lua/my/lsp.lua @@ -14,25 +14,25 @@ packer.use { -- only do this after the language server attaches to the current buffer local on_attach = function(client, bufnr) - local function maplsp(mode, shortcut, command) + local function map(mode, shortcut, command) vim.keymap.set(mode, shortcut, command, { noremap = true, silent = true, buffer=bufnr }) end - maplsp('n', 'gD', vim.lsp.buf.declaration) - maplsp('n', 'gd', vim.lsp.buf.definition) - maplsp('n', 'K', vim.lsp.buf.hover) - maplsp('n', 'gi', vim.lsp.buf.implementation) - maplsp('n', '', vim.lsp.buf.signature_help) - maplsp('n', 'wa', vim.lsp.buf.add_workspace_folder) - maplsp('n', 'wr', vim.lsp.buf.remove_workspace_folder) - maplsp('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + map('n', 'gD', vim.lsp.buf.declaration) + map('n', 'gd', vim.lsp.buf.definition) + map('n', 'gi', vim.lsp.buf.implementation) + map('n', 'gr', vim.lsp.buf.references) + map('n', 'K', vim.lsp.buf.hover) + map('n', '', vim.lsp.buf.signature_help) + map('n', 'lwa', vim.lsp.buf.add_workspace_folder) + map('n', 'lwr', vim.lsp.buf.remove_workspace_folder) + map('n', 'lwl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end) - maplsp('n', 'rn', vim.lsp.buf.rename) - maplsp('n', 'a', vim.lsp.buf.code_action) - maplsp('n', 'gr', vim.lsp.buf.references) - maplsp('n', 'f', vim.lsp.buf.formatting) + map('n', 'lrn', vim.lsp.buf.rename) + map('n', 'la', vim.lsp.buf.code_action) + map('n', 'f', vim.lsp.buf.formatting) -- highlight symbol under cursor if client.resolved_capabilities.document_highlight then