Open anuvyklack opened 4 years ago
you can either:
let g:context_menu_k = [
\ ["&Peek Definition\tAlt+;", 'call quickui#tools#preview_tag("")'],
\ ["S&earch in Project\t\\cx", 'exec "silent! GrepCode! " . expand("<cword>")'],
\ [ "--", ],
\ [ "Find &Definition\t\\cg", 'call MenuHelp_Fscope("g")', 'GNU Global search g'],
\ [ "Find &Symbol\t\\cs", 'call MenuHelp_Fscope("s")', 'GNU Gloal search s'],
\ [ "Find &Called by\t\\cd", 'call MenuHelp_Fscope("d")', 'GNU Global search d'],
\ [ "Find C&alling\t\\cc", 'call MenuHelp_Fscope("c")', 'GNU Global search c'],
\ [ "Find &From Ctags\t\\cz", 'call MenuHelp_Fscope("z")', 'GNU Global search c'],
\ [ "--", ],
\ [ "Goto D&efinition\t(YCM)", 'YcmCompleter GoToDefinitionElseDeclaration'],
\ [ "Goto &References\t(YCM)", 'YcmCompleter GoToReferences'],
\ [ "Get D&oc\t(YCM)", 'YcmCompleter GetDoc'],
\ [ "Get &Type\t(YCM)", 'YcmCompleter GetTypeImprecise'],
\ [ "--", ],
\ ['Dash &Help', 'call asclib#utils#dash_ft(&ft, expand("<cword>"))'],
\ ['Cpp&man', 'exec "Cppman " . expand("<cword>")', '', 'c,cpp'],
\ ['P&ython Doc', 'call quickui#tools#python_help("")', 'python'],
\ ]
nnoremap <silent>K :call quickui#tools#clever_context('k', g:context_menu_k, {})<cr>
The global context menu is triggered by K
for all filetypes, but the last 2 items are for C/C++ and python only.
When I am editing vimwiki/markdown, I don't need the global context menu defined above, I will create a new file dotvim/ftplugin/vimwiki.vim
and setup a new context menu for vimwiki:
let g:vimwiki_k_context = [
\ ["Go &Back Link\tAlt+q", "normal \<Plug>VimwikiGoBackLink"],
\ ['--'],
\ ["&Next Link\tAlt+Shift+n", "normal \<Plug>VimwikiNextLink"],
\ ["&Prev Link\tAlt+Shift+p", "normal \<Plug>VimwikiPrevLink"],
\ ["&Delete Link\t<space>wd", "normal \<Plug>VimwikiDeleteLink"],
\ ["&Rename Link\t<space>wr", "normal \<Plug>VimwikiRenameLink"],
\ ['--'],
\ ["&Toggle Checkbox\tAlt+/", "normal \<Plug>VimwikiToggleListItem"],
\ ["Remove &Checkbox\tgl<space>", "normal \<Plug>VimwikiRemoveSingleCB"],
\ ]
nnoremap <buffer> <silent>K :call quickui#tools#clever_context('wk', g:vimwiki_k_context, {})<cr>
The keymap is local to buffer, and it will overshadow the global context menu, when I press K
in a vimwiki buffer, the context menu defined in g:vimwiki_k_context
will be triggered.
btw: If you are not using ftplugin
, you can setup this local context menu in the autocmd for filetypes.
Thank you for the awesome plugin! It is something I have been seeking for a long time!
It would be nice to add the possibility to hide (or show) some context menu items for defined file types.