mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
6
modules/plugins/utility/motion/default.nix
Normal file
6
modules/plugins/utility/motion/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./hop
|
||||
./leap
|
||||
];
|
||||
}
|
26
modules/plugins/utility/motion/hop/config.nix
Normal file
26
modules/plugins/utility/motion/hop/config.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.motion.hop;
|
||||
|
||||
self = import ./hop.nix {inherit lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.utility.motion.hop.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["hop-nvim"];
|
||||
|
||||
vim.maps.normal = mkSetBinding mappings.hop "<cmd> HopPattern<CR>";
|
||||
|
||||
vim.luaConfigRC.hop-nvim = entryAnywhere ''
|
||||
require('hop').setup()
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/motion/hop/default.nix
Normal file
6
modules/plugins/utility/motion/hop/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./hop.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
12
modules/plugins/utility/motion/hop/hop.nix
Normal file
12
modules/plugins/utility/motion/hop/hop.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.utility.motion.hop = {
|
||||
mappings = {
|
||||
hop = mkMappingOption "Jump to occurences [hop.nvim]" "<leader>h";
|
||||
};
|
||||
|
||||
enable = mkEnableOption "Hop.nvim plugin (easy motion)";
|
||||
};
|
||||
}
|
73
modules/plugins/utility/motion/leap/config.nix
Normal file
73
modules/plugins/utility/motion/leap/config.nix
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.utility.motion.leap;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"leap-nvim"
|
||||
"vim-repeat"
|
||||
];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.maps.operator = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.maps.visualOnly = mkMerge [
|
||||
(mkBinding cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
(mkBinding cfg.mappings.leapBackwardTo "<Plug>(leap-backward-to)" "Leap backward to")
|
||||
(mkBinding cfg.mappings.leapForwardTill "<Plug>(leap-forward-till)" "Leap forward till")
|
||||
(mkBinding cfg.mappings.leapBackwardTill "<Plug>(leap-backward-till)" "Leap backward till")
|
||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.leap-nvim = entryAnywhere ''
|
||||
require('leap').opts = {
|
||||
max_phase_one_targets = nil,
|
||||
highlight_unlabeled_phase_one_targets = false,
|
||||
max_highlighted_traversal_targets = 10,
|
||||
case_sensitive = false,
|
||||
equivalence_classes = { ' \t\r\n', },
|
||||
substitute_chars = {},
|
||||
safe_labels = {
|
||||
"s", "f", "n", "u", "t", "/",
|
||||
"S", "F", "N", "L", "H", "M", "U", "G", "T", "?", "Z"
|
||||
},
|
||||
labels = {
|
||||
"s", "f", "n",
|
||||
"j", "k", "l", "h", "o", "d", "w", "e", "m", "b",
|
||||
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
|
||||
"S", "F", "N",
|
||||
"J", "K", "L", "H", "O", "D", "W", "E", "M", "B",
|
||||
"U", "Y", "V", "R", "G", "T", "C", "X", "?", "Z"
|
||||
},
|
||||
special_keys = {
|
||||
repeat_search = '<enter>',
|
||||
next_phase_one_target = '<enter>',
|
||||
next_target = {'<enter>', ';'},
|
||||
prev_target = {'<tab>', ','},
|
||||
next_group = '<space>',
|
||||
prev_group = '<tab>',
|
||||
multi_accept = '<enter>',
|
||||
multi_revert = '<backspace>',
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/plugins/utility/motion/leap/default.nix
Normal file
6
modules/plugins/utility/motion/leap/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./leap.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
36
modules/plugins/utility/motion/leap/leap.nix
Normal file
36
modules/plugins/utility/motion/leap/leap.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) nullOr str;
|
||||
in {
|
||||
options.vim.utility.motion.leap = {
|
||||
enable = mkEnableOption "leap.nvim plugin (easy motion)";
|
||||
|
||||
mappings = {
|
||||
leapForwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward to";
|
||||
default = "s";
|
||||
};
|
||||
leapBackwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward to";
|
||||
default = "S";
|
||||
};
|
||||
leapForwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward till";
|
||||
default = "x";
|
||||
};
|
||||
leapBackwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward till";
|
||||
default = "X";
|
||||
};
|
||||
leapFromWindow = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap from window";
|
||||
default = "gs";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue