From 8a7278f701a56748d9254656bbba37dc8dd4d78e Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sun, 10 Apr 2022 01:07:36 +0200 Subject: [PATCH] nvim: Switch yoink, cutlass and subversive to Lua versions --- config/nvim/init.fnl | 5 +--- config/nvim/nifoc/keymap.fnl | 19 +++++++----- config/nvim/plugins/cutlass.fnl | 2 ++ config/nvim/plugins/substitute.fnl | 6 ++++ config/nvim/plugins/yanky.fnl | 2 ++ config/nvim/plugins/yoink.fnl | 6 ---- programs/nvim/default.nix | 18 +++++++---- programs/nvim/plugins.nix | 48 +++++++++++++++--------------- programs/nvim/plugins.yaml | 6 ++-- 9 files changed, 62 insertions(+), 50 deletions(-) create mode 100644 config/nvim/plugins/cutlass.fnl create mode 100644 config/nvim/plugins/substitute.fnl create mode 100644 config/nvim/plugins/yanky.fnl delete mode 100644 config/nvim/plugins/yoink.fnl diff --git a/config/nvim/init.fnl b/config/nvim/init.fnl index fd54797..1ea1faa 100644 --- a/config/nvim/init.fnl +++ b/config/nvim/init.fnl @@ -106,7 +106,4 @@ (aucmd :TermOpen {:callback (fn [] (vim.opt_local.number false) (vim.opt_local.relativenumber false)) - :group augroup}) - (aucmd :TextYankPost {:callback #(vim.highlight.on_yank {:higroup :IncSearch - :timeout 500}) - :group augroup}))) + :group augroup}))) diff --git a/config/nvim/nifoc/keymap.fnl b/config/nvim/nifoc/keymap.fnl index 279a535..663d290 100644 --- a/config/nvim/nifoc/keymap.fnl +++ b/config/nvim/nifoc/keymap.fnl @@ -1,6 +1,7 @@ (let [mod {} keymap vim.keymap legendary (require :legendary) + substitute (require :substitute) telescope (require :telescope) telescope-builtin (require :telescope.builtin) telescope-themes (require :telescope.themes) @@ -95,14 +96,16 @@ (keymap.set :i : :w {:noremap true}) (keymap.set :i : :^ {:noremap true}) (keymap.set :i : :$ {:noremap true}) - (keymap.set :n :p "(YoinkPaste_p)") - (keymap.set :n :P "(YoinkPaste_P)") - (keymap.set :x :p "(SubversiveSubstitute)") - (keymap.set :x :P "(SubversiveSubstitute)") - (keymap.set :n :gp "(YoinkPaste_gp)") - (keymap.set :n :gP "(YoinkPaste_gP)") - (keymap.set :n :y "(YoinkYankPreserveCursorPosition)") - (keymap.set :x :y "(YoinkYankPreserveCursorPosition)") + (keymap.set :n :p "(YankyPutAfter)") + (keymap.set :n :P "(YankyPutBefore)") + (keymap.set :x :p substitute.visual) + (keymap.set :x :P "(YankyPutBefore)") + (keymap.set :n :gp "(YankyGPutAfter)") + (keymap.set :n :gP "(YankyGPutBefore)") + (keymap.set :x :gp "(YankyGPutAfter)") + (keymap.set :x :gP "(YankyGPutBefore)") + (keymap.set :n :y "(YankyYank)") + (keymap.set :x :y "(YankyYank)") (keymap.set :n : fterm.toggle {:noremap true :silent true}) (keymap.set :t : "lua require(\"FTerm\").toggle()" {:noremap true :silent true})) diff --git a/config/nvim/plugins/cutlass.fnl b/config/nvim/plugins/cutlass.fnl new file mode 100644 index 0000000..7672fc7 --- /dev/null +++ b/config/nvim/plugins/cutlass.fnl @@ -0,0 +1,2 @@ +(let [cutlass (require :cutlass)] + (cutlass.setup {:cut_key :x :exclude [:ns :nS]})) diff --git a/config/nvim/plugins/substitute.fnl b/config/nvim/plugins/substitute.fnl new file mode 100644 index 0000000..fd65103 --- /dev/null +++ b/config/nvim/plugins/substitute.fnl @@ -0,0 +1,6 @@ +(let [substitute (require :substitute) + yanky (require :yanky)] + (substitute.setup {:on_substitute (fn [event] + (yanky.init_ring :p event.register + event.count + (event.vmode:match "[vV]")))})) diff --git a/config/nvim/plugins/yanky.fnl b/config/nvim/plugins/yanky.fnl new file mode 100644 index 0000000..9f0b2cc --- /dev/null +++ b/config/nvim/plugins/yanky.fnl @@ -0,0 +1,2 @@ +(let [yanky (require :yanky)] + (yanky.setup {:ring {:storage :memory}})) diff --git a/config/nvim/plugins/yoink.fnl b/config/nvim/plugins/yoink.fnl deleted file mode 100644 index a67dd8c..0000000 --- a/config/nvim/plugins/yoink.fnl +++ /dev/null @@ -1,6 +0,0 @@ -(let [g vim.g - cmd vim.cmd] - (set g.yoinkIncludeDeleteOperations 1) - (cmd "packadd! vim-cutlass") - (cmd "packadd! vim-yoink") - (cmd "packadd! vim-subversive")) diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index 98be434..e8fc662 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -71,14 +71,22 @@ in } { - plugin = vim-yoink; - optional = true; - config = builtins.readFile ../../config/nvim/plugins/yoink.fnl; + plugin = yanky-nvim; + config = builtins.readFile ../../config/nvim/plugins/yanky.fnl; type = "fennel"; } - { plugin = vim-cutlass; optional = true; } - { plugin = vim-subversive; optional = true; } + { + plugin = cutlass-nvim; + config = builtins.readFile ../../config/nvim/plugins/cutlass.fnl; + type = "fennel"; + } + + { + plugin = substitute-nvim; + config = builtins.readFile ../../config/nvim/plugins/substitute.fnl; + type = "fennel"; + } { plugin = leap-nvim; diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 07068ef..3086756 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -49,41 +49,41 @@ }; meta.homepage = "https://github.com/mrjones2014/legendary.nvim"; }; - vim-yoink = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "vim-yoink"; - version = "1631699595"; + yanky-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "yanky.nvim"; + version = "1649274039"; src = pkgs.fetchFromGitHub { - owner = "svermeulen"; - repo = "vim-yoink"; - rev = "89ed6934679fdbc3c20f552b50b1f869f624cd22"; - sha256 = "ekGKOYzmdaMqAun/3fRGlhA7bLKuhzsXsEcFNukgFWU="; + owner = "gbprod"; + repo = "yanky.nvim"; + rev = "1c96ef6d44f6d2a8a034f4eb242ddaa015674d1c"; + sha256 = "D4UuAdiQVW/kgIMdNkfso8UvSJGkN1tIkAbEilxreXM="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/svermeulen/vim-yoink"; + meta.homepage = "https://github.com/gbprod/yanky.nvim"; }; - vim-cutlass = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "vim-cutlass"; - version = "1583100466"; + cutlass-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "cutlass.nvim"; + version = "1647531286"; src = pkgs.fetchFromGitHub { - owner = "svermeulen"; - repo = "vim-cutlass"; - rev = "7afd649415541634c8ce317fafbc31cd19d57589"; - sha256 = "j5W9q905ApDf3fvCIS4UwyHYnEZu5Ictn+6JkV/xjig="; + owner = "gbprod"; + repo = "cutlass.nvim"; + rev = "b46773268e66ecd371d0b32f17f7a85242475649"; + sha256 = "M9Q4wWHv4exOWvp05bierAkzUNlArNGmKendciiiJnA="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/svermeulen/vim-cutlass"; + meta.homepage = "https://github.com/gbprod/cutlass.nvim"; }; - vim-subversive = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "vim-subversive"; - version = "1643202309"; + substitute-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "substitute.nvim"; + version = "1649272848"; src = pkgs.fetchFromGitHub { - owner = "svermeulen"; - repo = "vim-subversive"; - rev = "6286cda3f9222bfd490fe34a00a2d8cd4925adec"; - sha256 = "V+WHNtR1L2SXtlPaojqcgW4giRY1QrMzvmB+3FvuTtM="; + owner = "gbprod"; + repo = "substitute.nvim"; + rev = "66379e99812ce5f46aa4810c05460c87b7b40aac"; + sha256 = "B0CSMKwRMISfeLJHZuPsiu51BENyZC8I/HhisH+W3Nk="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/svermeulen/vim-subversive"; + meta.homepage = "https://github.com/gbprod/substitute.nvim"; }; leap-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "leap.nvim"; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml index 9c3cbb9..e1eb2c0 100644 --- a/programs/nvim/plugins.yaml +++ b/programs/nvim/plugins.yaml @@ -7,9 +7,9 @@ # Keybindings - src: mrjones2014/legendary.nvim -- src: svermeulen/vim-yoink -- src: svermeulen/vim-cutlass -- src: svermeulen/vim-subversive +- src: gbprod/yanky.nvim +- src: gbprod/cutlass.nvim +- src: gbprod/substitute.nvim - src: ggandor/leap.nvim # Themes