Skip to content

Commit 288f1be

Browse files
cmcaineautozimu
authored andcommitted
Document a function to conditionally map LC funcs
1 parent 183fbf5 commit 288f1be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/LanguageClient.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ like to map these functions to shortcuts, for example: >
3535
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
3636
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
3737
38+
You can apply these mappings only for buffers with supported filetypes with a
39+
simple function: >
40+
41+
function LC_maps()
42+
if has_key(g:LanguageClient_serverCommands, &filetype)
43+
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
44+
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
45+
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
46+
endif
47+
endfunction
48+
49+
autocmd FileType * call LC_maps()
50+
3851
If one is using deoplete/nvim-completion-manager at the same time, completion
3952
should work out of the box. Otherwise, completion is available with 'C-X C-O'
4053
('omnifunc').

0 commit comments

Comments
 (0)