diff --git a/QUICKSTART.md b/QUICKSTART.md index 5028fa9..a5422f8 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -57,8 +57,8 @@ Ctrl+p fuzzy find file (git-aware) ## Write code ``` -gd go to definition -K hover docs +,dd go to definition +,dk hover docs ,rn rename symbol ,ca code action ,f format diff --git a/README.md b/README.md index 656cdc9..317d923 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ active profile and only shows keys for enabled features. Leader: `,` ``` -Ctrl+p fuzzy find file gd go to definition -,rg ripgrep project K hover docs +Ctrl+p fuzzy find file ,dd go to definition +,rg ripgrep project ,dk hover docs ,e toggle file sidebar ,cr run current file ,gs git status ,f format ,w save ,q quit @@ -113,7 +113,7 @@ jk exit insert mode ,? cheat sheet ### Code -`gd` def | `gy` type | `gi` impl | `gr` refs | `K` docs | `[g` `]g` diagnostics | `[e` `]e` ALE errors | `,rn` rename | `,ca` action | `,o` outline | `,cr` run +`,dd` def | `,dt` type | `,di` impl | `,dr` refs | `,dk` docs | `,dp` `,dn` diagnostics | `[e` `]e` ALE errors | `,rn` rename | `,ca` action | `,o` outline | `,cr` run ### Edit diff --git a/modules/lsp.vim b/modules/lsp.vim index 52d415e..2e2662e 100644 --- a/modules/lsp.vim +++ b/modules/lsp.vim @@ -63,14 +63,14 @@ function! s:on_lsp_buffer_enabled() abort setlocal signcolumn=yes endif - nmap gd (lsp-definition) - nmap gy (lsp-type-definition) - nmap gi (lsp-implementation) - nmap gr (lsp-references) - nmap [g (lsp-previous-diagnostic) - nmap ]g (lsp-next-diagnostic) + nmap dd (lsp-definition) + nmap dt (lsp-type-definition) + nmap di (lsp-implementation) + nmap dr (lsp-references) + nmap dp (lsp-previous-diagnostic) + nmap dn (lsp-next-diagnostic) - nmap K (lsp-hover) + nmap dk (lsp-hover) nmap rn (lsp-rename) nmap ca (lsp-code-action) diff --git a/modules/tools.vim b/modules/tools.vim index 8a8d722..3ac843f 100644 --- a/modules/tools.vim +++ b/modules/tools.vim @@ -343,16 +343,16 @@ function! s:CheatSheet() abort if l:has_lsp call extend(l:lines, [ - \ ' gd definition', - \ ' gy type definition', - \ ' gi implementation', - \ ' gr references', - \ ' K hover docs', + \ ' ,dd definition', + \ ' ,dt type definition', + \ ' ,di implementation', + \ ' ,dr references', + \ ' ,dk hover docs', \ ' ,rn rename', \ ' ,ca code action', \ ' ,f format', \ ' ,o outline', - \ ' [g ]g LSP diagnostics', + \ ' ,dp ,dn LSP diagnostics', \ ' :LspInstallServer setup LSP', \ ' :ChopsticksStatus check LSP setup', \ ]) diff --git a/scripts/test.sh b/scripts/test.sh index 669175e..c2eadf1 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -237,6 +237,18 @@ check_vim() { -c 'qa!' 2>&1 grep -Fq 'vim-lsp not installed; run :PlugInstall' "$TMP_ROOT/status-missing-plugin.txt" + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ + -c 'doautocmd User lsp_buffer_enabled' \ + -c 'if maparg("gd", "n") !=# "" || maparg("K", "n") !=# "" || maparg("gi", "n") !=# "" || maparg("gr", "n") !=# "" | cquit | endif' \ + -c 'if maparg(",dd", "n") !~# "lsp-definition" | cquit | endif' \ + -c 'if maparg(",dt", "n") !~# "lsp-type-definition" | cquit | endif' \ + -c 'if maparg(",di", "n") !~# "lsp-implementation" | cquit | endif' \ + -c 'if maparg(",dr", "n") !~# "lsp-references" | cquit | endif' \ + -c 'if maparg(",dk", "n") !~# "lsp-hover" | cquit | endif' \ + -c 'if maparg(",dp", "n") !~# "lsp-previous-diagnostic" | cquit | endif' \ + -c 'if maparg(",dn", "n") !~# "lsp-next-diagnostic" | cquit | endif' \ + -c 'qa!' 2>&1 + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ -c 'normal ,?' \ -c "redir! > $TMP_ROOT/cheat-default.txt" \ @@ -244,6 +256,13 @@ check_vim() { -c 'redir END' \ -c 'qa!' 2>&1 grep -Fq ':ChopsticksStatus check LSP setup' "$TMP_ROOT/cheat-default.txt" + grep -Fq ',dd definition' "$TMP_ROOT/cheat-default.txt" + grep -Fq ',dk hover docs' "$TMP_ROOT/cheat-default.txt" + grep -Fq ',dp ,dn LSP diagnostics' "$TMP_ROOT/cheat-default.txt" + if grep -Eq 'gd definition|K hover docs|\\[g \\]g LSP diagnostics' "$TMP_ROOT/cheat-default.txt"; then + cat "$TMP_ROOT/cheat-default.txt" + exit 1 + fi vim -u NONE -i NONE -es -N \ -c 'let g:chopsticks_profile = "minimal"' \