How do I delete all blank lines in a file?
:g/^$/d
The :g/^$/d command deletes every blank line in the file using Vim's powerful global command.
415 results for "n N"
:g/^$/d
The :g/^$/d command deletes every blank line in the file using Vim's powerful global command.
[I
How it works The [I command searches the current file (and included files) for the word under the cursor and displays a list of all matching lines with their li
z<CR> and z. and z-
Vim has two sets of scroll-and-position commands: zt/zz/zb (which reposition the screen but keep the cursor column intact) and z/z.
:CocInstall coc-tsserver
coc.
qq /pattern<CR> {commands} q
By incorporating a search command inside a macro, you can make it jump to the next occurrence of a pattern before performing its edits.
:argdo %s/old/new/g | w
:argdo {cmd} executes an Ex command against every file in the argument list—the set of files you opened Vim with or set explicitly with :args.
:call setreg('q', keys, 'c')
The setreg() function writes any string directly into a named register, letting you construct macro keystrokes from Vimscript expressions rather than live recor
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.
<C-x><C-u>
Vim's invokes a user-defined completion function, letting you plug any completion logic you want into the standard insert-mode completion popup.
luaeval('lua_expression')
When you have existing Vimscript code that needs to reach into Neovim's Lua ecosystem, luaeval() is the bridge.
qqqqqq{edits}@qq
A recursive macro calls itself at the end of its sequence, creating a loop that automatically repeats until a motion or command fails (such as hitting the last
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
The map modifier turns a mapping's right-hand side into a Vimscript expression that is evaluated at the time the key is pressed, with its return value used as t
v:count1
The v:count1 variable holds the count typed before a command, defaulting to 1 if no count was given.
let mapleader = ' ' then nnoremap <leader>key command
The leader key is a configurable prefix for your custom key mappings.
:profile
When Vim feels sluggish to start, the built-in :profile command lets you measure exactly how much time each script, function, or plugin takes to load.
zz
The zz command scrolls the window so that the current cursor line appears in the middle of the screen.
vim.api.nvim_create_autocmd('LspAttach', ...)
Setting your LSP keymaps inside a LspAttach autocmd ensures they are only active in buffers where a language server is actually running.
<C-r><C-r>{register}
In insert mode, {reg} pastes from a register but treats certain bytes as key inputs — so a register containing \n triggers a newline, \x08 triggers backspace,
:s/pattern/replacement/e
The e flag in Vim's :substitute command silently ignores the "E486: Pattern not found" error when the pattern does not match anything.
:wn
:wn (short for :wnext) writes the current buffer to disk and immediately advances to the next file in the argument list.