lsp
This commit is contained in:
parent
268afc23e4
commit
d6ef1ac5a8
2 changed files with 48 additions and 10 deletions
38
README.md
Normal file
38
README.md
Normal file
|
@ -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
|
||||||
|
|
||||||
|
`<leader>` is `<Space>`
|
||||||
|
|
||||||
|
`<leader>pf` → Project files (`find_files`)
|
||||||
|
`<leader>ps` → Project search (`grep_str`)
|
||||||
|
`<leader>gf` → Git files (`git_files`)
|
||||||
|
`<leader>gs` → Git status
|
||||||
|
`<leader>u` → Undo tree
|
||||||
|
|
||||||
|
`<leader>mh` → LSP hover
|
||||||
|
`<leader>mr` → LSP rename
|
||||||
|
`<leader>ma` → LSP action
|
||||||
|
`<leader>mgd` → LSP go to definition
|
||||||
|
`<leader>mgD` → LSP go to declaration
|
||||||
|
`<leader>mgr` → LSP go to references
|
||||||
|
`<leader>mf` → LSP format
|
|
@ -12,16 +12,16 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
-- these will be buffer-local keybindings
|
-- these will be buffer-local keybindings
|
||||||
-- because they only work if you have an active language server
|
-- because they only work if you have an active language server
|
||||||
|
|
||||||
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
vim.keymap.set('n', '<leader>mh', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||||||
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||||||
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||||||
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||||||
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgo', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||||||
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||||||
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
vim.keymap.set('n', '<leader>mgs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||||||
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
vim.keymap.set('n', '<leader>mr', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||||
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
vim.keymap.set({'n', 'x'}, '<leader>mf', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||||||
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
vim.keymap.set('n', '<leader>ma', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue