How do I trigger a custom user-defined completion function in insert mode?
<C-x><C-u>
Vim's invokes a user-defined completion function, letting you plug any completion logic you want into the standard insert-mode completion popup.
<C-x><C-u>
Vim's invokes a user-defined completion function, letting you plug any completion logic you want into the standard insert-mode completion popup.
<C-x><C-i>
Vim's completion mode searches for keyword matches not just in the current buffer, but also in all files reachable via include directives (e.
:set completeopt=menuone,noselect
By default, Vim's and completion can auto-insert the first match, or only show a menu when there are multiple matches.
inoremap <Left> <C-g>U<Left>
In insert mode, any cursor movement — including arrow keys, Home, and End — causes Vim to split the undo block at that point.
<C-r>-
In insert mode, - pastes the contents of the small delete register ("-).
<C-o> (insert mode)
Pressing while in insert mode lets you execute exactly one normal mode command and then automatically returns you to insert mode.
<C-\>e
Pressing e on the command line opens a special prompt that lets you type a Vimscript expression.
command-line #command-line #ex-commands #vimscript #insert-mode
<C-x><C-]>
Pressing in insert mode opens a completion menu populated from your project's tags file.
:put ={expr}
The :put ={expr} command evaluates a Vimscript expression and inserts the result as a new line below the cursor.
<C-y> (above) / <C-e> (below)
In insert mode, inserts the character from the same column one line above, and inserts the character from the same column one line below.
<C-r><C-r>{reg}
When you insert a register with {reg} in insert mode, Vim processes the content as if you had typed it — this means autoindent, autoformat, and insert-mode ma
<C-r>={expr}<CR>
The expression register ("=) lets you evaluate any Vimscript expression and insert the result directly into the buffer — all without leaving insert mode.
gI
Most Vim users know I to insert at the start of a line — but I actually jumps to the first non-blank character, skipping leading whitespace.
ysiw"
The ysiw" command wraps the word under the cursor in double quotes using the vim-surround plugin.
:iabbrev
:iabbrev defines insert mode abbreviations — short strings that expand automatically when you type a non-keyword character (like space or Enter) after them.
gR
gR enters Virtual Replace mode, a smarter variant of Replace mode (R) that replaces characters based on screen columns rather than raw bytes.
<C-e> / <C-y> (insert mode)
In insert mode, copies the character directly below the cursor (from the next line) and copies the character directly above (from the previous line).
<C-v>u{hex}
In insert mode, pressing followed by u and a 4-digit hexadecimal codepoint inserts the corresponding Unicode character directly into the buffer.
iabbrev
:iabbrev defines insert-mode abbreviations that expand automatically when you type a non-keyword character (space, punctuation, ) after the abbreviation.
<C-y> and <C-e>
In Insert mode, copies the character at the same column position from the line above the cursor, and copies the character from the line below.