From abbbe7a4d3062ea2df0dd263528d824b7e4363a3 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Fri, 12 Jan 2024 16:32:44 +0100 Subject: Add shortcuts for yanking/pasting from system clipboard --- Common/nvim/lua/basic.lua | 10 ++++++++++ Common/nvim/lua/helper_functions.lua | 1 + 2 files changed, 11 insertions(+) (limited to 'Common/nvim') diff --git a/Common/nvim/lua/basic.lua b/Common/nvim/lua/basic.lua index 3749310..d1b0901 100755 --- a/Common/nvim/lua/basic.lua +++ b/Common/nvim/lua/basic.lua @@ -226,6 +226,16 @@ if vim.fn.has("mac") or vim.fn.has("macunix") then map('v', '', '', silentnoremap) end +-- Interact with system clipboard +map('v', 'y', '"+y', noremap) +map('n', 'Y', '"+yg_', noremap) +map('n', 'y', '"+y', noremap) + +map('v', 'p', '"+p', noremap) +map('v', 'P', '"+P', noremap) +map('n', 'p', '"+p', noremap) +map('n', 'P', '"+P', noremap) + -- Delete trailing whitespace on save --vim.api.nvim_create_autocmd("BufWritePre", { -- pattern = { "*" }, diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index 515854f..1b9ac50 100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua @@ -1,5 +1,6 @@ -- opts that replicate the nore part of noremap silentnoremap = { noremap = true, silent = true } +noremap = { noremap = true, silent = false } -- Just to make the map function "shorter" function map(kind, lhs, rhs, opts) -- cgit v1.2.3