How do I save a recorded macro permanently so it persists across Vim sessions?
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
2125 results for "i" a""
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
vim.api.nvim_buf_call()
vim.
gw
The gw operator reformats text to fit within textwidth, just like gq — but with one key difference: gw leaves the cursor in its original position after format
{count}gt
Prefixing gt (go to next tab) with a count jumps directly to the tab page at that position.
buffers-windows #tabs #buffers-windows #navigation #normal-mode
:lvimgrep /pattern/j **/* | lopen
Quickfix is great, but it is global.
d/{pattern}<CR>
Vim lets you use a / search as a motion for any operator.
:packadd {name}
Vim 8+ and Neovim have a built-in package manager.
/pattern/+3
Vim's search command accepts an offset after the pattern that shifts where the cursor lands relative to the match.
:s/\v\w+/\U&/g
Vim's substitute command supports special case-conversion sequences in the replacement string, letting you transform matched text to upper or lower case without
:set diffopt+=algorithm:histogram
Switches Vim's diff algorithm from the default Myers algorithm to histogram, which produces more semantically meaningful diffs by avoiding false matches between
<C-w>_ and <C-w>=
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
qq{actions}@qq
A recursive macro ends by calling itself, so it loops automatically without you pressing @q repeatedly.
qqq then qq{commands}@qq
A recursive macro in Vim calls itself at the end of its body, repeating automatically until one of its commands fails.
nnoremap <nowait> {key} {action}
The flag on a mapping tells Vim not to delay waiting for a longer key sequence.
let g:netrw_liststyle=3 and let g:netrw_banner=0
How it works Vim ships with a built-in file explorer called netrw that you can access with :Explore (or :Ex).
\V
Vim's default search mode gives special meaning to characters like .
nnoremap <key> <Cmd>command<CR>
The special key (Vim 8.
config #config #macros #ex-commands #normal-mode #insert-mode
:set splitkeep=screen
Controls how Neovim preserves the visual position of content when creating, closing, or resizing horizontal splits.
ftdetect/{filetype}.vim
Vim automatically sources every file in ftdetect/ directories on the runtimepath when filetype detection runs.
:vim /pattern/ **
:vimgrep /pattern/ (shortened to :vim) is Vim's built-in project-wide search.