-
Notifications
You must be signed in to change notification settings - Fork 36
FAQ
Linwei edited this page Mar 15, 2020
·
3 revisions
My global context menu (see the last 2 items):
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>
It will display when I press K
, but the last two items will display for only C/C++ or python.
I have independent context menu for some filetypes, like 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>
It is initialized in the ftplugin/vimwiki.vim
and the keymap is local to buffer. It is triggered by K
too, but only for vimwiki.