From b7dfb326232c22234f78c07a9bc684bd7f0dc2fc Mon Sep 17 00:00:00 2001 From: punkfairie Date: Wed, 1 Jan 2025 16:58:35 -0800 Subject: [PATCH] feat: yanky.nvim --- nix/neovim-overlay.nix | 1 + nvim/lua/plugins/coding/init.lua | 1 + nvim/lua/plugins/coding/yanky-nvim.lua | 104 +++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 nvim/lua/plugins/coding/yanky-nvim.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index af851c5..692a4a0 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -101,6 +101,7 @@ with final.pkgs.lib; let mini-comment mini-ai mini-surround + yanky-nvim # Formatting conform-nvim diff --git a/nvim/lua/plugins/coding/init.lua b/nvim/lua/plugins/coding/init.lua index f3741cf..27f6238 100644 --- a/nvim/lua/plugins/coding/init.lua +++ b/nvim/lua/plugins/coding/init.lua @@ -10,4 +10,5 @@ return { req('mini-surround'), req('neotab-nvim'), req('ts-comments-nvim'), + req('yanky-nvim'), } diff --git a/nvim/lua/plugins/coding/yanky-nvim.lua b/nvim/lua/plugins/coding/yanky-nvim.lua new file mode 100644 index 0000000..6cb7217 --- /dev/null +++ b/nvim/lua/plugins/coding/yanky-nvim.lua @@ -0,0 +1,104 @@ +return { + 'yanky.nvim', + event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, + keys = { + { + 'gp', + '(YankyGPutAfter)', + mode = { 'n', 'x' }, + desc = 'put text after selection', + }, + { + 'gP', + '(YankyGPutBefore', + mode = { 'n', 'x' }, + desc = 'put text before selection', + }, + { + 'p', + '(YankyPutAfter)', + mode = { 'n', 'x' }, + desc = 'put text after cursor', + }, + { + 'P', + '(YankyPutBefore)', + mode = { 'n', 'x' }, + desc = 'put text before cursor', + }, + { 'y', '(YankyYank)', mode = { 'n', 'x' }, desc = 'yank text' }, + { + 'p', + function() + vim.cmd([[YankyRingHistory]]) + end, + mode = { 'n', 'x' }, + desc = 'open yank history', + }, + { + '[p', + '(YankyPutIndentBeforeLinewise)', + desc = 'put indented before cursor (linewise)', + }, + { + '[P', + '(YankyPutIndentBeforeLinewise)', + desc = 'put indented before cursor (linewise)', + }, + { + ']p', + '(YankyPutIndentAfterLinewise)', + desc = 'put indented after cursor (linewise)', + }, + { + ']P', + '(YankyPutIndentAfterLinewise)', + desc = 'put indented after cursor (linewise)', + }, + { + '[y', + '(YankyCycleForward)', + desc = 'cycle forward through yank history', + }, + { + ']y', + '(YankyCycleBackward)', + desc = 'cycle backword through yank history', + }, + { + '(YankyPutIndentAfterShiftLeft)', + desc = 'put and indent left', + }, + { + '(YankyPutIndentBeforeShiftLeft)', + desc = 'put and indent left', + }, + { + '>p', + '(YankyPutIndentAfterShiftRight)', + desc = 'put and indent right', + }, + { + '>P', + '(YankyPutIndentBeforeShiftRight)', + desc = 'put and indent right', + }, + { + '=p', + '(YankyPutAfterFilter)', + desc = 'put after applying a filter', + }, + { + '=P', + '(YankyPutBeforeFilter)', + desc = 'put before applying a filter', + }, + }, + after = function() + require('yanky').setup({ + highlight = { timer = 150 }, + }) + end, +}