Calling omnicompletion for every keypress in vim

只谈情不闲聊 提交于 2019-12-01 09:09:47

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!