Skip to content

Commit 018ea32

Browse files
mattnprabirshrestha
authored andcommitted
Add <plug> mappings (#210)
* Add <plug> mappings * Update doc
1 parent fac0429 commit 018ea32

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

doc/vim-lsp.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ CONTENTS *vim-lsp-contents*
3232
LspRename |LspRename|
3333
LspTypeDefinition |LspTypeDefinition|
3434
LspWorkspaceSymbols |LspWorkspaceSymbols|
35-
Autocomplete |vim-lsp-autocomplete|
35+
Mappings |vim-lsp-mappings|
36+
Autocomplete |vim-lsp-autocomplete|
3637
omnifunc |vim-lsp-omnifunc|
3738
asyncomplete.vim |vim-lsp-asyncomplete|
3839
License |vim-lsp-license|
@@ -352,6 +353,33 @@ LspStatus *LspStatus*
352353

353354
Prints the status of all registered servers.
354355

356+
===============================================================================
357+
Mappings *vim-lsp-mappings*
358+
359+
To map keys to the feature of vim-lsp, use <plug> mappings:
360+
>
361+
autocmd FileType python,go nmap gd <plug>(lsp-definition)
362+
<
363+
Available plug mappings are following:
364+
365+
(lsp-code-action)
366+
(lsp-definition)
367+
(lsp-document-symbol)
368+
(lsp-document-diagnostics)
369+
(lsp-hover)
370+
(lsp-next-error)
371+
(lsp-previous-error)
372+
(lsp-references)
373+
(lsp-rename)
374+
(lsp-workspace-symbol)
375+
(lsp-document-format)
376+
(lsp-document-format)
377+
(lsp-implementation)
378+
(lsp-type-definition)
379+
(lsp-status)
380+
381+
See also *vim-lsp-commands*
382+
355383
===============================================================================
356384
Autocomplete *vim-lsp-autocomplete*
357385

plugin/lsp.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,19 @@ command! -range LspDocumentRangeFormat call lsp#ui#vim#document_range_format()
3737
command! LspImplementation call lsp#ui#vim#implementation()
3838
command! LspTypeDefinition call lsp#ui#vim#type_definition()
3939
command! -nargs=0 LspStatus echo lsp#get_server_status()
40+
41+
nnoremap <expr> <plug>(lsp-code-action) [lsp#ui#vim#code_action(),''][1]
42+
nnoremap <expr> <plug>(lsp-definition) [lsp#ui#vim#definition(), ''][1]
43+
nnoremap <expr> <plug>(lsp-document-symbol) [lsp#ui#vim#document_symbol(),''][1]
44+
nnoremap <expr> <plug>(lsp-document-diagnostics) [lsp#ui#vim#diagnostics#document_diagnostics(),''][1]
45+
nnoremap <expr> <plug>(lsp-hover) [lsp#ui#vim#hover#get_hover_under_cursor(),''][1]
46+
nnoremap <expr> <plug>(lsp-next-error) [lsp#ui#vim#signs#next_error(),''][1]
47+
nnoremap <expr> <plug>(lsp-previous-error) [lsp#ui#vim#signs#previous_error(),''][1]
48+
nnoremap <expr> <plug>(lsp-references) [lsp#ui#vim#references(),''][1]
49+
nnoremap <expr> <plug>(lsp-rename) [lsp#ui#vim#rename(),''][1]
50+
nnoremap <expr> <plug>(lsp-workspace-symbol) [lsp#ui#vim#workspace_symbol(),''][1]
51+
nnoremap <expr> <plug>(lsp-document-format) [lsp#ui#vim#document_format(),''][1]
52+
vnoremap <expr> <plug>(lsp-document-format) [lsp#ui#vim#document_range_format(),''][1]
53+
nnoremap <expr> <plug>(lsp-implementation) [lsp#ui#vim#implementation(),''][1]
54+
nnoremap <expr> <plug>(lsp-type-definition) [lsp#ui#vim#type_definition(),''][1]
55+
nnoremap <expr> <plug>(lsp-status) [execute("echo lsp#get_server_status()",1),''][1]

0 commit comments

Comments
 (0)