mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 14:55:59 +01:00
modules/visuals: add highlight-undo
a plugin for highlighting undo/redo targets
This commit is contained in:
parent
d7cf84c514
commit
c353329620
5 changed files with 70 additions and 1 deletions
|
@ -79,14 +79,17 @@ inputs: let
|
|||
nvimWebDevicons.enable = true;
|
||||
scrollBar.enable = true;
|
||||
smoothScroll.enable = true;
|
||||
cellularAutomaton.enable = isMaximal;
|
||||
cellularAutomaton.enable = false;
|
||||
fidget-nvim.enable = true;
|
||||
highlight-undo.enable = true;
|
||||
|
||||
indentBlankline = {
|
||||
enable = true;
|
||||
fillChar = null;
|
||||
eolChar = null;
|
||||
showCurrContext = true;
|
||||
};
|
||||
|
||||
cursorline = {
|
||||
enable = true;
|
||||
lineTimeout = 0;
|
||||
|
|
|
@ -368,6 +368,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
highlight-undo = {
|
||||
url = "github:tzachar/highlight-undo.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Markdown
|
||||
glow-nvim = {
|
||||
url = "github:ellisonleao/glow.nvim";
|
||||
|
|
|
@ -94,6 +94,7 @@ with lib; let
|
|||
"copilot-cmp"
|
||||
"lsp-lines"
|
||||
"vim-dirtytalk"
|
||||
"highlight-undo"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginType = with types;
|
||||
|
|
|
@ -118,5 +118,30 @@ in {
|
|||
}
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.highlight-undo.enable {
|
||||
vim.startPlugins = ["highlight-undo"];
|
||||
vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere ''
|
||||
require('highlight-undo').setup({
|
||||
duration = ${toString cfg.highlight-undo.duration},
|
||||
highlight_for_count = ${boolToString cfg.highlight-undo.highlightForCount},
|
||||
undo = {
|
||||
hlgroup = ${cfg.highlight-undo.undo.hlGroup},
|
||||
mode = 'n',
|
||||
lhs = 'u',
|
||||
map = 'undo',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
redo = {
|
||||
hlgroup = ${cfg.highlight-undo.redo.hlGroup},
|
||||
mode = 'n',
|
||||
lhs = '<C-r>',
|
||||
map = 'redo',
|
||||
opts = {}
|
||||
},
|
||||
})
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -103,5 +103,40 @@ in {
|
|||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
};
|
||||
|
||||
highlight-undo = {
|
||||
enable = mkEnableOption "highlight undo [highlight-undo]";
|
||||
|
||||
highlightForCount = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable support for highlighting when a `<count>` is provided before the key
|
||||
If set to false it will only highlight when the mapping is not prefixed with a `<count>`
|
||||
'';
|
||||
};
|
||||
|
||||
duration = mkOption {
|
||||
type = types.int;
|
||||
description = "Duration of highlight";
|
||||
default = 200;
|
||||
};
|
||||
|
||||
undo = {
|
||||
hlGroup = mkOption {
|
||||
type = types.str;
|
||||
description = "Highlight group for undo";
|
||||
default = "HighlightUndo";
|
||||
};
|
||||
};
|
||||
|
||||
redo = {
|
||||
hlGroup = mkOption {
|
||||
type = types.str;
|
||||
description = "Highlight group for redo";
|
||||
default = "HighlightUndo";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue