How do I configure :grep to use ripgrep with quickfix output and include hidden files?
:set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --glob\ !.git
Vim's :grep becomes much more useful when grepprg is tuned for ripgrep and quickfix-compatible output.
category:
config
tags:
#config
#search
#command-line
#quickfix
How do I sort selected lines in Vim?
The :'sort command sorts the currently selected lines in visual mode alphabetically.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#formatting
How do I trigger language-aware autocompletion in Vim?
The keystroke triggers omni completion, Vim's built-in language-aware completion system.
category:
editing
tags:
#insert-mode
#completion
#programming
#filetype
How do I jump to the enclosing curly brace or parenthesis in code?
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
category:
navigation
tags:
#navigation
#motions
#editing
#normal-mode
How do I jump between paragraphs in Vim?
The { and } commands move the cursor by paragraph — jumping to the previous or next blank line.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I apply different settings for specific file types in Vim?
autocmd FileType python setlocal expandtab shiftwidth=4
Vim's autocmd FileType lets you apply settings automatically whenever a specific file type is detected.
category:
config
tags:
#config
#ex-commands
#indentation
How do I paste text in insert mode without triggering auto-indent or mappings?
The {register} sequence in insert mode pastes register contents literally — without triggering auto-indentation, abbreviations, or mappings.
category:
editing
tags:
#insert-mode
#registers
#paste
#indentation
How do I prevent duplicate autocommands when reloading vimrc?
augroup name | autocmd! | ... | augroup END
Using augroup with autocmd! inside prevents duplicate autocommands from accumulating when you reload your vimrc.
category:
config
tags:
#config
#command-line
#ex-commands
How do I search across files and populate the quickfix list without jumping to the first match?
By default, :vimgrep jumps your cursor to the first match it finds, which can be disorienting when you just want to collect results and browse them on your own
category:
search
tags:
#search
#ex-commands
#buffers
How do I move the cursor to the top of the visible screen?
The H command moves the cursor to the first line of the currently visible screen (the "High" position).
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I replace the contents of the entire current line?
The cc command deletes the entire content of the current line (preserving indentation) and enters insert mode.
category:
editing
tags:
#editing
#normal-mode
How do I indent selected lines in visual mode?
In visual mode, pressing > indents all selected lines by one shiftwidth.
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
How do I highlight the line the cursor is on?
The cursorline option highlights the entire line where the cursor is positioned.
category:
config
tags:
#config
#ex-commands
How do I open or close every fold in the entire file at once?
When working with a heavily folded file, manually opening or closing each fold is tedious.
category:
editing
tags:
#folding
#navigation
#editing
#normal-mode
How do I create interactive selection menus and text input prompts in Neovim Lua scripts?
vim.ui.select() and vim.ui.input()
Neovim provides vim.
category:
plugins
tags:
#editing
#command-line
How do I switch to the previous buffer in Vim?
The :bprev (or :bp for short) command switches to the previous buffer in Vim's buffer list.
category:
buffers-windows
tags:
#buffers
#ex-commands
#navigation
How do I automatically open or close the quickfix window based on results?
The :cwindow command intelligently manages the quickfix window — it opens the window only if there are entries in the quickfix list, and closes it if the list
category:
command-line
tags:
#command-line
#quickfix
#workflow
#automation
How do I change one type of surrounding delimiter to another with vim-surround?
The cs command from the vim-surround plugin lets you swap one type of surrounding delimiter for another in a single motion.
category:
plugins
tags:
#plugins
#editing
#text-objects
#surround
How do I discard all unsaved changes and reload the file from disk in Vim?
:e! forces Vim to reload the current file from disk, discarding every unsaved change in the buffer.
category:
buffers-windows
tags:
#buffers-windows
#editing
#undo-redo
#ex-commands
How do I find the next occurrence of my search pattern?
After performing a search with / or ?, pressing n repeats the search in the same direction to find the next match.
category:
search
tags:
#search
#normal-mode