neovim-flake/modules/plugins/visuals/config.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

2023-02-01 22:01:35 +01:00
{
config,
lib,
...
}: let
2024-03-24 01:14:39 +01:00
inherit (lib.modules) mkIf mkMerge;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.binds) mkBinding;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.visuals;
in {
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.smoothScroll.enable {
vim.startPlugins = ["cinnamon-nvim"];
vim.pluginRC.smoothScroll = entryAnywhere ''
require('cinnamon').setup()
'';
})
(mkIf cfg.highlight-undo.enable {
vim.startPlugins = ["highlight-undo"];
vim.pluginRC.highlight-undo = 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 = {}
},
})
'';
})
]);
}