1
0

Yank to clipboard explicitly

Prevents the clipboard from being spammed with yanked content
This commit is contained in:
Patrick Auernig 2024-06-05 16:04:27 +02:00
parent b60f0c8457
commit ad09e704e8
2 changed files with 10 additions and 9 deletions

View File

@ -3,23 +3,27 @@ local map = vim.keymap.set
map("n", "<Leader><CR>", "<cmd>noh<CR>") map("n", "<Leader><CR>", "<cmd>noh<CR>")
map("n", "U", "<cmd>redo<CR>") map("n", "U", "<cmd>redo<CR>")
map("n", "Y", "y$") map("n", "Y", "y$")
map({"n", "v", "i"}, "<C-s>", "<cmd>w<CR>") map({ "n", "v", "i" }, "<C-s>", "<cmd>w<CR>")
map("n", "s", "<NOP>") map("n", "s", "<NOP>")
-- Yank to clipboard
map({ "n", "v" }, "<Leader>y", [["+y]])
map({ "n", "v" }, "<Leader>Y", [["+Y]])
-- Move up and down visual lines for the few times I need wrapping -- Move up and down visual lines for the few times I need wrapping
map("n", "j", "gj") map("n", "j", "gj")
map("n", "k", "gk") map("n", "k", "gk")
-- More sensible start and end of line -- More sensible start and end of line
map({"n", "v"}, "H", "^") map({ "n", "v" }, "H", "^")
map({"n", "v"}, "L", "$") map({ "n", "v" }, "L", "$")
-- Exit insert mode by quickly pressing jk -- Exit insert mode by quickly pressing jk
map("i", "jk", "<ESC>l", { silent = true }) map("i", "jk", "<ESC>l", { silent = true })
-- This avoids accidentially recording a macro -- This avoids accidentially recording a macro
map({"n", "v"}, "<F1>", "q") map({ "n", "v" }, "<F1>", "q")
map({"n", "v"}, "q", "<NOP>") map({ "n", "v" }, "q", "<NOP>")
-- Move selected lines up or down -- Move selected lines up or down
map("v", "J", ":move '>+1<CR>gv=gv") map("v", "J", ":move '>+1<CR>gv=gv")

View File

@ -20,9 +20,6 @@ vim.opt.foldlevelstart = 99
vim.opt.fillchars:append({ eob = "·" }) vim.opt.fillchars:append({ eob = "·" })
-- yank to clipboard, requires wl-copy command or equivalent
vim.opt.clipboard:append("unnamedplus")
vim.g.mapleader = " " vim.g.mapleader = " "
@ -37,7 +34,7 @@ aucmd("TextYankPost", {
}) })
-- Hide cursor line while in insert mode -- Hide cursor line while in insert mode
aucmd({"InsertEnter", "InsertLeave", "BufEnter"}, { aucmd({ "InsertEnter", "InsertLeave", "BufEnter" }, {
group = "valeth", group = "valeth",
callback = function(args) callback = function(args)
local entered_insert_mode = args.event == "InsertEnter" local entered_insert_mode = args.event == "InsertEnter"