aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxbian <got.dacs@slmail.me>2023-07-01 10:03:16 +0200
committerOxbian <got.dacs@slmail.me>2023-07-01 10:03:16 +0200
commit95f323522716f6b72133fefb615f4ede906dc0f2 (patch)
tree3c03fd3896ffb1b1d099ffc71f1a660a6b45adfb
parent450cea46e25d4b14400e6ad912695b56664bd41a (diff)
downloadvimrc-95f323522716f6b72133fefb615f4ede906dc0f2.tar.gz
vimrc-95f323522716f6b72133fefb615f4ede906dc0f2.zip
Adding LSP keybinds & doc
-rw-r--r--.vim/keymaps.vim27
-rw-r--r--.vim/plugins.vim3
-rw-r--r--readme.md69
3 files changed, 68 insertions, 31 deletions
diff --git a/.vim/keymaps.vim b/.vim/keymaps.vim
index eef6409..1345178 100644
--- a/.vim/keymaps.vim
+++ b/.vim/keymaps.vim
@@ -38,10 +38,10 @@ map <leader>bd :Bclose<cr>:tabclose<cr>gT
map <leader>ba :bufdo bd<cr>
" Go to the next buffer
-map <leader>l :bnext<cr>
+map <leader>]b :bnext<cr>
" Go to the previous buffer
-map <leader>h :bprevious<cr>
+map <leader>[b :bprevious<cr>
""""""""""""""""""""""""""""
" Tabs
@@ -96,14 +96,20 @@ nnoremap <C-f> :NERDTreeToggle<CR>
""""""""""""""""""""
let g:gitgutter_enabled=1 " Enable by default gitgutter
+" Go to the previous hunk
+nnoremap <leader>[h <Plug>(GitGutterPrevHunk)
+
+" Go to the next hunk
+nnoremap <leader>]h <Plug>(GitGutterNextHunk)
+
" Enable / Disable GitGutter
-nnoremap <leader>d :GitGutterToggle<CR>
+nnoremap <leader>ht <Plug>(GitGutterToggle)
" Stage Hunk in Git
-nnoremap <leader>hs :GitGutterStageHunk<CR>
+nnoremap <leader>hs <Plug>(GitGutterStageHunk)
" Undo Hunk
-nnoremap <leader>hu :GitGutterUndoHunk<CR>
+nnoremap <leader>hu <Plug>(GitGutterUndoHunk)
" Preview Hunk
nnoremap <leader>hp :GitGutterPreviewHunk<CR>
@@ -135,3 +141,14 @@ map <leader>s? z=
"""""""""""""""""""
inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
+
+nnoremap <leader>ld :LspDefinition<cr>
+nnoremap <leader>lnd :LspNextDiagnostic<cr>
+nnoremap <leader>lpd :LspPreviousDiagnostic<cr>
+nnoremap <leader>lf :LspReferences<cr>
+nnoremap <leader>lr :LspRename<cr>
+nnoremap <leader>ls :LspStopServer<cr>
+nnoremap <leader>lp :LspPeekDefinition<cr>
+nnoremap <leader>la :LspCodeAction<cr>
+nnoremap <leader>lh :LspHover<cr>
+nnoremap <leader>ldf :LspDocumentFormat<cr>
diff --git a/.vim/plugins.vim b/.vim/plugins.vim
index bda960d..a98a9d2 100644
--- a/.vim/plugins.vim
+++ b/.vim/plugins.vim
@@ -20,6 +20,7 @@ Plug 'vim-airline/vim-airline' " Vim statusline
Plug 'preservim/nerdtree' " Filetree in vim
Plug 'ryanoasis/vim-devicons' " Icons for vim
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " Syntax in nerdtree for files extension
+Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet
" Git integration
Plug 'airblade/vim-gitgutter' " Git diff
@@ -78,3 +79,5 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_
" If more than one window and previous buffer was NERDTree, go back to it.
autocmd BufEnter * if bufname('#') =~# "^NERD_tree_" && winnr('$') > 1 | b# | endif
+
+
diff --git a/readme.md b/readme.md
index 62667a0..b4a0bae 100644
--- a/readme.md
+++ b/readme.md
@@ -25,9 +25,10 @@ This config has just the necessary plugins installed:
- [Vim devicons](https://github.com/ryanoasis/vim-devicons) language icons for vim.
- [Vim nerdtree syntax highlighting](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) nerdtree syntax highlighting
- [Vim gitgutter](https://github.com/airblade/vim-gitgutter) to see diff between files with git.
-- [ALE](https://github.com/dense-analysis/ale) vim linter, autocompleter, a Swiss knife for all the LSP things.
+- [Vim-lsp](https://github.com/prabirshrestha/vim-lsp) linter & formatter for language.
+- [Vim-lsp settings](https://github.com/mattn/vim-lsp-settings) easily setup lsp servers for languages.
- [Asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim) async autocompletion
-- [Asyncomplete ALE](https://github.com/andreypopp/asyncomplete-ale.vim) LSP server for asyncomplete & ALE
+- [Asyncomplete & lsp-vim](https://github.com/prabirshrestha/asyncomplete-lsp.vim) use vim-lsp as source for autocompletion lsp server.
## Command & keybinds
@@ -37,35 +38,35 @@ This config has just the necessary plugins installed:
#### Window
-- `Ctrl+h` move to the left window
-- `Ctrl+j` move to the bottom window
-- `Ctrl+k` move to the upper window
-- `Ctrl+l` move to the right window
+- `Ctrl+h` move to the left window,
+- `Ctrl+j` move to the bottom window,
+- `Ctrl+k` move to the upper window,
+- `Ctrl+l` move to the right window,
#### Buffer
-- `<leader>bd` close the current buffer
-- `<leader>ba` close all the buffers
-- `<leader>l` go to the next buffer
-- `<leader>h` go to the precedent buffer
+- `<leader>bd` close the current buffer,
+- `<leader>ba` close all the buffers,
+- `<leader>]b` go to the next buffer,
+- `<leader>[b` go to the precedent buffer,
#### Tabs
-- `<leader>tn` open a new tab
-- `<leader>to` close all other tabs
-- `<leader>tc` close current tab page
-- `<leader>tm` move the tab after another
-- `<leader>t<leader>` go to the next tab
-- `<leader>tl` toggle between this tab and the last accessed tab
-- `<leader>te` open a new tab with the current buffer
+- `<leader>tn` open a new tab,
+- `<leader>to` close all other tabs,
+- `<leader>tc` close current tab page,
+- `<leader>tm` move the tab after another,
+- `<leader>t<leader>` go to the next tab,
+- `<leader>tl` toggle between this tab and the last accessed tab,
+- `<leader>te` open a new tab with the current buffer,
#### Spell check
-- `<leader>ss` toggle / untoggle spellchecking
-- `<leader>sn` go to the next word to spellcheck
-- `<leader>sp` go to the previous word to spellcheck
-- `<leader>sa` add a word into the dictionary
-- `<leader>s?` show the list of alternatives for the word
+- `<leader>ss` toggle / untoggle spellchecking,
+- `<leader>sn` go to the next word to spellcheck,
+- `<leader>sp` go to the previous word to spellcheck,
+- `<leader>sa` add a word into the dictionary,
+- `<leader>s?` show the list of alternatives for the word,
More help at `:help spell`
@@ -77,16 +78,32 @@ Keybinds:
### Vim Gutter
-For help, use `:help gitgutter`.
+For help, use `:help gitgutter`.
Keybinds:
-- `[c` & `]c` to jump between hunks,
+- `[h` go to the previous hunk,
+- `]h` go to the next hunk,
- `<leader>hp` to preview hunk,
- `<leader>hs` to stage hunk,
- `<leader>hu` to undo hunk,
-- `<leader>d` to toggle GitGutter.
+- `<leader>ht` to toggle GitGutter.
Hunks are the difference between your file and the git file.
+### LSP
+
+For help, use `:help vim-lsp`.
+Keybinds:
+- `<leader>ld` go to the definition,
+- `<leader>lnd` go to the next diagnostic,
+- `<leader>lpd` go to the previous diagnostic,
+- `<leader>lf` go to the reference,
+- `<leader>lr` rename element,
+- `<leader>ls` stop lsp server,
+- `<leader>lp` peek a view to the definition,
+- `<leader>la` code action,
+- `<leader>lh` lsp hover,
+- `<leader>ldf` format document.
+
## Linters & fixers
### Python
@@ -96,5 +113,5 @@ For using python linters & fixers, you will need to setup a virtual env & instal
```bash
python -m venv .venv
source .venv/bin/activate
-pip install flake8 pylint pydocstyle bandit mypy black isort
+pip install python-lsp-server[all]
```
ArKa projects. All rights to me, and your next child right arm.