How do I paste text from outside Vim without messing up indentation?
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
399 results for "it at"
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
:w !sudo tee %
The :w !sudo tee % command lets you save a file that requires root permissions, even if you forgot to open Vim with sudo.
:vimgrep /pattern/ **/*.ext | copen
The :vimgrep command searches for a regex pattern across multiple files and populates the quickfix list with every match.
search #search #quickfix #ex-commands #navigation #productivity #grep
@q
A recursive macro is a macro that calls itself as its last step, causing it to loop automatically until an operation fails (such as reaching the end of the file
:args **/*.py | argdo %s/old/new/gc | update
Vim can perform search-and-replace across multiple files without any plugins by combining the arglist with :argdo.
search #search #substitution #ex-commands #productivity #quickfix #arglist
dap / dip
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
editing #editing #text-objects #normal-mode #delete #motions
autocmd BufWritePre * :%s/\s\+$//e
By adding an autocmd for the BufWritePre event, you can make Vim automatically strip trailing whitespace from every line each time you save.
/\v
Vim's default regex syntax requires backslashes before most special characters like +, (, ), {, and , which is the opposite of what most developers expect from
gn
The gn motion searches forward for the next match of the last search pattern and visually selects it.
search #navigation #search #motions #normal-mode #repeat #editing
Harpoon: mark files and jump with <leader>1-4
Harpoon by ThePrimeagen provides instant access to a curated list of files you're actively working on.
z=
When spell checking is enabled, the z= command opens a numbered list of spelling suggestions for the misspelled word under the cursor.
editing #editing #spell-check #normal-mode #productivity #prose
cit
The cit command deletes everything between the nearest pair of HTML/XML tags and drops you into insert mode, ready to type the replacement.
:copen / :cnext / :cprev
The quickfix list is Vim's built-in mechanism for navigating a list of file locations — compiler errors, grep results, search matches, or any structured outpu
navigation #navigation #quickfix #ex-commands #productivity #workflow
:GBrowse
The vim-fugitive plugin combined with vim-rhubarb (for GitHub support) provides the :GBrowse command, which opens the current file on your repository's web host
qaYp<C-a>q99@a
By recording a macro that duplicates a line and increments its number, you can generate a numbered list of any length with a single replay command.
macros #macros #editing #normal-mode #automation #productivity
` vs '
Vim offers two ways to jump to a mark, and the difference is crucial: the backtick (` `) jumps to the exact line and column where the mark was set, while the si
qaqqa...@aq
A recursive macro calls itself at the end of its recording, creating a loop that repeats until a motion or command fails (like reaching the end of the file or f
:set hidden
By default, Vim refuses to let you switch away from a buffer that has unsaved changes, forcing you to save or discard with :w or :e! before moving on.
:Git
The vim-fugitive plugin by Tim Pope provides an interactive Git status window that lets you stage, unstage, diff, and commit files entirely from within Vim.
:Files
The fzf.