neovim-flake/modules/plugins/visuals/config.nix
diniamo f9789432f9
treewide: make the entire generated config lua based (#333)
* modules: switch to gerg's neovim-wrapper

* modules: use initViml instead of writing the file

* treewide: make the entire generated config lua based

* docs: remove mentions of configRC

* plugins/treesitter: remove vim.cmd hack

* treewide: move resolveDag to lib

* modules/wrapper(rc): fix typo

* treewide: migrate to pluginRC for correct DAG order

The "new" DAG order is as follows:
- (luaConfigPre)
- globalsScript
- basic
- theme
- pluginConfigs
- extraPluginConfigs
- mappings
- (luaConfigPost)

* plugins/theme: fix theme DAG place

* plugins/theme: fix fixed theme DAG place

* modules/wrapper(rc): add removed option module for configRC

* docs: add dag-entries chapter, add release note entry

* fix: formatting CI

* languages/nix: add missing `local`

* docs: fix page link

* docs: add mention of breaking changes at the start of the release notes

* plugins/neo-tree: convert to pluginRC

* modules/wrapper(rc): add back entryAnywhere

* modules/wrapper(rc): expose pluginRC

* apply raf patch

---------

Co-authored-by: NotAShelf <raf@notashelf.dev>
2024-07-20 08:30:48 +00:00

120 lines
3.3 KiB
Nix

{
config,
lib,
...
}: let
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.indentBlankline.enable {
vim.startPlugins = ["indent-blankline"];
vim.pluginRC.indent-blankline = entryAnywhere ''
require("ibl").setup(${toLuaObject cfg.indentBlankline.setupOpts})
'';
})
(mkIf cfg.cursorline.enable {
vim.startPlugins = ["nvim-cursorline"];
vim.pluginRC.cursorline = entryAnywhere ''
require('nvim-cursorline').setup {
cursorline = {
timeout = ${toString cfg.cursorline.lineTimeout},
number = ${boolToString (!cfg.cursorline.lineNumbersOnly)},
}
}
'';
})
(mkIf cfg.nvimWebDevicons.enable {
vim.startPlugins = ["nvim-web-devicons"];
})
(mkIf cfg.scrollBar.enable {
vim.startPlugins = ["scrollbar-nvim"];
vim.pluginRC.scrollBar = entryAnywhere ''
require('scrollbar').setup{
excluded_filetypes = {
'prompt',
'TelescopePrompt',
'noice',
'NvimTree',
'alpha',
'code-action-menu-menu',
'code-action-menu-warning-message',
'notify',
'Navbuddy'
},
}
'';
})
(mkIf cfg.smoothScroll.enable {
vim.startPlugins = ["cinnamon-nvim"];
vim.pluginRC.smoothScroll = entryAnywhere ''
require('cinnamon').setup()
'';
})
(mkIf cfg.cellularAutomaton.enable {
vim.startPlugins = ["cellular-automaton"];
vim.maps.normal = mkBinding cfg.cellularAutomaton.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";
vim.pluginRC.cellularAUtomaton = entryAnywhere ''
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)
'';
})
(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 = {}
},
})
'';
})
]);
}