From 6bde88b66d8c76a7d1d9e576f467cd5acede1033 Mon Sep 17 00:00:00 2001 From: Mora Unie Youer Date: Thu, 8 May 2025 11:02:18 +0300 Subject: feat: add `yanky.nvim` --- lua/config/options.lua | 4 ---- lua/config/plugins/extra.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/config/options.lua b/lua/config/options.lua index cf30af5..5a7be5d 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -59,7 +59,3 @@ map("n", "N", "Nzzzv", { desc = "Previous Search Result" }) -- Reset search highlight on ESC map("n", "", "nohlsearch", { desc = "Reset search highlight" }) - --- Copy and paste to/from clipboard -map("n", "y", [["+y]], { desc = "Copy to clipboard" }) -map("n", "p", [["+p]], { desc = "Paste from clipboard" }) diff --git a/lua/config/plugins/extra.lua b/lua/config/plugins/extra.lua index aba060b..4bbc381 100644 --- a/lua/config/plugins/extra.lua +++ b/lua/config/plugins/extra.lua @@ -1,4 +1,35 @@ return { + { + "yanky.nvim", + event = "DeferredUIEnter", + after = function(_) + require("yanky").setup({ + highlight = { timer = 150 }, + system_clipboard = { + sync_with_ring = true, + }, + }) + end, + keys = { + { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, + { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" }, + { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" }, + { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" }, + { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" }, + { "[y", "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, + { "]y", "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, + { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, + { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, + { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, + { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, + { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, + { "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, + { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, + { "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, + { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, + { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, + }, + }, { "which-key.nvim", event = "DeferredUIEnter", -- cgit v1.2.3-70-g09d2