How do I search backward for the word under the cursor?
#
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
2277 results for "@a"
#
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
:set equalprg={program}
The equalprg option replaces Vim's built-in = indentation operator with any external formatting program.
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g<CR>
When you need to normalize IDs, ticket numbers, or sequence values, :substitute can do more than plain text replacement.
command-line #command-line #substitute #regex #formatting #ex-commands
:tabnew | lcd /path/to/project
Vim's :lcd (local change directory) sets the working directory per window.
buffers-windows #buffers #windows #tabs #workflow #project-management
:set diffopt+=algorithm:histogram,hiddenoff
Default diff behavior is fine for small changes, but larger refactors often produce noisy hunks and annoying warnings about hidden buffers.
:packadd matchit
The matchit plugin ships with Vim and Neovim but is not enabled by default.
:set number relativenumber
Enabling both number and relativenumber simultaneously activates hybrid line numbering: the current line displays its true absolute line number while every othe
:set nowrapscan
By default Vim's wrapscan option is enabled, which causes / and ? searches to wrap silently from the end of the file back to the beginning (and vice versa).
:set showcmdloc=statusline
When you chain operators and motions, showcmd feedback is critical, but the default bottom-line location can fight with command messages and prompts.
:set suffixesadd+=.js,.ts,.py
In many programming languages, import statements reference modules without file extensions (e.
cs"(
The cs operator in vim-surround (change surrounding) swaps one pair of delimiters for another without touching the content inside.
<C-t> and <C-d>
When you're typing in insert mode and realize the current line needs more or less indentation, you don't have to leave insert mode to fix it.
ds"
The vim-surround plugin provides the ds command to instantly delete any surrounding delimiter pair.
plugins #plugins #surround #editing #text-objects #normal-mode
:vimgrep /pattern/g **/*.ext
The :vimgrep command searches for a pattern across multiple files and loads the results into the quickfix list.
~/.vim/after/ftplugin/{filetype}.vim
Vim's after directory (~/.
:set sessionoptions-=curdir
When you restore a session with :source Session.
:set foldmethod=indent
Setting foldmethod=indent tells Vim to create folds based on the indentation level of each line.
:set viewoptions=folds,cursor,slash,unix
mkview and loadview are great for restoring editing context, but the default viewoptions can bring back more state than you actually want.
vim.lsp.foldexpr()
Neovim 0.
ci" / ci( / ci{ / ci[ / ci` / ci'
The ci{delimiter} family of commands changes the text inside any matching pair of delimiters.
editing #editing #text-objects #change #delimiters #normal-mode