You can define your own pop-up menu.
- Vim9
+popupwin
:Popcorn
- j, k: up, down
- h, l(enter): menu level (h: go up, l: go down)
- enter: execute
- q, esc: quit
- /: search mode
- upper case: search mode when g:PopcornSearchOnUpper
- ctrl-n, ctrl-p: up, down
- enter: execute
- esc: normal mode
- backspace, ctrl-h: backspace
- alpha nuberic: search
# vim9script
g:PopcornItems = [
{name: 'LSP', sub: [
{name: 'Hover', execute: 'LspHover', default: true},
{name: 'Definition', execute: 'LspDefinition'},
{name: 'Rename', execute: 'LspRename'},
]},
{name: 'Window', sub: [
{name: 'Alt', executeeval: '"buffer " .. bufnr("#")', default: true},
{name: '-'},
{name: 'Split(--)', execute: 'split'},
{name: 'Split(|)', execute: 'vsplit'},
]},
{name: '-'},
{name: 'Time', nameeval: 'strftime("%Y-%m-%d %H:%M:%S")', skip: true},
]
You can set menu items directly to g:PopcornItems.
You can also use g:Popcorn_clear(), g:Popcorn_add() and g:Popcorn_remove().
- Each item must have
name
- Must have one of (
execute
,executeeval
,sub
,skip
) nameeval
is eval()-ed when displayed (priority:nameeval
>name
)executeeval
is eval()-ed when executed (priority:executeeval
>execute
)- 'execute' (and 'executeeval') can be a string or a list of strings
- 'default' item is executed when enter is pressed on its parent
- A separator is {name: '-'}
- 'skip' is true if the cursor skips the item
- g:PopcornGroupHighlight = 'Comment'
- g:PopcornSeparatorHighlight = 'Comment'
- g:PopcornSearchOnUpper = false
Maintainer: Shuhei Kubota kubota.shuhei+vim@gmail.com