Vim miscellaneous

Updated: 09 October 2023

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

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

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

Print the current file name with full path

Go to 1st search result