是否有vim设置或插件来显示可能的下一个键(可能带注释)?我想为我的<leader>
映射提供类似的东西,对初学者来说这将是一个巨大的好处。
工作流:
1. I type <leader>
2. Plugin pops up a sidebar with "gc - fugitive commit, gd - fugitive diff" etc
3. I can continue typing my command
答案 0 :(得分:0)
我有以下内容,但这仅适用于<Leader>
映射的组,例如来自NERD_Commenter的各种<Leader>c...
映射:
" <Leader>x List all mappings defined in normal / visual mode that
" {Visual}<Leader>x start with <Leader>x (if any are defined and there is no
" dedicated <Leader>x mapping itself).
function! s:MakeMappingHelperMappings()
for l:i in range(65,90) + range(97,122)
let l:char = nr2char(l:i)
let l:map = '<Leader>' . l:char
for l:mode in ['n', 'x']
if ! empty(mapcheck(l:map, l:mode)) && empty(maparg(l:map, l:mode))
execute printf('%snoremap %s :<C-u>%smap %s<CR>', l:mode, l:map, l:mode, l:map)
endif
endfor
endfor
endfunction
call s:MakeMappingHelperMappings()
delfunction s:MakeMappingHelperMappings
这需要在所有插件之后获取,因此请将其放入~/.vim/plugin/zzz_mapping_help.vim
,而不是~/.vimrc
!
我不知道<Leader>
的某些内容会有用,这会给出太多选项......