How do I run a Lua expression on every line of a buffer in Neovim?
:[range]luado {lua-expr}
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
Search Vim Tricks
Searching...:[range]luado {lua-expr}
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
\@!
In Vim's regex engine, \@! is the negative lookahead assertion.
:sort! n
The :sort! n command sorts the lines of a buffer (or a range) by their numeric value in descending order.
:put =strftime('%Y-%m-%d')
The :put = command inserts the result of a Vimscript expression directly into the buffer as a new line.
:set winwidth=85 winheight=20
Setting winwidth and winheight tells Vim the minimum column width and line height the current focused window must have.
:set nrformats=
The nrformats option controls which number formats (increment) and (decrement) recognize.
:undolist
Vim's undo history is a tree, not a linear stack.
:[range]center
Vim provides three Ex commands for aligning text within a specified column width: :[range]left, :[range]center, and :[range]right.
command-line #ex-commands #formatting #editing #command-line
:normal! {cmd}
When you use :normal {cmd} in a Vimscript function, macro, or Ex command, Vim expands any keys through the user's current mappings first.
:lgrep {pattern} {files}
The location list is a per-window counterpart to the global quickfix list.
buffers-windows #buffers-windows #ex-commands #search #navigation
:[range]yank {reg}
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu
:set shiftwidth=0
Setting shiftwidth=0 tells Vim to use the value of tabstop wherever shiftwidth would normally be consulted — for the > and and in insert mode, and auto-indent
:earlier {time}
Vim's :earlier and :later commands let you travel through undo history using real-world time intervals instead of individual change counts.
:set option!
For any boolean option, appending ! to :set inverts its current value.
do and dp
When comparing files with :vimdiff or :diffthis, Vim highlights each difference as a hunk.
"*
On X11 Linux systems, there are two independent clipboard-like buffers: the primary selection (") and the clipboard ("+).
<C-v><Tab>
When expandtab is set, pressing the Tab key inserts spaces instead of a real tab character.
:let @q = substitute(@q, "old", "new", "g")
Vim macros are stored as plain text in registers, which means you can inspect and modify them like any other string.
:g/pattern/t.
Combining :global with the :t (copy) command and the .
zj
When your file uses folds, zj and zk let you navigate directly to fold boundaries — jumping to the start of the next fold below or the end of the previous fol