How do I indent or unindent the current line while staying in Insert mode?
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
cs'"
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
:set exrc
Vim's exrc option tells Vim to look for a .
:tabedit
Vim's tab pages let you keep separate window layouts open at the same time, each with its own set of splits.
"qp
Macros are stored as plain text in named registers.
!sort
Vim can pipe a visual selection through any shell command and replace the selection with the command's output.
visual-mode #visual-mode #ex-commands #external-commands #filtering
:nohlsearch
After a search in Vim, matched text is highlighted as long as hlsearch is enabled.
:set statusline=%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
Vim's built-in statusline option lets you build a custom status bar that displays exactly the information you want — without any plugin.
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.
100@a
When you give a large count to a macro — such as 100@a — Vim automatically stops replaying the macro as soon as any step inside it fails.
U
In visual mode, pressing U converts all selected characters to uppercase and u converts them to lowercase.
:/start/,/end/s/pattern/replacement/g
You can restrict a substitution to a range defined by two patterns.
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.
:Explore
Netrw is Vim's built-in file explorer plugin that comes with every Vim installation.
:set autoread
The autoread option tells Vim to automatically re-read a file when it detects the file has been changed outside of Vim.
:set conceallevel=2
The conceallevel option controls how Vim displays characters that have the "conceal" syntax attribute.
:tab help
By default, :help opens in a horizontal split, which can feel cramped.
@=
The @= command lets you type a Vimscript expression and execute the result as if it were a macro.
O in visual block mode
In visual block mode (), pressing O (uppercase) moves the cursor to the diagonally opposite corner of the rectangular selection.
\u and \l in :s replacement
Vim's substitute command supports special case modifiers in the replacement string that let you change the case of captured text on the fly.