How do I open the alternate file in a new split window without typing its name?
<C-w><C-^>
Press (Ctrl+W followed by Ctrl+6) to open the alternate file in a horizontal split.
2277 results for "@a"
<C-w><C-^>
Press (Ctrl+W followed by Ctrl+6) to open the alternate file in a horizontal split.
:Gclog
Running :Gclog in vim-fugitive loads the git log for the current file into the quickfix list.
:put =system('cmd')
:put =system('cmd') lets you insert the output of any shell command as new lines in your buffer without leaving Vim.
:set undodir^=$HOME/.vim/undo//
If you already have an undodir configured by a distro config or plugin, replacing it outright can remove fallback paths you still want.
flash.nvim
flash.
:windo normal! @q
When you split a file into multiple windows or keep several related buffers visible, repeating the same small cleanup in each one can be tedious.
macros #macros #windows #normal-mode #ex-commands #automation
:s/\(\w\+\) \(\w\+\)/\=submatch(2) . ' ' . submatch(1)/
The submatch(N) function lets you access individual capture groups inside a \= (expression replacement) in a substitution.
<C-d>
The (Ctrl+d) command scrolls the window down by half a screen, moving both the viewport and the cursor.
:set formatoptions-=cro
By default, Vim continues the current comment leader when you press in insert mode or open a new line with o/O.
/\V<C-r>=histget('/', -2)<CR>
If you often alternate between two complex search patterns, opening q/ each time is slow.
\%V (in search/substitute pattern)
The \%V atom in a Vim pattern matches only inside the last visual selection.
search #search #visual-mode #substitution #regex #normal-mode
:DiffOrig
:DiffOrig opens a side-by-side split comparing your current (unsaved) buffer against the version on disk.
buffers-windows #diff #buffers #editing #workflow #buffers-windows
: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.
zG
zG marks the word under the cursor as correctly spelled in Vim's internal word list, which exists only for the current session.
:'<,'>sort!
The sort! command sorts the selected lines in reverse (descending) order.
qqgUiwjq2@q
Macros are strongest when the edit pattern is stable but too awkward for a one-liner substitute.
o (in visual mode)
While in visual mode, pressing o swaps the cursor to the opposite end of the selection.
:set wildoptions=pum
Setting wildoptions=pum tells Neovim to use its popup menu for command-line tab completion instead of the traditional horizontal wildmenu bar.
:keepjumps {cmd}
:keepjumps is a command modifier that suppresses any jump list updates caused by the command that follows it.
:%s/\v<(\w)(\w*)>/\u\1\L\2/g
When you need to normalize casing across headings, labels, or generated docs, editing words one by one is tedious.