refactor(nvim): discover plugins automatically
parent
fc4caeb1ec
commit
b87d7b387a
|
@ -1,7 +1,6 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
|
||||
|
@ -9,12 +8,18 @@ with lib;
|
|||
let
|
||||
cfg = config.my.programs.nvim;
|
||||
|
||||
mkPlugin = name: {
|
||||
plugin = pkgs.vimPlugins.${name};
|
||||
type = "lua";
|
||||
config = lib.readFile (./plugins + "/${name}.lua");
|
||||
};
|
||||
|
||||
mkPlugin = fileName:
|
||||
let
|
||||
path = ./plugins + "/${fileName}";
|
||||
pluginName = lib.removeSuffix ".lua" fileName;
|
||||
in
|
||||
{
|
||||
plugin = pkgs.vimPlugins.${pluginName};
|
||||
type = "lua";
|
||||
config = lib.readFile path;
|
||||
};
|
||||
pluginFileNames = builtins.attrNames (builtins.readDir ./plugins);
|
||||
pluginsWithConfig = builtins.map mkPlugin pluginFileNames;
|
||||
in
|
||||
{
|
||||
options.my.programs.nvim.enable = mkEnableOption "nvim";
|
||||
|
@ -51,29 +56,7 @@ in
|
|||
taplo
|
||||
yamlfmt
|
||||
];
|
||||
plugins = builtins.map mkPlugin [
|
||||
"catppuccin-nvim"
|
||||
"comment-nvim"
|
||||
"copilot-lua"
|
||||
"dashboard-nvim"
|
||||
"formatter-nvim"
|
||||
"gitsigns-nvim"
|
||||
"lualine-nvim"
|
||||
"noice-nvim"
|
||||
"nvim-autopairs"
|
||||
"nvim-lastplace"
|
||||
"nvim-surround"
|
||||
"nvim-tree-lua"
|
||||
"nvim-treesitter-textsubjects"
|
||||
"nvim-ts-context-commentstring"
|
||||
"orgmode"
|
||||
"smartcolumn-nvim"
|
||||
"telescope-fzf-native-nvim"
|
||||
"telescope-nvim"
|
||||
"telescope-zoxide"
|
||||
"which-key-nvim"
|
||||
"todo-comments-nvim"
|
||||
] ++ (with pkgs.vimPlugins; [
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
cmp-nvim-lsp
|
||||
cmp_luasnip
|
||||
copilot-cmp
|
||||
|
@ -84,17 +67,17 @@ in
|
|||
lspsaga-nvim-original
|
||||
lualine-lsp-progress
|
||||
luasnip
|
||||
nui-nvim # for noice-nvim
|
||||
nui-nvim
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-ufo
|
||||
nvim-web-devicons # for dashboard-nvim
|
||||
plenary-nvim # for telescope, neogit
|
||||
nvim-web-devicons
|
||||
plenary-nvim
|
||||
popup-nvim
|
||||
promise-async
|
||||
vim-lion
|
||||
]);
|
||||
] ++ pluginsWithConfig;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue