How do I define the comment format Vim uses for auto-commenting and plugins like vim-commentary?
:set commentstring=//\ %s
The commentstring option controls the template Vim uses to represent commented-out lines.
2277 results for "@a"
:set commentstring=//\ %s
The commentstring option controls the template Vim uses to represent commented-out lines.
"=2+3<CR>p
The expression register = evaluates a Vimscript expression and stores the result.
zx
The zx command resets and recomputes all folds in the current window based on the current foldmethod.
P
The P (uppercase) command pastes the contents of the default register before the cursor position.
g_
g moves the cursor to the last non-blank character of the current line — skipping trailing spaces and tabs.
zg and zw
When Vim's spell checker marks a word as incorrect but it is intentionally spelled that way (a name, abbreviation, or domain-specific term), you can permanently
<C-q> (Telescope)
While inside any Telescope picker, pressing sends all current results to the quickfix list and closes the picker.
z{N}<CR>
The z{N} command sets the current window's height to exactly N lines and simultaneously positions the current line at the top of the window.
>G
The >G command applies a right-indent shift to every line from the cursor through the last line of the buffer.
:set backupcopy=yes
When Vim saves a file, it may use a rename-style write strategy that can replace the original inode.
vim.diagnostic.count()
vim.
:smagic/\vfoo.+/bar/
If you prefer very-magic regex syntax but don't want to change global settings, :smagic is a targeted solution.
:nnoremap <buffer> <leader>r :!python %<CR>
How it works By adding to a mapping command, the mapping only applies to the current buffer.
<C-r>=system('cmd')
In command-line mode, =system('command') evaluates the shell command and inserts its output into the command line.
:UndotreeToggle
The undotree plugin provides a visual tree representation of Vim's undo history.
:'<,'>m'>+1
The :m command with the visual range moves selected lines.
:[range]center
Vim provides three Ex commands for aligning text within a specified column width: :[range]left, :[range]center, and :[range]right.
command-line #ex-commands #formatting #editing #command-line
<C-r><C-l>
Pressing on the command line inserts the full text of the current buffer line (the line the cursor is on when you pressed :) directly at the command-line cursor
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.
:set incsearch hlsearch
The combination of incsearch and hlsearch gives you live, interactive search highlighting.