How do I open the file path under my cursor in a new split window?
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
2277 results for "@a"
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
:g/pattern/+1d
Using :g/pattern/+1d you can delete the line that comes right after each line matching a pattern, in one pass.
:normal! {cmds}
:normal {cmds} executes normal-mode keystrokes from the command line, but it honors your custom key mappings — so remapped keys produce unexpected results in
command-line #ex-commands #macros #normal-mode #command-line
:args **/*.py | argdo %s/old/new/ge | update
Combining :args, :argdo, and :update gives you a powerful in-editor multi-file search and replace without leaving Vim.
:diffget LOCAL
When Vim is configured as a git mergetool, it opens a three-way split with the LOCAL (your branch), REMOTE (their branch), and MERGED (the output file) buffers.
buffers-windows #buffers-windows #diff #editing #command-line
:%normal @q
To apply a macro to every line in the file, use :%normal @q.
:bufdo command
The :bufdo command executes an Ex command on every buffer in the buffer list.
gr{char}
The gr{char} command is Vim's virtual replace variant of r{char}.
:'<,'>s/\%Vold/new/g
The \%V atom restricts a search pattern to match only within the visual selection area, including visual block selections.
:set foldcolumn=3
The foldcolumn option adds a narrow column on the left side of the window that visually represents the fold structure of the file.
:g/pattern/Commentary
vim-commentary exposes Commentary as an Ex command that toggles comments on the current line, making it composable with Vim's :global command.
:'<,'>w !{cmd}
The :'w !{cmd} command writes the visually selected lines to the stdin of an external shell command — without modifying the buffer.
vim: set ts=2 sw=2 :
A modeline is a special comment embedded in a file that Vim reads to apply file-specific settings automatically.
:cq
The :cq command quits Vim and returns a non-zero exit code to the calling process.
qq{cmds}@qq
A recursive macro is one that calls itself at the end of its own body.
:set option
The :set command changes Vim options for the current session.
diw
The diw command deletes the inner word under the cursor.
:Gvdiffsplit!
When reviewing staged versus unstaged changes, jumping between terminal git commands and editor windows is slow.
:set nrformats+=bin
Vim's and commands increment and decrement numbers under the cursor, but by default they only handle decimal and hexadecimal.
v:register
When writing custom mappings or operator functions, v:register gives you the register name that the user prefixed the mapping with.