Add to your config:
nmap <silent> <leader>h <plug>(YCMHover)
I prefer K
for that, but only for buffers/filetypes, where it makes sense:
let s:lsp_ft_maps = 'gdscript,go,python'
augroup ycm_settings | au!
exe printf('au FileType %s call Ycm_mappings()', s:lsp_ft_maps)
augroup end
func! Ycm_mappings() abort
nmap <silent><buffer> K <plug>(YCMHover)
nnoremap <silent><buffer> gd :YcmCompleter GoTo<CR>
endfunc
UPD
This snippet creates an autocommand for filetypes listed in s:lsp_ft_maps
that runs Ycm_mappings()
function, that in turn creates buffer local mappings.
Buffer local mappings as name suggests are only available for a given buffer thus if you switch to another buffer where YCM doesn't have LSP functionality, original mappings would be in effect.
For example, K
is used by vim to show a man page of a keyword under cursor, and for vim
filetype (say your .vimrc), the same K
is used to show vim help. With the snippet, it is preserved for non-lsp related buffers and shows YCM hover for buffers listed in s:lsp_ft_maps
variable.
The same is with gd
mapping -- it has original built-in functionality which this snippet overrides for some of filetypes.
updatetime
smaller would help; not manual, though