2023-02-01 22:01:35 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: 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;
|
2024-07-12 17:47:33 +02:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2023-11-07 01:50:27 +01:00
|
|
|
|
2023-02-28 08:13:56 +01:00
|
|
|
cfg = config.vim.visuals;
|
|
|
|
in {
|
2023-04-18 00:36:14 +02:00
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
(mkIf cfg.smoothScroll.enable {
|
|
|
|
vim.startPlugins = ["cinnamon-nvim"];
|
2024-07-20 10:30:48 +02:00
|
|
|
vim.pluginRC.smoothScroll = entryAnywhere ''
|
2023-04-18 00:36:14 +02:00
|
|
|
require('cinnamon').setup()
|
|
|
|
'';
|
|
|
|
})
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2023-04-18 00:36:14 +02:00
|
|
|
(mkIf cfg.cellularAutomaton.enable {
|
|
|
|
vim.startPlugins = ["cellular-automaton"];
|
2023-04-15 15:35:34 +02:00
|
|
|
|
|
|
|
vim.maps.normal = mkBinding cfg.cellularAutomaton.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";
|
|
|
|
|
2024-07-20 10:30:48 +02:00
|
|
|
vim.pluginRC.cellularAUtomaton = entryAnywhere ''
|
2023-04-18 00:36:14 +02:00
|
|
|
local config = {
|
|
|
|
fps = 50,
|
|
|
|
name = 'slide',
|
|
|
|
}
|
|
|
|
|
|
|
|
-- init function is invoked only once at the start
|
|
|
|
-- config.init = function (grid)
|
|
|
|
--
|
|
|
|
-- end
|
|
|
|
|
|
|
|
-- update function
|
|
|
|
config.update = function (grid)
|
|
|
|
for i = 1, #grid do
|
|
|
|
local prev = grid[i][#(grid[i])]
|
|
|
|
for j = 1, #(grid[i]) do
|
|
|
|
grid[i][j], prev = prev, grid[i][j]
|
|
|
|
end
|
2023-02-28 08:13:56 +01:00
|
|
|
end
|
2023-04-18 00:36:14 +02:00
|
|
|
return true
|
2023-02-28 08:13:56 +01:00
|
|
|
end
|
|
|
|
|
2023-04-18 00:36:14 +02:00
|
|
|
require("cellular-automaton").register_animation(config)
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
|
2023-10-22 00:22:31 +02:00
|
|
|
(mkIf cfg.highlight-undo.enable {
|
|
|
|
vim.startPlugins = ["highlight-undo"];
|
2024-07-20 10:30:48 +02:00
|
|
|
vim.pluginRC.highlight-undo = entryAnywhere ''
|
2023-10-22 00:22:31 +02:00
|
|
|
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 = {}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
'';
|
|
|
|
})
|
2023-04-18 00:36:14 +02:00
|
|
|
]);
|
2023-02-01 20:11:37 +01:00
|
|
|
}
|