How do I rotate or swap window positions in Vim?
<C-w>R
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.
2277 results for "@a"
<C-w>R
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.
/pattern1\&pattern2
Vim's \& operator lets you intersect two patterns so the match must satisfy both simultaneously.
// vim: set ts=2 sw=2 et:
Add a modeline comment at the beginning or end of a file.
vim.filetype.add()
vim.
<C-i>
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
:ball
The :ball command opens a window for every buffer in the buffer list.
w
The w command moves the cursor forward to the beginning of the next word.
%:p:h
Vim's filename modifiers let you derive path components from the current file's name directly inside ex commands.
:vimgrep /{pattern}/j **/*
For project-wide searches, :vimgrep is powerful but can feel disruptive if it jumps into files while populating quickfix.
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.
dp / do
When reviewing differences between files in Vim's built-in diff mode, dp and do let you selectively apply individual hunks without leaving the editor.
json_encode()
Vim 8.
<C-v>jjI\=printf('%02d ', line('.')-line("'<")+1)<CR><Esc>
By combining visual block insert with Vim's expression register, you can insert dynamically computed line numbers at the start of each selected line.
visual-mode #visual-mode #block-mode #line-numbers #expression-register
?pattern
The ?pattern command searches backward through the file for the given pattern, starting from the cursor position and wrapping around to the end of the file if n
:g/^\s*$/,/./-1join
When text is hard-wrapped (for example from email, logs, or copied docs), joining entire paragraphs manually is slow and error-prone.
editing #editing #formatting #ex-commands #text-manipulation
:tab ball
:tab ball (short for :tab sball, "split all buffers in tabs") opens every listed buffer in its own tab page in a single command.
:set showcmd
The showcmd option makes Vim display the currently-typed command in the bottom-right corner of the screen, giving you live feedback as you build up key sequence
g-
Vim's undo history is a tree, not a linear stack.
require('telescope.builtin').grep_string()
Telescope's grepstring() function performs a project-wide search for the exact word currently under the cursor, displaying live-previewed results in an interact
[m
The [m motion jumps backward to the start of the nearest enclosing or preceding method definition.