Tab completion with a popup menu in vim works pretty well with the right configuration.
http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
I have a small collection of code generator and code manipulating programs which I use in vim. The procedure is:
1. initiate visual mode
2. highlight text
3. :'<,'>!hashify
I would like to harness vim popup menu to offer a selection of actions.
The new procedure would be:
1. initiate visual mode
2. highlight text
3. <Tab> -- select transform option from menu
Is there a vimscript interface which could be used for this?
The insert mode completion popup can be used to insert a choice of text fragments. There are two ways to implement it, see
:help complete-functionsand:help complete(). If your code generator returns single-line (and not too long) text fragments to insert, you could invoke the generator viasystem(...)and then feed the returned values to the completion function.On the other hand, if the menu choices do not directly correspond to inserted text, but are tactical choices or actions, most plugins present a selection menu like this, styled like built-in menus (e.g. from
:ilist):Then, insert the text corresponding to the choice via
:normal! iText, orsetline().As you appear to need the completion from visual mode, you can first capture the selected text by starting your mapping with
y.