Vim miscellaneous

Updated: 10 February 2024

https://vimhelp.org/


Check if you’re running vim or neovim
:echo has('nvim')

To copy/paste with PRIMARY clipboard (i.e. copy on select)
"*y ("*yy) and then "*p

To copy/paste with CLIPBOARD clipboard (i.e. Ctrl c/v)
"+y ("+yy) and then "+p

Yank full line without new line character
^y$

Line numbers
:set number
:set nonumber

Line wrap
:set wrap
:set nowrap

Open all files in current directory
nvim *

Unload buffer [N] (default: current buffer) and delete it from the buffer list.
:bd[elete][!] [N]

Open all buffers in horizontal or vertical windows
:[vertical] ball

Open all buffers in tabs
:tab ball

Repeat last command mode command
@:

Open file/link under cursor
gz

Browse recent files
:browse oldfiles

Format a json file with jq command line JSON processor
:%!jq .

Apply a command to all open windows
:windo set list

Join lines with no space character
gJ

Print current file name with full path (any number would work)
3CTRL-G

Go to 1st search result
ggn