diff --git a/extra.nix b/extra.nix index c414da9..48dba0e 100644 --- a/extra.nix +++ b/extra.nix @@ -141,7 +141,10 @@ inputs: let icon-picker.enable = true; venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually diffview-nvim.enable = true; - hop.enable = true; + motion = { + hop.enable = true; + leap.enable = true; + }; }; vim.notes = { diff --git a/flake.lock b/flake.lock index 510bd8b..f3dca8f 100644 --- a/flake.lock +++ b/flake.lock @@ -560,6 +560,22 @@ "type": "github" } }, + "leap-nvim": { + "flake": false, + "locked": { + "lastModified": 1678823512, + "narHash": "sha256-bzmsib8Qr2Whu1FqHzvrsIfSKf/CFutsaM3Sz8gaTLo=", + "owner": "ggandor", + "repo": "leap.nvim", + "rev": "f74473d23ebf60957e0db3ff8172349a82e5a442", + "type": "github" + }, + "original": { + "owner": "ggandor", + "repo": "leap.nvim", + "type": "github" + } + }, "lsp-signature": { "flake": false, "locked": { @@ -1298,6 +1314,7 @@ "icon-picker-nvim": "icon-picker-nvim", "indent-blankline": "indent-blankline", "kommentary": "kommentary", + "leap-nvim": "leap-nvim", "lsp-signature": "lsp-signature", "lspkind": "lspkind", "lspsaga": "lspsaga", @@ -1346,6 +1363,7 @@ "trouble": "trouble", "venn-nvim": "venn-nvim", "vim-markdown": "vim-markdown", + "vim-repeat": "vim-repeat", "vim-startify": "vim-startify", "vim-vsnip": "vim-vsnip", "which-key": "which-key", @@ -1641,6 +1659,22 @@ "type": "github" } }, + "vim-repeat": { + "flake": false, + "locked": { + "lastModified": 1611544268, + "narHash": "sha256-8rfZa3uKXB3TRCqaDHZ6DfzNbm7WaYnLvmTNzYtnKHg=", + "owner": "tpope", + "repo": "vim-repeat", + "rev": "24afe922e6a05891756ecf331f39a1f6743d3d5a", + "type": "github" + }, + "original": { + "owner": "tpope", + "repo": "vim-repeat", + "type": "github" + } + }, "vim-startify": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 7350421..5593f72 100644 --- a/flake.nix +++ b/flake.nix @@ -401,6 +401,11 @@ flake = false; }; + leap-nvim = { + url = "github:ggandor/leap.nvim"; + flake = false; + }; + # Note-taking obsidian-nvim = { url = "github:epwalsh/obsidian.nvim"; @@ -476,5 +481,10 @@ url = "github:MunifTanjim/nui.nvim"; flake = false; }; + + vim-repeat = { + url = "github:tpope/vim-repeat"; + flake = false; + }; }; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index e387fdf..84c93bc 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -74,7 +74,9 @@ with lib; let "todo-comments" "flutter-tools" "hop-nvim" + "leap-nvim" "modes-nvim" + "vim-repeat" ]; # You can either use the name of the plugin or a package. pluginsType = with types; diff --git a/modules/utility/default.nix b/modules/utility/default.nix index b5a95b2..87fce55 100644 --- a/modules/utility/default.nix +++ b/modules/utility/default.nix @@ -2,12 +2,12 @@ _: { imports = [ ./binds ./gestures + ./motion ./telescope ./colorizer ./icon-picker ./telescope ./venn ./diffview - ./hop ]; } diff --git a/modules/utility/motion/default.nix b/modules/utility/motion/default.nix new file mode 100644 index 0000000..925a33e --- /dev/null +++ b/modules/utility/motion/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./hop + ./leap + ]; +} diff --git a/modules/utility/motion/leap/config.nix b/modules/utility/motion/leap/config.nix new file mode 100644 index 0000000..f4c8b38 --- /dev/null +++ b/modules/utility/motion/leap/config.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.vim.utility.motion.leap; +in { + config = mkIf cfg.enable { + vim.startPlugins = [ + "leap-nvim" + "vim-repeat" + ]; + + vim.nnoremap = { + "h" = " HopPattern"; + }; + + vim.luaConfigRC.leap-nvim = nvim.dag.entryAnywhere '' + require('leap').add_default_mappings() + -- TODO: register custom keybinds + -- require('leap').leap { + -- opts = { + -- labels = {} + -- } + -- } + ''; + }; +} diff --git a/modules/utility/motion/leap/default.nix b/modules/utility/motion/leap/default.nix new file mode 100644 index 0000000..64dbc88 --- /dev/null +++ b/modules/utility/motion/leap/default.nix @@ -0,0 +1,8 @@ +_: { + imports = [ + ./leap.nix + ./config.nix + ]; + + +} diff --git a/modules/utility/motion/leap/leap.nix b/modules/utility/motion/leap/leap.nix new file mode 100644 index 0000000..6a48995 --- /dev/null +++ b/modules/utility/motion/leap/leap.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.vim.utility.motion.leap; +in { + options.vim.utility.motion.leap = { + enable = mkEnableOption "Enable leap.nvim plugin (easy motion)"; + }; +}