I have a vim script that uses a one line window to get a filename pattern from the user. This pattern can be completed to a full filename from a database if you press CTRL-X
Try - and modify if necessary - this plugin: http://www.vim.org/scripts/script.php?script_id=1879
I'm a happy user.
You should look at :h autocmd
. I believe the InsertChange
event could be used to do what you want.
Austin is on the right track, but just with the wrong event. Take a look at the CursorMovedI
event of autocmd
. Basically, it'll fire any time the keyboard cursor moves while in Insert mode. Type a character? Cursor moves, and the event is fired.
Keep in mind this is a bit heavy-handed for your use, because the cursor can move due to other things than typing or deleting characters. The user could use the arrow keys to move back where they want to edit. You'd be popping up the completion with every move.
I can't find anything in the help about window-local autocommands, but buffer-local exists, so that might be close enough.