‹ back home

Selection cheatsheet

2022-12-03

There’s multiple selections:

Vim (& derivates)

Vim has registers. They are accessed by prefixing "X, where X is a register name. These extend the ones above:

Neovim config example:

-- Copy to PRIMARY selection on mouse selection.
vim.keymap.set("v", "<LeftRelease>", '"*ygv')

-- Yank (copy) to PRIMARY selection by default (e.g.: with `yy`).
vim.opt.clipboard = "unnamed"

Also possible, but confusing in terminals:

-- Copy to CLIPBOARD selection with ctrl+c.
vim.keymap.set("v", "<C-c>", '"+ygv')

-- Paste from CLIPBOARD selection with ctrl+v.
vim.keymap.set("v", "<C-v>", '"+p')
— § —