How do I swap the contents of two split windows in Vim?
<C-w>x
How it works The x command exchanges the current window with the next one.
<C-w>x
How it works The x command exchanges the current window with the next one.
:b N
How it works Every buffer in Vim is assigned a unique number when it is opened.
:CocInstall coc-tsserver
coc.
:'<,'>move'>+1 or :'<,'>move'<-2
How it works Vim's :move command lets you relocate lines to a different position.
<C-w>h / <C-w>j / <C-w>k / <C-w>l
How it works Vim lets you navigate between split windows using followed by a direction key.
let @a = 'sequence'
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).
viw
How it works The command viw selects the word under the cursor in visual mode.
:GitGutterToggle
vim-gitgutter is a plugin that shows git diff markers in the sign column (the narrow column to the left of line numbers).
> and <
How it works In visual mode, you can shift selected lines to the right or left using the > and to indent them or or shifts the selected lines one shiftwidth to
@@
How it works After running a macro with @a (or any other register), you can repeat that same macro by pressing @@.
gaip=
vim-easy-align is a plugin by Junegunn Choi that makes aligning text around delimiters effortless.
:bdelete
How it works The :bdelete command (often abbreviated :bd) removes the current buffer from Vim's buffer list and closes it.
:cabbrev
:cabbrev (command-line abbreviation) lets you define short aliases for longer Ex commands.
<C-w>+
When working with multiple split windows, you often need to resize them to see more content in one pane.
:set statusline=%f\ %y\ [%l/%L]
Vim's statusline option lets you build a custom status bar from format items.
"0p in visual mode
When you paste over a visual selection with p, Vim replaces the selection with the register contents — but it also puts the deleted selection into the unnamed
Va{ or Vi{
The a{ (around braces) and i{ (inside braces) text objects combined with visual mode let you instantly select an entire function body or code block, regardless
visual-mode #visual-mode #text-objects #code-navigation #selection
:windo / :bufdo / :tabdo {command}
Vim's do commands iterate over collections and execute a command in each context.
buffers-windows #buffers #windows #tabs #batch-editing #ex-commands
:verbose map <key> or :verbose set option?
The :verbose prefix shows where a mapping, setting, command, or function was defined — which file and line number.
command-line #command-line #debugging #config #mappings #workflow
r{char} in visual mode
In visual mode, pressing r followed by a character replaces every character in the selection with that single character.