Show Vim omnicomplete for specific characters instead of Ctrl-X Ctrl-O?

In Vim 7, Ctrl-X Ctrl-O shows a list of possible values, but I find this key sequence is too long when I often use the autocomplete function. For example, in an HTML file, I would like the list to pop up automatically after entering the type <followed by one or two letters. In the CSS file, I would like to see a list after I hit the ":" key. Is there any way to fix this?

+5
source share
2 answers

To activate omnicompletion when entering ":", you can use the following display.

imap : :<c-x><c-o>

, , ":" omnicompletion, ":" , .

ctrl-space omnicompletion:

imap <c-space> <c-x><c-o>

omni , .

+8

, , - , , . ~/.vimrc

imap <tab><tab> <c-x><c-o>
+1

All Articles