How do I toggle the case of a character in Vim?
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
411 results for "G"
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
:let @a = ""
The :let @{register} = "" command empties a register.
q/k?pattern<CR>
Vim's command-line history window (q: for Ex commands, q/ for search) opens a full editing buffer containing your history.
:&&
After running a :s/pattern/replacement/g command, you often need to repeat it on another line or range.
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
gj and gk
When wrap is enabled, long lines wrap across multiple screen lines.
gg
The gg command moves the cursor to the first line of the file.
"/ register
The / register contains the most recent search pattern.
:ALEFix
ALE (Asynchronous Lint Engine) is a popular Vim plugin that runs linters and formatters asynchronously in the background, showing errors and warnings in the gut
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
==
The == command auto-indents the current line based on the surrounding context.
:%Subvert/old{,s}/new{,s}/g
Tim Pope's vim-abolish plugin provides the :Subvert command (aliased as :S), which performs substitutions that automatically preserve case variants and handle p
plugins #plugins #substitution #editing #ex-commands #search
:%s/\V literal.text/replacement/g
The \V (very nomagic) flag treats all characters as literal except for \.
gM
The gM command moves the cursor to the horizontal middle of the current line, regardless of how long the line is.
:let @a = substitute(@a, 'old', 'new', 'g')
After recording a macro or yanking text into a named register, you may need to tweak it — fix a typo in a recorded macro, change a variable name in yanked tex
vim-startify plugin
vim-startify provides a configurable start screen when you open Vim without a file.
:%s/pattern/\r/g
In the replacement part of :s, \r inserts a newline.
Plug 'vim-airline/vim-airline'
vim-airline provides a beautiful, feature-rich status line that shows file info, git branch, diagnostics, and more with minimal configuration.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.
:[{,]}s/old/new/g
By using the range [{,]}, you can limit a substitute command to the lines between the enclosing braces — effectively the current function or block.