How do I schedule a Lua callback to run after a delay in Neovim for deferred or non-blocking initialization?
vim.defer_fn()
vim.
2277 results for "@a"
vim.defer_fn()
vim.
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
nnoremap <leader>s :w<CR>
Use nnoremap for non-recursive normal mode mappings.
set textwidth=80
Set textwidth (or tw) to automatically insert line breaks when typing past the specified column.
:ptag function_name
The :ptag command opens a tag definition in a small preview window at the top of the screen, letting you read the definition without losing your place in the cu
buffers-windows #buffers #windows #tags #preview #navigation
:set formatoptions+=a
Vim's formatoptions setting controls how automatic text formatting works.
:undojoin | normal! A;<CR>
When you automate edits from Ex commands, Vim usually creates a separate undo entry for each change.
:'<,'>sort /\%20v/
When lines contain aligned columns, plain :sort often gives the wrong order because it compares from column 1.
visual-mode #visual-mode #sorting #text-processing #command-line
:let @/ = "pattern"
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
/\%>10l\%<20lpattern
Vim's \%>Nl and \%10l matches only after line 10 \%10l\%10l\%<20lold/new/g Combine with column restrictions for precise region targeting Tips Line numbers in \%
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
:s/^/\=line('.') - line("'<") + 1 . '. '/
When you need to quickly number a set of lines — such as TODO items, steps, or bullet points — you can use a visual selection combined with a substitution e
visual-mode #visual-mode #editing #ex-commands #formatting #substitute
:execute "normal! \<{key}>"
When building dynamic :execute normal! calls in Vimscript, you must use double-quoted strings with the \ notation so Vim interprets the special key codes.
:s/\v(\w+)\s+(\w+)/\2 \1/
By using capture groups in a substitute command with very magic mode (\v), you can swap two adjacent words in a single operation.
:pedit +/TODO %
When you need a second read-only view of the same file, opening more normal splits can disrupt your working layout.
:e ++enc={encoding}
When Vim auto-detects the wrong character encoding — mojibake where é shows as é is a classic symptom — you can reload the current buffer with a specifi
:%s/\w\+/\u&/g
Vim's substitute command supports case-conversion modifiers in the replacement string.
:let @q = 'content'
:let @{reg} = 'string' directly assigns content to any named register from Vimscript.
\%(...\)
Vim's standard grouping syntax \(.
:tabnew filename
The :tabnew filename command opens a file in a new tab page in Vim.
buffers-windows #buffers-windows #tabs #ex-commands #navigation