How do I repeat the last substitute command quickly?
&
The & command in normal mode repeats the last :s substitution on the current line.
search #search #substitution #ex-commands #repeat #normal-mode
2125 results for "i( a("
&
The & command in normal mode repeats the last :s substitution on the current line.
search #search #substitution #ex-commands #repeat #normal-mode
<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.
vim.lsp.completion.enable()
Neovim 0.
'[ and ']
Vim automatically sets two special marks after every change, yank, or put operation: '[ and '].
it and at
Vim provides two built-in text objects for HTML and XML tags: it (inner tag) and at (a tag).
editing #text-objects #editing #visual-mode #html #normal-mode
:lcd %:p:h
:lcd %:p:h sets the working directory for the current window to the directory of the file you're editing, using Vim's path expansion modifiers.
Treesitter incremental selection with grn/grc
nvim-treesitter provides incremental selection that expands based on the syntax tree rather than simple text patterns.
zt / zb
The zt and zb commands scroll the viewport so the current cursor line appears at the top or bottom of the screen respectively, without moving the cursor.
:resize N / :vertical resize N
The :resize and :vertical resize commands set a window to an exact number of lines or columns.
:syntax on
The :syntax on command enables syntax highlighting in Vim, colorizing your code based on the file type.
z<CR>
While zt scrolls the current line to the top of the screen, z does the same scroll but also moves the cursor to the first non-blank character of that line.
V
The V (uppercase) command enters visual line mode, which selects the entire current line.
<C-w>c
The c (Ctrl+w then c) command closes the current window without closing the buffer it contains.