How do I join two lines together in Vim?
J
The J command joins the current line with the line below it, replacing the newline with a space.
2125 results for "i{ a{"
J
The J command joins the current line with the line below it, replacing the newline with a space.
:nohlsearch
After a search in Vim, matched text is highlighted as long as hlsearch is enabled.
<C-]> / <C-t>
The command jumps to the definition of the keyword under the cursor using a tags file, and jumps back.
:set textwidth=80
The textwidth option sets the maximum width for text.
:put =execute('messages')
Vim's :messages command shows recent output — error messages, echo'd values, and diagnostic information — but the display is ephemeral and hard to search.
vim.lsp.buf.format()
Neovim's built-in LSP client exposes vim.
:vertical diffsplit {file}
Vim has a built-in diff mode that highlights added, removed, and changed lines between two (or more) buffers.
searchcount()
The searchcount() function returns a dictionary containing the current search state: which match the cursor is on, how many total matches exist, and whether the
:%s/\V<C-r>//gc
When your last search pattern contains punctuation, slashes, or regex atoms, retyping it inside :substitute is error-prone.
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
:Git blame
The vim-fugitive plugin by Tim Pope provides a powerful interactive :Git blame that goes far beyond the basic command-line git blame.
"=2+3<CR>p
The expression register = evaluates a Vimscript expression and stores the result.
:set signcolumn=number
Setting signcolumn=number tells Neovim to display signs (diagnostics, git hunks, breakpoints) inside the line number column instead of adding a dedicated extra
zl and zh
When a line is longer than the window width and wrap is off, Vim can display only part of it.
:tabdo
The :tabdo {cmd} command executes an Ex command in each open tab page sequentially, visiting every tab and running the command there.
buffers-windows #tabs #buffers #ex-commands #buffers-windows
readfile() and writefile()
readfile({path}) reads a file and returns its contents as a list of lines, and writefile({list}, {path}) writes a list of lines back to disk.
<C-v>jjI\=printf('%02d ', line('.')-line("'<")+1)<CR><Esc>
By combining visual block insert with Vim's expression register, you can insert dynamically computed line numbers at the start of each selected line.
visual-mode #visual-mode #block-mode #line-numbers #expression-register
:%s/\v(\S+)\s+(\S+)/\2 \1/<CR>
When you need to flip two fields across a whole file, a single substitution is faster and safer than recording a macro.
editing #editing #substitution #regex #ex-commands #formatting
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.
:cexpr system('grep -rn pattern .')
While :make and :grep populate the quickfix list, they are limited to their configured programs.