vim-maktaba icon indicating copy to clipboard operation
vim-maktaba copied to clipboard

Add helpers for command completion

Open dbarnett opened this issue 10 years ago • 2 comments

Vim's command completion interface is fine for simple commands, but pretty awkward for more complex commands like :Glaive that can't necessarily base completion just on ArgLead (the last partial arg on the command line), and have to do complex processing on CmdLine using CursorPos and parse out the command name, leading modifiers and whatnot to handle command lines like ": ::4,'XGlaive! …".

Maktaba should include some utilities to bridge the gap between vim's completion interface and what you need to write powerful completion functions easily.

dbarnett avatar Jan 11 '14 20:01 dbarnett

One utility that might help would be a maktaba#complete#ParseCmdline() that would split out the command name, modifiers like range and bang, and the <f-args> and <q-args> values. Might also be important to be able to interpret CursorPos in terms of that data so you know if it's e.g. at the end of the last arg, in the middle of the command, or whatever.

dbarnett avatar Jan 11 '14 20:01 dbarnett

This is a fantastic idea. It could do for command line completion what kana/vim-textobj-user did for text objects.

chiphogg avatar Jan 11 '14 22:01 chiphogg