feat: add cellular automaton to visuals

This commit is contained in:
NotAShelf 2023-02-05 16:14:25 +03:00
parent 1426deb3e6
commit 5d6f7dc3f3
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
3 changed files with 64 additions and 0 deletions

View file

@ -48,6 +48,22 @@
"type": "github" "type": "github"
} }
}, },
"cellular-automaton": {
"flake": false,
"locked": {
"lastModified": 1674679594,
"narHash": "sha256-h4KQCf8+GbxWSyZzDny07YFZm7j+aSSfm51lsaK0Ers=",
"owner": "Eandrju",
"repo": "cellular-automaton.nvim",
"rev": "679943b8e1e5ef79aaeeaf4b00782c52eb4e928f",
"type": "github"
},
"original": {
"owner": "Eandrju",
"repo": "cellular-automaton.nvim",
"type": "github"
}
},
"cheatsheet-nvim": { "cheatsheet-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -823,6 +839,7 @@
"alpha-nvim": "alpha-nvim", "alpha-nvim": "alpha-nvim",
"bufdelete-nvim": "bufdelete-nvim", "bufdelete-nvim": "bufdelete-nvim",
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"cellular-automaton": "cellular-automaton",
"cheatsheet-nvim": "cheatsheet-nvim", "cheatsheet-nvim": "cheatsheet-nvim",
"cinnamon-nvim": "cinnamon-nvim", "cinnamon-nvim": "cinnamon-nvim",
"cmp-buffer": "cmp-buffer", "cmp-buffer": "cmp-buffer",

View file

@ -66,6 +66,7 @@
nvimWebDevicons.enable = true; nvimWebDevicons.enable = true;
scrollBar.enable = true; scrollBar.enable = true;
smoothScroll.enable = true; smoothScroll.enable = true;
cellularAutomaton.enable = true;
lspkind.enable = true; lspkind.enable = true;
indentBlankline = { indentBlankline = {
enable = true; enable = true;
@ -429,6 +430,11 @@
flake = false; flake = false;
}; };
cellular-automaton = {
url = "github:Eandrju/cellular-automaton.nvim";
flake = false;
};
indent-blankline = { indent-blankline = {
url = "github:lukas-reineke/indent-blankline.nvim"; url = "github:lukas-reineke/indent-blankline.nvim";
flake = false; flake = false;

View file

@ -34,6 +34,12 @@ in {
description = "enable smooth scrolling [cinnamon-nvim]"; description = "enable smooth scrolling [cinnamon-nvim]";
}; };
cellularAutomaton.enable = mkOption {
type = types.bool;
description = "enable cellular automaton [cellular-automaton]";
default = false;
};
cursorWordline = { cursorWordline = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -108,6 +114,11 @@ in {
then "cinnamon-nvim" then "cinnamon-nvim"
else null else null
) )
(
if cfg.cellularAutomaton.enable
then "cellular-automaton"
else null
)
]; ];
vim.luaConfigRC.visuals = nvim.dag.entryAnywhere '' vim.luaConfigRC.visuals = nvim.dag.entryAnywhere ''
@ -169,6 +180,36 @@ in {
then "require('cinnamon').setup()" then "require('cinnamon').setup()"
else "" 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 ""
}
''; '';
}; };
} }