aboutsummaryrefslogtreecommitdiff
path: root/Common/nvim
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-01-12 16:32:44 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2024-01-12 16:32:44 +0100
commitabbbe7a4d3062ea2df0dd263528d824b7e4363a3 (patch)
tree5b5575e2118cc2c62b64185b43974901eea02c23 /Common/nvim
parented3495dcbe3e6da94f9fcb94288d76bf86af51cd (diff)
downloaddotfiles-abbbe7a4d3062ea2df0dd263528d824b7e4363a3.tar.gz
dotfiles-abbbe7a4d3062ea2df0dd263528d824b7e4363a3.zip
Add shortcuts for yanking/pasting from system clipboard
Diffstat (limited to 'Common/nvim')
-rwxr-xr-xCommon/nvim/lua/basic.lua10
-rwxr-xr-xCommon/nvim/lua/helper_functions.lua1
2 files changed, 11 insertions, 0 deletions
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', '<D-k>', '<M-k>', silentnoremap)
end
+-- Interact with system clipboard
+map('v', '<leader>y', '"+y', noremap)
+map('n', '<leader>Y', '"+yg_', noremap)
+map('n', '<leader>y', '"+y', noremap)
+
+map('v', '<leader>p', '"+p', noremap)
+map('v', '<leader>P', '"+P', noremap)
+map('n', '<leader>p', '"+p', noremap)
+map('n', '<leader>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)