From fd0ed3dc57ecdfe0aaf624625b0bac4348df20a6 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 6 Sep 2023 13:38:34 +0200 Subject: [PATCH] clipboard leader y --- lua/plex/config/keymaps.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/plex/config/keymaps.lua b/lua/plex/config/keymaps.lua index 1ae4516..99634a5 100644 --- a/lua/plex/config/keymaps.lua +++ b/lua/plex/config/keymaps.lua @@ -75,17 +75,20 @@ map('n', 'zh', 'z4h') -- Clipboard -- === --- TODO: make y copy to system +-- Yank to system clipboard +map({'n', 'v', 'x'}, 'y', '"+y"') +map({'n', 'v', 'x'}, 'yy', '"+yy"') +map({'n', 'v', 'x'}, 'Y', '"+Y"') -- Yank buffer's relative path to clipboard -map('n', 'y', function() +map('n', 'yp', function() local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':~:.') vim.fn.setreg('+', path) vim.notify(path, vim.log.levels.INFO, { title = 'Yanked relative path' }) end, { silent = true, desc = 'Yank relative path' }) -- Yank absolute path -map('n', 'Y', function() +map('n', 'Yp', function() local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':p') vim.fn.setreg('+', path) vim.notify(path, vim.log.levels.INFO, { title = 'Yanked absolute path' }) @@ -136,10 +139,6 @@ map('n', '', 'move+==', { desc = 'Move line down' }) map('x', '', ":move'<-2gv=gv", { desc = 'Move selection up' }) map('x', '', ":move'>+gv=gv", { desc = 'Move selection down' }) --- Duplicate lines without affecting PRIMARY and CLIPBOARD selections. -map('n', 'yyp', 'm`""Y""P``', { desc = 'Duplicate line' }) -map('x', 'yyp', '""Y""Pgv', { desc = 'Duplicate selection' }) - -- Remove spaces at the end of lines map('n', 'cw', 'lua MiniTrailspace.trim()', { desc = 'Erase Whitespace' })