mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
feat: add cellular automaton to visuals
This commit is contained in:
parent
1426deb3e6
commit
5d6f7dc3f3
3 changed files with 64 additions and 0 deletions
|
@ -34,6 +34,12 @@ in {
|
|||
description = "enable smooth scrolling [cinnamon-nvim]";
|
||||
};
|
||||
|
||||
cellularAutomaton.enable = mkOption {
|
||||
type = types.bool;
|
||||
description = "enable cellular automaton [cellular-automaton]";
|
||||
default = false;
|
||||
};
|
||||
|
||||
cursorWordline = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -108,6 +114,11 @@ in {
|
|||
then "cinnamon-nvim"
|
||||
else null
|
||||
)
|
||||
(
|
||||
if cfg.cellularAutomaton.enable
|
||||
then "cellular-automaton"
|
||||
else null
|
||||
)
|
||||
];
|
||||
|
||||
vim.luaConfigRC.visuals = nvim.dag.entryAnywhere ''
|
||||
|
@ -169,6 +180,36 @@ in {
|
|||
then "require('cinnamon').setup()"
|
||||
else ""
|
||||
}
|
||||
${
|
||||
if cfg.cellularAutomaton.enable
|
||||
then ''
|
||||
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
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
require("cellular-automaton").register_animation(config)
|
||||
|
||||
vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
|
||||
''
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue