neovim-flake/lib/types/plugins.nix

180 lines
3.6 KiB
Nix
Raw Normal View History

2023-02-06 19:57:35 +01:00
{lib}:
with lib; let
# Plugin must be same as input name from flake.nix
availablePlugins = [
# TODO: sort by category
"nvim-treesitter-context"
"gitsigns-nvim"
"plenary-nvim"
"nvim-lspconfig"
"nvim-treesitter"
"lspsaga"
"lspkind"
"nvim-lightbulb"
"lsp-signature"
"nvim-tree-lua"
"nvim-bufferline-lua"
"lualine"
"nvim-autopairs"
"nvim-ts-autotag"
"nvim-web-devicons"
"tokyonight"
"bufdelete-nvim"
"nvim-cmp"
"cmp-nvim-lsp"
"cmp-buffer"
"cmp-vsnip"
"cmp-path"
"cmp-treesitter"
"crates-nvim"
"vim-vsnip"
"nvim-code-action-menu"
"trouble"
"none-ls"
2023-02-06 19:57:35 +01:00
"which-key"
"indent-blankline"
"nvim-cursorline"
"sqls-nvim"
"glow-nvim"
"telescope"
"rust-tools"
"onedark"
"catppuccin"
"dracula"
"oxocarbon"
2024-01-17 21:08:36 +01:00
"gruvbox"
"rose-pine"
2023-02-06 19:57:35 +01:00
"minimap-vim"
"dashboard-nvim"
"alpha-nvim"
"scrollbar-nvim"
"codewindow-nvim"
"nvim-notify"
"cinnamon-nvim"
"cheatsheet-nvim"
2023-06-04 08:41:10 +02:00
"ccc"
2023-02-06 19:57:35 +01:00
"cellular-automaton"
"neocord"
2023-02-06 19:57:35 +01:00
"icon-picker-nvim"
"dressing-nvim"
"orgmode-nvim"
"obsidian-nvim"
"vim-markdown"
"tabular"
"toggleterm-nvim"
"noice-nvim"
"nui-nvim"
"copilot-lua"
"tabnine-nvim"
"nvim-session-manager"
"gesture-nvim"
"comment-nvim"
"kommentary"
"mind-nvim"
"fidget-nvim"
2023-03-01 10:08:24 +01:00
"diffview-nvim"
"todo-comments"
2023-04-02 20:38:54 +02:00
"flutter-tools"
"flutter-tools-patched"
"hop-nvim"
2023-04-05 01:14:13 +02:00
"leap-nvim"
2023-04-04 22:33:36 +02:00
"modes-nvim"
2023-04-05 01:14:13 +02:00
"vim-repeat"
2023-04-05 15:59:08 +02:00
"smartcolumn"
"project-nvim"
2023-09-23 15:36:26 +02:00
"neodev-nvim"
"elixir-ls"
"elixir-tools"
"nvim-colorizer-lua"
2023-06-06 02:05:05 +02:00
"vim-illuminate"
2023-06-07 13:28:27 +02:00
"nvim-surround"
2023-05-04 17:41:11 +02:00
"nvim-dap"
"nvim-dap-ui"
2023-07-19 21:49:06 +02:00
"nvim-navic"
"nvim-navbuddy"
"copilot-cmp"
2023-07-30 18:54:43 +02:00
"lsp-lines"
"vim-dirtytalk"
"highlight-undo"
"nvim-docs-view"
2024-02-17 01:19:38 +01:00
"image-nvim"
2024-04-03 20:13:19 +02:00
"nvim-nio"
2023-02-06 19:57:35 +01:00
];
# You can either use the name of the plugin or a package.
pluginType = with types;
nullOr (
either
package
(enum availablePlugins)
2023-04-04 22:33:36 +02:00
);
pluginsType = types.listOf pluginType;
extraPluginType = with types;
submodule {
options = {
package = mkOption {
type = pluginType;
description = "Plugin Package.";
};
2024-02-17 01:19:38 +01:00
2023-07-26 15:27:08 +02:00
after = mkOption {
type = listOf str;
default = [];
2023-07-26 15:27:34 +02:00
description = "Setup this plugin after the following ones.";
};
2024-02-17 01:19:38 +01:00
setup = mkOption {
type = lines;
default = "";
2023-07-26 15:27:34 +02:00
description = "Lua code to run during setup.";
example = "require('aerial').setup {}";
};
};
};
2023-02-06 19:57:35 +01:00
in {
inherit extraPluginType;
2023-02-06 19:57:35 +01:00
pluginsOpt = {
description,
default ? [],
}:
mkOption {
inherit description default;
type = pluginsType;
};
2024-03-16 10:29:07 +01:00
luaInline = lib.mkOptionType {
name = "luaInline";
check = x: lib.nvim.lua.isLuaInline x || builtins.isString x;
2024-03-03 12:47:58 +01:00
merge = loc: defs: let
val =
if isString loc
2024-03-16 10:29:07 +01:00
then lib.generators.mkLuaInline loc
2024-03-03 12:47:58 +01:00
else loc;
in
lib.mergeOneOption val defs;
};
# opts is a attrset of options, example:
# ```
# mkPluginSetupOption "telescope" {
# file_ignore_patterns = mkOption {
# description = "...";
# type = types.listOf types.str;
# default = [];
# };
# layout_config.horizontal = mkOption {...};
# }
# ```
mkPluginSetupOption = pluginName: opts:
mkOption {
description = "Option table to pass into the setup function of " + pluginName;
default = {};
type = types.submodule {
freeformType = with types; attrsOf anything;
options = opts;
};
};
2023-02-06 19:57:35 +01:00
}