How do I find which plugin or script defined a specific mapping?
:verbose nmap <leader>
The :verbose prefix on mapping commands shows not just the mapping definition but also the file and line number where it was defined.
:verbose nmap <leader>
The :verbose prefix on mapping commands shows not just the mapping definition but also the file and line number where it was defined.
:call feedkeys("iHello\<Esc>", 'n')
The feedkeys() function injects keystrokes into Vim's input buffer as if the user typed them.
q/k?pattern<CR>
Vim's command-line history window (q: for Ex commands, q/ for search) opens a full editing buffer containing your history.
:/start/,/end/command
Vim allows pattern-based ranges in Ex commands, letting you operate on lines between two search matches.
:sandbox {command}
Vim's sandbox mode restricts what a command can do, preventing it from executing shell commands, writing files, or modifying certain settings.
:call timer_start(1000, {-> execute('echo "done"')})
Vim's timerstart() function lets you schedule code to run after a specified delay in milliseconds.
:doautocmd User MyEvent
Vim's User event type lets you define custom events that fire on demand.
:cnoremap <C-a> <Home>
Vim's command line has limited navigation by default.
:command -complete=file -nargs=1 E edit <args>
When defining custom commands with :command, the -complete option adds tab completion for arguments.
command-line #command-line #completion #custom-command #tab-complete
:execute 'normal! ' . count . 'j'
The :execute command evaluates a string as an Ex command, enabling dynamic command construction.
:cabbrev tn tabnew
Command-line abbreviations with cabbrev let you create short aliases for frequently used Ex commands.
command-line #command-line #abbreviation #shortcuts #productivity
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
:%norm! A;
The :norm! (or :normal!) command executes normal mode keystrokes while ignoring all user-defined mappings.
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
:verbose set {option}?
:verbose set {option}? shows the current value of an option and reports exactly which file set it last — the full path and line number.
<C-r><C-f>
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
:args **/*.py
Vim's argument list (arglist) is a named list of files that you can operate on as a group.
:%!{command}
The ! filter command in Vim sends a range of lines to an external program as standard input, then replaces those lines with the program's standard output.
:saveas
The :saveas {filename} command writes the current buffer to a new file and makes that new file the current buffer's file.
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.