From d6ef1ac5a8ae4c3614a76776c856b3d0983b3542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sof=C3=ADa=20Aritz?= Date: Mon, 22 Jan 2024 14:36:34 +0100 Subject: [PATCH] lsp --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ after/plugin/lsp.lua | 20 ++++++++++---------- 2 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2160388 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# init.lua + +My NeoVIM configuration, hope you like it :) + +## Installation + +```sh +cd ~/.config/ +rm -rf nvim/ +git clone https://git.sofiaritz.com/sofia/init.lua nvim + +# See [Packer quickstart](https://github.com/wbthomason/packer.nvim#quickstart) +git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim + +# (ignore errors) +nvim + +# Run :PackerSync +``` + +## Keybindings + +`` is `` + +`pf` → Project files (`find_files`) +`ps` → Project search (`grep_str`) +`gf` → Git files (`git_files`) +`gs` → Git status +`u` → Undo tree + +`mh` → LSP hover +`mr` → LSP rename +`ma` → LSP action +`mgd` → LSP go to definition +`mgD` → LSP go to declaration +`mgr` → LSP go to references +`mf` → LSP format diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 004f7b6..9818425 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -12,16 +12,16 @@ vim.api.nvim_create_autocmd('LspAttach', { -- these will be buffer-local keybindings -- because they only work if you have an active language server - vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) - vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) - vim.keymap.set({'n', 'x'}, '', 'lua vim.lsp.buf.format({async = true})', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) + vim.keymap.set('n', 'mh', 'lua vim.lsp.buf.hover()', opts) + vim.keymap.set('n', 'mgd', 'lua vim.lsp.buf.definition()', opts) + vim.keymap.set('n', 'mgD', 'lua vim.lsp.buf.declaration()', opts) + vim.keymap.set('n', 'mgi', 'lua vim.lsp.buf.implementation()', opts) + vim.keymap.set('n', 'mgo', 'lua vim.lsp.buf.type_definition()', opts) + vim.keymap.set('n', 'mgr', 'lua vim.lsp.buf.references()', opts) + vim.keymap.set('n', 'mgs', 'lua vim.lsp.buf.signature_help()', opts) + vim.keymap.set('n', 'mr', 'lua vim.lsp.buf.rename()', opts) + vim.keymap.set({'n', 'x'}, 'mf', 'lua vim.lsp.buf.format({async = true})', opts) + vim.keymap.set('n', 'ma', 'lua vim.lsp.buf.code_action()', opts) end })