Merge branch 'main' into remove-trailing-whitespaces

This commit is contained in:
Pedro Alves 2023-01-21 17:11:56 +00:00 committed by GitHub
commit e686e31bd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 695 additions and 234 deletions

6
flake.lock generated
View file

@ -39,11 +39,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1663491030, "lastModified": 1673606088,
"narHash": "sha256-MVsfBhE9US5DvLtBAaTRjwYdv1tLO8xjahM8qLXTgTo=", "narHash": "sha256-wdYD41UwNwPhTdMaG0AIe7fE1bAdyHe6bB4HLUqUvck=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "767542707d394ff15ac1981e903e005ba69528b5", "rev": "37b97ae3dd714de9a17923d004a2c5b5543dfa6d",
"type": "github" "type": "github"
}, },
"original": { "original": {

113
modules/autocmd.nix Normal file
View file

@ -0,0 +1,113 @@
{ config, lib, ... }:
with lib;
let
helpers = import ../plugins/helpers.nix { inherit lib; };
autoCmdOption = types.submodule {
options = {
event = mkOption {
type = types.oneOf [
types.str
(types.listOf types.str)
];
description = "The event or events to register this autocommand.";
};
group = mkOption {
type = types.nullOr (types.oneOf [
types.str
types.int
]);
description = "The autocommand group name or id to match against.";
default = null;
};
pattern = mkOption {
type = types.nullOr (types.oneOf [
types.str
(types.listOf types.str)
]);
description = "Pattern or patterns to match literally against.";
default = null;
};
buffer = mkOption {
type = types.nullOr types.int;
description = "Buffer number for buffer local autocommands |autocmd-buflocal|. Cannot be used with <pattern>.";
default = null;
};
description = mkOption {
type = types.nullOr types.str;
description = "A textual description of this autocommand.";
default = null;
};
callback = mkOption {
type = types.nullOr types.str;
description = "The name of a Vimscript function to call when this autocommand is triggered. Cannot be used with <command>.";
default = null;
};
command = mkOption {
type = types.nullOr types.str;
description = "Vim command to execute on event. Cannot be used with <callback>";
default = null;
};
once = mkOption {
type = types.nullOr types.bool;
description = "Run the autocommand only once";
default = null;
};
nested = mkOption {
type = types.nullOr types.bool;
description = "Run nested autocommands.";
default = null;
};
};
};
in
{
options.autoCmd = mkOption {
type = types.listOf autoCmdOption;
default = [ ];
description = "autocmd definitions";
example = ''
autoCmd = [
{
event = [ "BufEnter" "BufWinEnter" ];
pattern = [ "*.c" "*.h" ];
command = "echo 'Entering a C or C++ file'";
}
];
'';
};
config = {
extraConfigLua = optionalString (config.autoCmd != [ ]) ''
-- Set up autocommands {{{
do
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
for _, autocmd in ipairs(__nixvim_autocommands) do
vim.api.nvim_create_autocmd(
autocmd.event,
{
group = autocmd.group,
pattern = autocmd.pattern,
buffer = autocmd.buffer,
desc = autocmd.desc,
callback = autocmd.callback,
command = autocmd.command,
once = autocmd.once,
nested = autocmd.nested
}
)
end
end
-- }}}
'';
};
}

View file

@ -15,10 +15,21 @@ with lib;
}; };
''; '';
}; };
match = mkOption {
type = types.attrsOf types.str;
default = { };
description = "Define match groups";
example = ''
match = {
ExtraWhitespace = '\\s\\+$';
};
'';
};
}; };
config = mkIf (config.highlight != { }) { config = mkIf (config.highlight != { } || config.matches != { }) {
extraConfigLuaPost = '' extraConfigLuaPost = (optionalString (config.highlight != { }) ''
-- Highlight groups {{ -- Highlight groups {{
do do
local highlights = ${helpers.toLuaObject config.highlight} local highlights = ${helpers.toLuaObject config.highlight}
@ -28,6 +39,18 @@ with lib;
end end
end end
-- }} -- }}
''; '') ++
(optionalString (config.matches != { }) ''
-- Match groups {{
do
local match = ${helpers.toLuaObject config.match}
for k,v in pairs(match) do
vim.fn.matchadd(k, v)
end
end
-- }}
'');
}; };
} }

View file

@ -7,6 +7,12 @@ in
options.plugins.barbar = { options.plugins.barbar = {
enable = mkEnableOption "Enable barbar.nvim"; enable = mkEnableOption "Enable barbar.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.barbar-nvim;
description = "Plugin to use for barbar";
};
animations = mkOption { animations = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
@ -50,7 +56,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
barbar-nvim nvim-web-devicons cfg.package nvim-web-devicons
]; ];
# maps = genMaps cfg.keys; # maps = genMaps cfg.keys;

View file

@ -26,6 +26,11 @@ in
options = { options = {
plugins.bufferline = { plugins.bufferline = {
enable = mkEnableOption "Enable bufferline"; enable = mkEnableOption "Enable bufferline";
package = mkOption {
type = types.package;
description = "Plugin to use for bufferline";
default = pkgs.vimPlugins.bufferline-nvim;
};
numbers = mkOption { numbers = mkOption {
type = types.nullOr types.lines; type = types.nullOr types.lines;
description = "A lua function customizing the styling of numbers."; description = "A lua function customizing the styling of numbers.";
@ -109,7 +114,7 @@ in
default = null; default = null;
}; };
diagnosticsIndicator = mkOption { diagnosticsIndicator = mkOption {
type = types.nullOr types.lines; type = types.nullOr helpers.rawType;
default = null; default = null;
}; };
customFilter = mkOption { customFilter = mkOption {
@ -218,6 +223,12 @@ in
}; };
})); }));
}; };
extraOptions = mkOption {
type = types.attrs;
default = { };
description = "Extra options, will override others if defined";
};
}; };
}; };
@ -253,7 +264,7 @@ in
enforce_regular_tabs = cfg.enforceRegularTabs; enforce_regular_tabs = cfg.enforceRegularTabs;
always_show_bufferline = cfg.alwaysShowBufferline; always_show_bufferline = cfg.alwaysShowBufferline;
sort_by = cfg.sortBy; sort_by = cfg.sortBy;
}; } // cfg.extraOptions;
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; { highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
fill = fill; fill = fill;
background = background; background = background;
@ -319,7 +330,7 @@ in
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
bufferline-nvim cfg.package
nvim-web-devicons nvim-web-devicons
]; ];
options.termguicolors = true; options.termguicolors = true;

View file

@ -9,6 +9,12 @@ in
colorschemes.base16 = { colorschemes.base16 = {
enable = mkEnableOption "Enable base16"; enable = mkEnableOption "Enable base16";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.base16-vim;
description = "Plugin to use for base16";
};
useTruecolor = mkOption { useTruecolor = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -31,7 +37,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "base16-${cfg.colorscheme}"; colorscheme = "base16-${cfg.colorscheme}";
extraPlugins = [ pkgs.vimPlugins.base16-vim ]; extraPlugins = [ cfg.package ];
plugins.airline.theme = mkIf (cfg.setUpBar) "base16"; plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
plugins.lightline.colorscheme = null; plugins.lightline.colorscheme = null;

View file

@ -9,6 +9,12 @@ in
colorschemes.gruvbox = { colorschemes.gruvbox = {
enable = mkEnableOption "Enable gruvbox"; enable = mkEnableOption "Enable gruvbox";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.gruvbox-nvim;
description = "Plugin to use for gruvbox";
};
italics = mkEnableOption "Enable italics"; italics = mkEnableOption "Enable italics";
bold = mkEnableOption "Enable bold"; bold = mkEnableOption "Enable bold";
underline = mkEnableOption "Enable underlined text"; underline = mkEnableOption "Enable underlined text";
@ -113,7 +119,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "gruvbox"; colorscheme = "gruvbox";
extraPlugins = [ pkgs.vimPlugins.gruvbox-nvim ]; extraPlugins = [ cfg.package ];
globals = { globals = {
gruvbox_bold = mkIf (!cfg.bold) 0; gruvbox_bold = mkIf (!cfg.bold) 0;

View file

@ -8,6 +8,12 @@ in
colorschemes.nord = { colorschemes.nord = {
enable = mkEnableOption "Enable nord"; enable = mkEnableOption "Enable nord";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nord-nvim;
description = "Plugin to use for nord.nvim";
};
contrast = mkEnableOption contrast = mkEnableOption
"Make sidebars and popup menus like nvim-tree and telescope have a different background"; "Make sidebars and popup menus like nvim-tree and telescope have a different background";
@ -33,7 +39,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "nord"; colorscheme = "nord";
extraPlugins = [ pkgs.vimPlugins.nord-nvim ]; extraPlugins = [ cfg.package ];
globals = { globals = {
nord_contrast = mkIf cfg.contrast 1; nord_contrast = mkIf cfg.contrast 1;

View file

@ -7,12 +7,18 @@ in
options = { options = {
colorschemes.one = { colorschemes.one = {
enable = mkEnableOption "Enable vim-one"; enable = mkEnableOption "Enable vim-one";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.vim-one;
description = "Plugin to use for one";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "one"; colorscheme = "one";
extraPlugins = [ pkgs.vimPlugins.vim-one ]; extraPlugins = [ cfg.package ];
options = { options = {
termguicolors = true; termguicolors = true;

View file

@ -7,12 +7,18 @@ in
options = { options = {
colorschemes.onedark = { colorschemes.onedark = {
enable = mkEnableOption "Enable onedark"; enable = mkEnableOption "Enable onedark";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.onedark-vim;
description = "Plugin to use for one";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "onedark"; colorscheme = "onedark";
extraPlugins = [ pkgs.vimPlugins.onedark-vim ]; extraPlugins = [ cfg.package ];
options = { options = {
termguicolors = true; termguicolors = true;

View file

@ -9,6 +9,11 @@ in
options = { options = {
colorschemes.tokyonight = { colorschemes.tokyonight = {
enable = mkEnableOption "Enable tokyonight"; enable = mkEnableOption "Enable tokyonight";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.tokyonight-nvim;
description = "Plugin to use for tokyonight";
};
style = mkOption { style = mkOption {
type = style; type = style;
default = "storm"; default = "storm";
@ -75,7 +80,7 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "tokyonight"; colorscheme = "tokyonight";
extraPlugins = [ pkgs.vimPlugins.tokyonight-nvim ]; extraPlugins = [ cfg.package ];
options = { termguicolors = true; }; options = { termguicolors = true; };
extraConfigLuaPre = extraConfigLuaPre =
let let

View file

@ -11,6 +11,12 @@ in
plugins.coq-nvim = { plugins.coq-nvim = {
enable = mkEnableOption "Enable coq-nvim"; enable = mkEnableOption "Enable coq-nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.coq-vim;
description = "Plugin to use for coq-nvim";
};
installArtifacts = mkEnableOption "Install coq-artifacts"; installArtifacts = mkEnableOption "Install coq-artifacts";
autoStart = mkOption { autoStart = mkOption {
@ -35,7 +41,7 @@ in
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ extraPlugins = [
plugins.coq-nvim cfg.package
] ++ optional cfg.installArtifacts plugins.coq-artifacts; ] ++ optional cfg.installArtifacts plugins.coq-artifacts;
plugins.lsp = { plugins.lsp = {
preConfig = '' preConfig = ''

View file

@ -7,6 +7,13 @@ in
{ {
options.plugins.lspkind = { options.plugins.lspkind = {
enable = mkEnableOption "lspkind.nvim"; enable = mkEnableOption "lspkind.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lspkind-nvim;
description = "Plugin to use for lspkind.nvim";
};
mode = mkOption { mode = mkOption {
type = with types; nullOr (enum [ "text" "text_symbol" "symbol_text" "symbol" ]); type = with types; nullOr (enum [ "text" "text_symbol" "symbol_text" "symbol" ]);
default = null; default = null;
@ -72,7 +79,7 @@ in
} else { }); } else { });
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lspkind-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = optionalString (!doCmp) '' extraConfigLua = optionalString (!doCmp) ''
require('lspkind').init(${helpers.toLuaObject options}) require('lspkind').init(${helpers.toLuaObject options})

View file

@ -17,6 +17,12 @@ in
options.plugins.nvim-cmp = { options.plugins.nvim-cmp = {
enable = mkEnableOption "Enable nvim-cmp"; enable = mkEnableOption "Enable nvim-cmp";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-cmp;
description = "Plugin to use for nvim-cmp";
};
performance = mkOption { performance = mkOption {
default = null; default = null;
type = types.nullOr (types.submodule ({ ... }: { type = types.nullOr (types.submodule ({ ... }: {
@ -394,7 +400,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-cmp ]; extraPlugins = [ cfg.package ];
extraConfigLua = helpers.wrapDo '' extraConfigLua = helpers.wrapDo ''
local cmp = require('cmp') local cmp = require('cmp')

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "fugitive"; name = "fugitive";
description = "Enable vim-fugitive"; description = "Enable vim-fugitive";
extraPlugins = [ pkgs.vimPlugins.vim-fugitive ]; package = pkgs.vimPlugins.vim-fugitive;
extraPackages = [ pkgs.git ]; extraPackages = [ pkgs.git ];
# In typical tpope fashin, this plugin has no config options # In typical tpope fashin, this plugin has no config options

View file

@ -9,6 +9,12 @@ in
plugins.gitgutter = { plugins.gitgutter = {
enable = mkEnableOption "Enable gitgutter"; enable = mkEnableOption "Enable gitgutter";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.gitgutter;
description = "Plugin to use for gitgutter";
};
recommendedSettings = mkOption { recommendedSettings = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -170,7 +176,7 @@ in
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep; grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.gitgutter ]; extraPlugins = [ cfg.package ];
options = mkIf cfg.recommendedSettings { options = mkIf cfg.recommendedSettings {
updatetime = 100; updatetime = 100;

View file

@ -44,6 +44,11 @@ with lib; let
in { in {
options.plugins.gitsigns = { options.plugins.gitsigns = {
enable = mkEnableOption "Enable gitsigns plugin"; enable = mkEnableOption "Enable gitsigns plugin";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.gitsigns-nvim;
description = "Plugin to use for gitsigns";
};
signs = { signs = {
add = signOptions { add = signOptions {
hl = "GitSignsAdd"; hl = "GitSignsAdd";
@ -363,7 +368,7 @@ in {
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
gitsigns-nvim cfg.package
]; ];
extraConfigLua = let extraConfigLua = let
luaFnOrStrToObj = val: luaFnOrStrToObj = val:

View file

@ -18,6 +18,12 @@ in
plugins.neogit = { plugins.neogit = {
enable = mkEnableOption "Enable neogit"; enable = mkEnableOption "Enable neogit";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.neogit;
description = "Plugin to use for neogit";
};
disableSigns = mkOption { disableSigns = mkOption {
description = "Disable signs"; description = "Disable signs";
type = types.nullOr types.bool; type = types.nullOr types.bool;
@ -217,7 +223,7 @@ in
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
neogit cfg.package
plenary-nvim plenary-nvim
] ++ optional cfg.integrations.diffview diffview-nvim; ] ++ optional cfg.integrations.diffview diffview-nvim;

View file

@ -69,6 +69,7 @@ rec {
mkPlugin = { config, lib, ... }: { mkPlugin = { config, lib, ... }: {
name, name,
description, description,
package ? null,
extraPlugins ? [], extraPlugins ? [],
extraPackages ? [], extraPackages ? [],
options ? {}, options ? {},
@ -81,13 +82,23 @@ rec {
name = opt.global; name = opt.global;
value = if cfg.${name} != null then opt.value cfg.${name} else null; value = if cfg.${name} != null then opt.value cfg.${name} else null;
}) options; }) options;
# does this evaluate package?
packageOption = if package == null then { } else {
package = mkOption {
type = types.package;
default = package;
description = "Plugin to use for ${name}";
};
};
in { in {
options.plugins.${name} = { options.plugins.${name} = {
enable = mkEnableOption description; enable = mkEnableOption description;
} // pluginOptions; } // packageOption // pluginOptions;
config = mkIf cfg.enable { config = mkIf cfg.enable {
inherit extraPlugins extraPackages globals; inherit extraPackages globals;
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
}; };
}; };

View file

@ -3,7 +3,7 @@ with lib; with import ../helpers.nix { lib = lib; };
mkPlugin args { mkPlugin args {
name = "ledger"; name = "ledger";
description = "Enable ledger language features"; description = "Enable ledger language features";
extraPlugins = [ pkgs.vimPlugins.vim-ledger ]; package = pkgs.vimPlugins.vim-ledger;
options = { options = {
maxWidth = mkDefaultOpt { maxWidth = mkDefaultOpt {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "nix"; name = "nix";
description = "Enable nix"; description = "Enable nix";
extraPlugins = [ pkgs.vimPlugins.vim-nix ]; package = pkgs.vimPlugins.vim-nix;
# Possibly add option to disable Treesitter highlighting if this is installed # Possibly add option to disable Treesitter highlighting if this is installed
options = {}; options = {};

View file

@ -7,6 +7,13 @@
with lib; { with lib; {
options.plugins.plantuml-syntax = { options.plugins.plantuml-syntax = {
enable = mkEnableOption "Enable plantuml syntax support"; enable = mkEnableOption "Enable plantuml syntax support";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.plantuml-syntax;
description = "Plugin to use for plantuml-syntax";
};
setMakeprg = mkOption { setMakeprg = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -23,7 +30,7 @@ with lib; {
cfg = config.plugins.plantuml-syntax; cfg = config.plugins.plantuml-syntax;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [plantuml-syntax]; extraPlugins = [ cfg.package ];
globals = { globals = {
plantuml_set_makeprg = cfg.setMakeprg; plantuml_set_makeprg = cfg.setMakeprg;

View file

@ -1,13 +1,18 @@
{ { pkgs
pkgs, , lib
lib, , config
config, , ...
...
}: }:
with lib; { with lib; {
options.plugins.treesitter-context = { options.plugins.treesitter-context = {
enable = mkEnableOption "Enable nvim-treesitter-context"; enable = mkEnableOption "Enable nvim-treesitter-context";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-treesitter-context;
description = "Plugin to use for nvim-treesitter-context";
};
maxLines = mkOption { maxLines = mkOption {
type = types.nullOr types.ints.positive; type = types.nullOr types.ints.positive;
default = null; default = null;
@ -41,11 +46,12 @@ with lib; {
}; };
}; };
config = let config =
let
cfg = config.plugins.treesitter-context; cfg = config.plugins.treesitter-context;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-context]; extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.context = { plugins.treesitter.moduleConfig.context = {
max_lines = cfg.maxLines; max_lines = cfg.maxLines;

View file

@ -1,20 +1,28 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: }:
with lib; { with lib; {
options.plugins.treesitter-refactor = let options.plugins.treesitter-refactor =
let
disable = mkOption { disable = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "List of languages to disable the module on"; description = "List of languages to disable the module on";
}; };
in { in
{
enable = enable =
mkEnableOption mkEnableOption
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)"; "Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-treesitter-refactor;
description = "Plugin to use for treesitter-refactor";
};
highlightDefinitions = { highlightDefinitions = {
inherit disable; inherit disable;
enable = enable =
@ -95,11 +103,13 @@ with lib; {
}; };
}; };
config = let config =
let
cfg = config.plugins.treesitter-refactor; cfg = config.plugins.treesitter-refactor;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-refactor]; extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.refactor = { plugins.treesitter.moduleConfig.refactor = {
highlight_definitions = { highlight_definitions = {
inherit (cfg.highlightDefinitions) enable disable; inherit (cfg.highlightDefinitions) enable disable;
@ -112,9 +122,11 @@ with lib; {
}; };
navigation = { navigation = {
inherit (cfg.navigation) enable disable; inherit (cfg.navigation) enable disable;
keymaps = let keymaps =
let
cfgK = cfg.navigation.keymaps; cfgK = cfg.navigation.keymaps;
in { in
{
goto_definition = cfgK.gotoDefinition; goto_definition = cfgK.gotoDefinition;
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback; goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
list_definitions = cfgK.listDefinitons; list_definitions = cfgK.listDefinitons;

View file

@ -9,6 +9,12 @@ in
plugins.treesitter = { plugins.treesitter = {
enable = mkEnableOption "Enable tree-sitter syntax highlighting"; enable = mkEnableOption "Enable tree-sitter syntax highlighting";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-treesitter;
description = "Plugin to use for nvim-treesitter. If using nixGrammars, it should include a `withPlugins` function";
};
nixGrammars = mkOption { nixGrammars = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -75,7 +81,7 @@ in
grammarPackages = mkOption { grammarPackages = mkOption {
type = with types; listOf package; type = with types; listOf package;
default = pkgs.tree-sitter.allGrammars; default = cfg.package.passthru.allGrammars;
description = "Grammar packages to install"; description = "Grammar packages to install";
}; };
@ -126,8 +132,8 @@ in
''; '';
extraPlugins = with pkgs; if cfg.nixGrammars then extraPlugins = with pkgs; if cfg.nixGrammars then
[ (vimPlugins.nvim-treesitter.withPlugins (_: cfg.grammarPackages)) ] [ (cfg.package.withPlugins (_: cfg.grammarPackages)) ]
else [ vimPlugins.nvim-treesitter ]; else [ cfg.package ];
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ]; extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
options = mkIf cfg.folding { options = mkIf cfg.folding {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "zig"; name = "zig";
description = "Enable zig"; description = "Enable zig";
extraPlugins = [ pkgs.vimPlugins.zig-vim ]; package = pkgs.vimPlugins.zig-vim;
# Possibly add option to disable Treesitter highlighting if this is installed # Possibly add option to disable Treesitter highlighting if this is installed
options = { options = {

View file

@ -12,6 +12,12 @@ in
options.plugins.null-ls = { options.plugins.null-ls = {
enable = mkEnableOption "Enable null-ls"; enable = mkEnableOption "Enable null-ls";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.null-ls-nvim;
description = "Plugin to use for null-ls";
};
debug = mkOption { debug = mkOption {
default = null; default = null;
type = with types; nullOr bool; type = with types; nullOr bool;
@ -38,7 +44,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ null-ls-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("null-ls").setup(${helpers.toLuaObject options}) require("null-ls").setup(${helpers.toLuaObject options})

View file

@ -4,7 +4,8 @@
{ name { name
, sourceType , sourceType
, description ? "Enable ${name} source, for null-ls." , description ? "Enable ${name} source, for null-ls."
, packages ? [ ] , package ? null
, extraPackages ? [ ]
, ... , ...
}: }:
# returns a module # returns a module
@ -13,6 +14,14 @@
let let
helpers = import ../helpers.nix args; helpers = import ../helpers.nix args;
cfg = config.plugins.null-ls.sources.${sourceType}.${name}; cfg = config.plugins.null-ls.sources.${sourceType}.${name};
# does this evaluate package?
packageOption = if package == null then { } else {
package = mkOption {
type = types.package;
default = package;
description = "Package to use for ${name} by null-ls";
};
};
in in
{ {
options.plugins.null-ls.sources.${sourceType}.${name} = { options.plugins.null-ls.sources.${sourceType}.${name} = {
@ -28,10 +37,11 @@
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\' # '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
# ''; # '';
}; };
}; } // packageOption;
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPackages = packages; # Does this evaluate package?
extraPackages = extraPackages ++ optional (package != null) cfg.package;
# Add source to list of sources # Add source to list of sources
plugins.null-ls.sourcesItems = plugins.null-ls.sourcesItems =

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, inputs, ... }@args: { pkgs, config, lib, ... }@args:
let let
helpers = import ./helpers.nix args; helpers = import ./helpers.nix args;
serverData = { serverData = {
@ -8,36 +8,33 @@ let
completion = { }; completion = { };
diagnostics = { diagnostics = {
flake8 = { flake8 = {
packages = [ pkgs.python3Packages.flake8 ]; package = pkgs.python3Packages.flake8;
}; };
shellcheck = { shellcheck = {
packages = [ pkgs.shellcheck ]; package = pkgs.shellcheck;
}; };
}; };
formatting = { formatting = {
phpcbf = { phpcbf = {
packages = [ pkgs.phpPackages.phpcbf ]; package = pkgs.phpPackages.phpcbf;
}; };
alejandra = { alejandra = {
packages = [ pkgs.alejandra ]; package = pkgs.alejandra;
}; };
nixfmt = { nixfmt = {
packages = [ pkgs.nixfmt ]; package = pkgs.nixfmt;
}; };
prettier = { prettier = {
packages = [ pkgs.nodePackages.prettier ]; package = pkgs.nodePackages.prettier;
}; };
black = { black = {
packages = [ pkgs.python3Packages.black ]; package = pkgs.python3Packages.black;
};
beautysh = {
packages = [ inputs.beautysh.packages.${pkgs.system}.beautysh-python38 ];
}; };
fourmolu = { fourmolu = {
packages = [ pkgs.haskellPackages.fourmolu ]; package = pkgs.haskellPackages.fourmolu;
}; };
fnlfmt = { fnlfmt = {
packages = [ pkgs.fnlfmt ]; package = pkgs.fnlfmt;
}; };
}; };
}; };
@ -57,7 +54,8 @@ in
{ {
imports = lib.lists.map (helpers.mkServer) dataFlattened; imports = lib.lists.map (helpers.mkServer) dataFlattened;
config = let config =
let
cfg = config.plugins.null-ls; cfg = config.plugins.null-ls;
in in
lib.mkIf cfg.enable { lib.mkIf cfg.enable {

View file

@ -6,22 +6,23 @@ let
{ {
name = "bashls"; name = "bashls";
description = "Enable bashls, for bash."; description = "Enable bashls, for bash.";
packages = [ pkgs.nodePackages.bash-language-server ]; package = pkgs.nodePackages.bash-language-server;
} }
{ {
name = "clangd"; name = "clangd";
description = "Enable clangd LSP, for C/C++."; description = "Enable clangd LSP, for C/C++.";
packages = [ pkgs.clang-tools ]; package = pkgs.clang-tools;
} }
{ {
name = "cssls"; name = "cssls";
description = "Enable cssls, for CSS"; description = "Enable cssls, for CSS";
packages = [ pkgs.nodePackages.vscode-langservers-extracted ]; package = pkgs.nodePackages.vscode-langservers-extracted;
cmd = cfg: [ "${cfg.package}/bin/vscode-css-language-server" "--stdio" ];
} }
{ {
name = "dartls"; name = "dartls";
description = "Enable dart language-server, for dart"; description = "Enable dart language-server, for dart";
packages = [ pkgs.dart ]; package = pkgs.dart;
extraOptions = { extraOptions = {
analysisExcludedFolders = mkOption { analysisExcludedFolders = mkOption {
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
@ -112,23 +113,24 @@ let
{ {
name = "denols"; name = "denols";
description = "Enable denols, for Deno"; description = "Enable denols, for Deno";
packages = [ pkgs.deno ]; package = pkgs.deno;
} }
{ {
name = "eslint"; name = "eslint";
description = "Enable eslint"; description = "Enable eslint";
packages = [ pkgs.nodePackages.vscode-langservers-extracted ]; package = pkgs.nodePackages.vscode-langservers-extracted;
cmd = cfg: [ "${cfg.package}/bin/vscode-eslint-langauge-server" "--stdio" ];
} }
{ {
name = "elixirls"; name = "elixirls";
description = "Enable elixirls"; description = "Enable elixirls";
packages = [ ]; package = pkgs.elixir_ls;
cmd = [ "${pkgs.elixir_ls}/bin/elixir-ls" ]; cmd = cfg: [ "${cfg.package}/bin/elixir-ls" ];
} }
{ {
name = "gdscript"; name = "gdscript";
description = "Enable gdscript, for Godot"; description = "Enable gdscript, for Godot";
packages = [ ]; package = null;
} }
{ {
name = "gopls"; name = "gopls";
@ -137,17 +139,19 @@ let
{ {
name = "html"; name = "html";
description = "Enable html, for HTML"; description = "Enable html, for HTML";
packages = [ pkgs.nodePackages.vscode-langservers-extracted ]; package = pkgs.nodePackages.vscode-langservers-extracted;
cmd = cfg: [ "${cfg.package}/bin/vscode-html-language-server" "--stdio" ];
} }
{ {
name = "jsonls"; name = "jsonls";
description = "Enable jsonls, for JSON"; description = "Enable jsonls, for JSON";
packages = [ pkgs.nodePackages.vscode-langservers-extracted ]; package = pkgs.nodePackages.vscode-langservers-extracted;
cmd = cfg: [ "${cfg.package}/bin/vscode-json-language-server" "--stdio" ];
} }
{ {
name = "nil_ls"; name = "nil_ls";
description = "Enable nil, for Nix"; description = "Enable nil, for Nix";
packages = [ pkgs.nil ]; package = pkgs.nil;
extraOptions = { extraOptions = {
formatting.command = mkOption { formatting.command = mkOption {
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
@ -194,28 +198,30 @@ let
description = "Enable rust-analyzer, for Rust."; description = "Enable rust-analyzer, for Rust.";
serverName = "rust_analyzer"; serverName = "rust_analyzer";
} }
{
name = "sumneko-lua";
description = "Enable sumneko_lua, for lua";
package = pkgs.sumneko-lua-language-server;
serverName = "sumneko_lua";
}
{ {
name = "tailwindcss"; name = "tailwindcss";
description = "Enable tailwindcss language server, for tailwindcss"; description = "Enable tailwindcss language server, for tailwindcss";
packages = [ pkgs.nodePackages."@tailwindcss/language-server" ]; package = pkgs.nodePackages."@tailwindcss/language-server";
} }
{ {
name = "texlab"; name = "texlab";
description = "Enable texlab language server, for LaTeX"; description = "Enable texlab language server, for LaTeX";
packages = [ pkgs.texlab ];
} }
{ {
name = "tsserver"; name = "tsserver";
description = "Enable tsserver for typescript"; description = "Enable tsserver for typescript";
packages = with pkgs; [ package = pkgs.nodePackages.typescript-language-server;
nodePackages.typescript
nodePackages.typescript-language-server
];
} }
{ {
name = "vuels"; name = "vuels";
description = "Enable vuels, for Vue"; description = "Enable vuels, for Vue";
packages = [ pkgs.nodePackages.vls ]; package = pkgs.nodePackages.vue-language-server;
} }
{ {
name = "zls"; name = "zls";
@ -224,8 +230,8 @@ let
{ {
name = "hls"; name = "hls";
description = "Enable haskell language server"; description = "Enable haskell language server";
packages = [ pkgs.haskell-language-server ]; package = pkgs.haskell-language-server;
cmd = [ "haskell-language-server-wrapper" ]; cmd = cfg: [ "haskell-language-server-wrapper" ];
} }
]; ];
in in

View file

@ -5,9 +5,10 @@
{ name { name
, description ? "Enable ${name}." , description ? "Enable ${name}."
, serverName ? name , serverName ? name
, packages ? [ pkgs.${name} ] , package ? pkgs.${name}
, cmd ? null , extraPackages ? { }
, settings ? null , cmd ? (cfg: null)
, settings ? (cfg: { })
, extraOptions ? { } , extraOptions ? { }
, ... , ...
}: }:
@ -16,22 +17,32 @@
with lib; with lib;
let let
cfg = config.plugins.lsp.servers.${name}; cfg = config.plugins.lsp.servers.${name};
packageOption =
if package != null then {
package = mkOption {
default = package;
type = types.nullOr types.package;
};
} else { };
in in
{ {
options = { options = {
plugins.lsp.servers.${name} = { plugins.lsp.servers.${name} = {
enable = mkEnableOption description; enable = mkEnableOption description;
} // extraOptions; } // packageOption // extraOptions;
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable
extraPackages = packages; {
extraPackages = (optional (package != null) cfg.package) ++
(mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
plugins.lsp.enabledServers = [{ plugins.lsp.enabledServers = [{
name = serverName; name = serverName;
extraOptions = { extraOptions = {
inherit cmd; cmd = cmd cfg;
settings = if settings != null then settings cfg else { }; settings = settings cfg;
}; };
}]; }];
}; };

View file

@ -8,6 +8,13 @@ in
options = { options = {
plugins.lsp-lines = { plugins.lsp-lines = {
enable = mkEnableOption "lsp_lines.nvim"; enable = mkEnableOption "lsp_lines.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lsp_lines-nvim;
description = "Plugin to use for lsp_lines.nvim";
};
currentLine = mkOption { currentLine = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
@ -27,7 +34,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
do do

View file

@ -9,6 +9,12 @@ in
plugins.lspsaga = { plugins.lspsaga = {
enable = mkEnableOption "Enable lspsava.nvim"; enable = mkEnableOption "Enable lspsava.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lspsaga-nvim;
description = "Plugin to use for lspsaga.nvim";
};
signs = { signs = {
use = mkOption { use = mkOption {
default = true; default = true;
@ -195,7 +201,8 @@ in
in notEmpty keys; in notEmpty keys;
}; };
in mkIf cfg.enable { in mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lspsaga-nvim ];
extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
local saga = require 'lspsaga' local saga = require 'lspsaga'

View file

@ -9,6 +9,12 @@ with lib;
options.plugins.trouble = { options.plugins.trouble = {
enable = mkEnableOption "trouble.nvim"; enable = mkEnableOption "trouble.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.trouble-nvim;
description = "Plugin to use for trouble-nvim";
};
position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list"; position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list";
height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom"; height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom";
width = helpers.mkNullOrOption types.int "Width of the trouble list when position is left or right"; width = helpers.mkNullOrOption types.int "Width of the trouble list when position is left or right";
@ -17,7 +23,7 @@ with lib;
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
trouble-nvim cfg.package
nvim-web-devicons nvim-web-devicons
]; ];
}; };

View file

@ -11,6 +11,7 @@ in
package = mkOption { package = mkOption {
default = pkgs.vimPlugins.luasnip; default = pkgs.vimPlugins.luasnip;
type = types.package; type = types.package;
description = "Plugin to use for luasnip";
}; };
fromVscode = mkOption { fromVscode = mkOption {

View file

@ -16,6 +16,12 @@ in
plugins.airline = { plugins.airline = {
enable = mkEnableOption "Enable airline"; enable = mkEnableOption "Enable airline";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.vim-airline;
description = "Plguin to use for airline";
};
extensions = mkOption { extensions = mkOption {
default = null; default = null;
type = with types; nullOr attrs; type = with types; nullOr attrs;
@ -63,7 +69,7 @@ in
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
vim-airline cfg.package
] ++ optional (!isNull cfg.theme) vim-airline-themes; ] ++ optional (!isNull cfg.theme) vim-airline-themes;
globals = { globals = {
airline.extensions = cfg.extensions; airline.extensions = cfg.extensions;

View file

@ -9,6 +9,12 @@ in
plugins.lightline = { plugins.lightline = {
enable = mkEnableOption "Enable lightline"; enable = mkEnableOption "Enable lightline";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lightline-vim;
description = "Plugin to use for lightline";
};
colorscheme = mkOption { colorscheme = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
default = config.colorscheme; default = config.colorscheme;
@ -84,7 +90,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lightline-vim ]; extraPlugins = [ cfg.package ];
globals.lightline = mkIf (configAttrs != { }) configAttrs; globals.lightline = mkIf (configAttrs != { }) configAttrs;
}; };
} }

View file

@ -58,6 +58,12 @@ in
plugins.lualine = { plugins.lualine = {
enable = mkEnableOption "Enable lualine"; enable = mkEnableOption "Enable lualine";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.lualine-nvim;
description = "Plugin to use for lualine";
};
theme = mkOption { theme = mkOption {
default = config.colorscheme; default = config.colorscheme;
type = types.nullOr types.str; type = types.nullOr types.str;
@ -144,7 +150,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lualine-nvim ]; extraPlugins = [ cfg.package ];
extraPackages = [ pkgs.git ]; extraPackages = [ pkgs.git ];
extraConfigLua = extraConfigLua =
''require("lualine").setup(${helpers.toLuaObject setupOptions})''; ''require("lualine").setup(${helpers.toLuaObject setupOptions})'';

View file

@ -18,6 +18,12 @@ in
options.plugins.telescope = { options.plugins.telescope = {
enable = mkEnableOption "Enable telescope.nvim"; enable = mkEnableOption "Enable telescope.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.telescope-nvim;
description = "Plugin to use for telescope.nvim";
};
highlightTheme = mkOption { highlightTheme = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
description = "The colorscheme to use for syntax highlighting"; description = "The colorscheme to use for syntax highlighting";
@ -53,7 +59,7 @@ in
extraPackages = [ pkgs.bat ]; extraPackages = [ pkgs.bat ];
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
telescope-nvim cfg.package
plenary-nvim plenary-nvim
popup-nvim popup-nvim
]; ];

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.frecency = { options.plugins.telescope.extensions.frecency = {
enable = mkEnableOption "Enable frecency"; enable = mkEnableOption "Enable frecency";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.telescope-frecency-nvim;
description = "Plugin to use for telescope frecency";
};
dbRoot = mkOption { dbRoot = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
description = "Path to parent directory of custom database location. Defaults to $XDG_DATA_HOME/nvim"; description = "Path to parent directory of custom database location. Defaults to $XDG_DATA_HOME/nvim";
@ -57,7 +63,7 @@ in
in mkIf cfg.enable { in mkIf cfg.enable {
extraPackages = [ pkgs.sqlite ]; extraPackages = [ pkgs.sqlite ];
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
telescope-frecency-nvim cfg.package
sqlite-lua sqlite-lua
]; ];

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.fzf-native = { options.plugins.telescope.extensions.fzf-native = {
enable = mkEnableOption "Enable fzf-native"; enable = mkEnableOption "Enable fzf-native";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.telescope-fzf-native-nvim;
description = "Plugin to use for telescope extension fzf-native";
};
fuzzy = mkOption { fuzzy = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
description = "Whether to fuzzy search. False will do exact matching"; description = "Whether to fuzzy search. False will do exact matching";
@ -36,7 +42,7 @@ in
case_mode = cfg.caseMode; case_mode = cfg.caseMode;
}; };
in mkIf cfg.enable { in mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.telescope-fzf-native-nvim ]; extraPlugins = [ cfg.package ];
plugins.telescope.enabledExtensions = [ "fzf" ]; plugins.telescope.enabledExtensions = [ "fzf" ];
plugins.telescope.extensionConfig."fzf" = configuration; plugins.telescope.extensionConfig."fzf" = configuration;

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.media_files = { options.plugins.telescope.extensions.media_files = {
enable = mkEnableOption "Enable media_files extension for telescope"; enable = mkEnableOption "Enable media_files extension for telescope";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.telescope-media-files-nvim;
description = "Plugin to use for telescope extension media_files";
};
filetypes = mkOption { filetypes = mkOption {
default = null; default = null;
type = with types; nullOr (listOf str); type = with types; nullOr (listOf str);
@ -25,7 +31,7 @@ in
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
popup-nvim popup-nvim
plenary-nvim plenary-nvim
telescope-media-files-nvim cfg.package
]; ];
extraPackages = with pkgs; [ extraPackages = with pkgs; [

View file

@ -8,6 +8,13 @@ in
options = { options = {
plugins.comment-nvim = { plugins.comment-nvim = {
enable = mkEnableOption "Enable comment-nvim"; enable = mkEnableOption "Enable comment-nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.comment-nvim;
description = "Plugin to use for comment-nvim";
};
padding = mkOption { padding = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
description = "Add a space b/w comment and the line"; description = "Add a space b/w comment and the line";
@ -97,7 +104,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.comment-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = extraConfigLua =
''require("Comment").setup${helpers.toLuaObject setupOptions}''; ''require("Comment").setup${helpers.toLuaObject setupOptions}'';
}; };

View file

@ -9,10 +9,16 @@ in
options = { options = {
plugins.commentary = { plugins.commentary = {
enable = mkEnableOption "Enable commentary"; enable = mkEnableOption "Enable commentary";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.vim-commentary;
description = "Plugin to use for vim-commentary";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.vim-commentary ]; extraPlugins = [ cfg.package ];
}; };
} }

View file

@ -10,6 +10,12 @@ in
plugins.dashboard = { plugins.dashboard = {
enable = mkEnableOption "Enable dashboard"; enable = mkEnableOption "Enable dashboard";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.dashboard-nvim;
description = "Plugin to use for dashboard-nvim";
};
header = mkOption { header = mkOption {
description = "Header text"; description = "Header text";
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
@ -126,7 +132,7 @@ in
filteredOptions = filterAttrs (_: v: !isNull v) options; filteredOptions = filterAttrs (_: v: !isNull v) options;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.dashboard-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
local dashboard = require("dashboard") local dashboard = require("dashboard")

View file

@ -8,11 +8,17 @@ in
options = { options = {
plugins.easyescape = { plugins.easyescape = {
enable = mkEnableOption "Enable easyescape"; enable = mkEnableOption "Enable easyescape";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.vim-easyescape;
description = "Plugin to use for easyescape";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = [
vim-easyescape cfg.package
]; ];
}; };
} }

View file

@ -10,7 +10,7 @@ in with helpers;
mkPlugin attrs { mkPlugin attrs {
name = "emmet"; name = "emmet";
description = "Enable emmet"; description = "Enable emmet";
extraPlugins = [ pkgs.vimPlugins.emmet-vim ]; package = pkgs.vimPlugins.emmet-vim;
options = { options = {
mode = mkDefaultOpt { mode = mkDefaultOpt {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "endwise"; name = "endwise";
description = "Enable vim-endwise"; description = "Enable vim-endwise";
extraPlugins = [ pkgs.vimPlugins.vim-endwise ]; package = pkgs.vimPlugins.vim-endwise;
# Yes it's really not configurable # Yes it's really not configurable
options = {}; options = {};

View file

@ -8,6 +8,13 @@ in
options = { options = {
plugins.floaterm = { plugins.floaterm = {
enable = mkEnableOption "Enable floaterm"; enable = mkEnableOption "Enable floaterm";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.vim-floaterm;
description = "Plugin to use for floatterm";
};
shell = mkOption { shell = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
@ -64,8 +71,8 @@ in
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = [
vim-floaterm cfg.package
]; ];
globals = { globals = {
floaterm_shell = mkIf (!isNull cfg.shell) cfg.shell; floaterm_shell = mkIf (!isNull cfg.shell) cfg.shell;

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "goyo"; name = "goyo";
description = "Enable goyo.vim"; description = "Enable goyo.vim";
extraPlugins = [ pkgs.vimPlugins.goyo-vim ]; package = pkgs.vimPlugins.goyo-vim;
options = { options = {
width = mkDefaultOpt { width = mkDefaultOpt {

View file

@ -1,18 +1,24 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
let let
cfg = config.plugins.comment-nvim; cfg = config.plugins.intellitab;
defs = import ../plugin-defs.nix { inherit pkgs; }; defs = import ../plugin-defs.nix { inherit pkgs; };
in in
{ {
options = { options = {
plugins.intellitab = { plugins.intellitab = {
enable = mkEnableOption "intellitab.nvim"; enable = mkEnableOption "intellitab.nvim";
package = mkOption {
type = types.package;
default = defs.intellitab-nvim;
description = "Plugin to use for intellitab.nvim";
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = [ defs.intellitab-nvim ]; extraPlugins = [ cfg.package ];
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>"; maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
plugins.treesitter = { plugins.treesitter = {

View file

@ -10,6 +10,12 @@ in
options.plugins.mark-radar = { options.plugins.mark-radar = {
enable = mkEnableOption "Enable mark-radar"; enable = mkEnableOption "Enable mark-radar";
package = mkOption {
type = types.package;
default = defs.mark-radar;
description = "Plugin to use for mark-radar";
};
highlight_background = mkOption { highlight_background = mkOption {
type = with types; nullOr bool; type = with types; nullOr bool;
default = null; default = null;
@ -40,7 +46,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ defs.mark-radar ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("mark-radar").setup(${opts}) require("mark-radar").setup(${opts})

View file

@ -12,6 +12,12 @@ in
options.plugins.notify = { options.plugins.notify = {
enable = mkEnableOption "Enable notify"; enable = mkEnableOption "Enable notify";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-notify;
description = "Plugin to use for notify";
};
stages = mkOption { stages = mkOption {
type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]); type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]);
description = "Animation style"; description = "Animation style";
@ -64,7 +70,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-notify ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
vim.notify = require('notify'); vim.notify = require('notify');
require('notify').setup(${helpers.toLuaObject setupOptions}) require('notify').setup(${helpers.toLuaObject setupOptions})

View file

@ -8,6 +8,12 @@ in
options.plugins.nvim-autopairs = { options.plugins.nvim-autopairs = {
enable = mkEnableOption "Enable nvim-autopairs"; enable = mkEnableOption "Enable nvim-autopairs";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-autopairs;
description = "Plugin to use for nvim-autopairs";
};
pairs = mkOption { pairs = mkOption {
type = types.nullOr (types.attrsOf types.str); type = types.nullOr (types.attrsOf types.str);
default = null; default = null;
@ -50,7 +56,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-autopairs ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options}) require('nvim-autopairs').setup(${helpers.toLuaObject options})

View file

@ -8,6 +8,12 @@ in
options.plugins.nvim-tree = { options.plugins.nvim-tree = {
enable = mkEnableOption "Enable nvim-tree"; enable = mkEnableOption "Enable nvim-tree";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.nvim-tree-lua;
description = "Plugin to use for nvim-tree";
};
disableNetrw = mkOption { disableNetrw = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
@ -217,7 +223,6 @@ in
hijack_netrw = cfg.hijackNetrw; hijack_netrw = cfg.hijackNetrw;
open_on_setup = cfg.openOnSetup; open_on_setup = cfg.openOnSetup;
ignore_ft_on_setup = cfg.ignoreFtOnSetup; ignore_ft_on_setup = cfg.ignoreFtOnSetup;
auto_close = cfg.autoClose;
open_on_tab = cfg.openOnTab; open_on_tab = cfg.openOnTab;
hijack_cursor = cfg.hijackCursor; hijack_cursor = cfg.hijackCursor;
update_cwd = cfg.updateCwd; update_cwd = cfg.updateCwd;
@ -257,10 +262,18 @@ in
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
nvim-tree-lua cfg.package
nvim-web-devicons nvim-web-devicons
]; ];
autoCmd = mkIf cfg.autoClose [
{
event = "BufEnter";
command = "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif";
nested = true;
}
];
extraConfigLua = '' extraConfigLua = ''
require('nvim-tree').setup(${helpers.toLuaObject options}) require('nvim-tree').setup(${helpers.toLuaObject options})
''; '';

View file

@ -8,6 +8,12 @@ in
options.plugins.project-nvim = helpers.extraOptionsOptions // { options.plugins.project-nvim = helpers.extraOptionsOptions // {
enable = mkEnableOption "Enable project.nvim"; enable = mkEnableOption "Enable project.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.project-nvim;
description = "Plugin to use for project-nvim";
};
manualMode = mkOption { manualMode = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
@ -70,7 +76,7 @@ in
} // cfg.extraOptions; } // cfg.extraOptions;
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.project-nvim ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('project_nvim').setup(${helpers.toLuaObject options}) require('project_nvim').setup(${helpers.toLuaObject options})

View file

@ -8,6 +8,12 @@ in
options.plugins.specs = { options.plugins.specs = {
enable = mkEnableOption "Enable specs-nvim"; enable = mkEnableOption "Enable specs-nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.specs-nvim;
description = "Plugin to use for specs-nvim";
};
show_jumps = mkOption { show_jumps = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -137,7 +143,7 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.specs-nvim ]; extraPlugins = [ cfg.package ];
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color; highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;

View file

@ -5,7 +5,7 @@ in with lib; with helpers;
mkPlugin args { mkPlugin args {
name = "startify"; name = "startify";
description = "Enable startify"; description = "Enable startify";
extraPlugins = [ pkgs.vimPlugins.vim-startify ]; package = pkgs.vimPlugins.vim-startify;
options = { options = {
sessionDir = mkDefaultOpt { sessionDir = mkDefaultOpt {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs { mkPlugin attrs {
name = "surround"; name = "surround";
description = "Enable surround.vim"; description = "Enable surround.vim";
extraPlugins = [ pkgs.vimPlugins.surround ]; package = pkgs.vimPlugins.surround;
options = {}; options = {};
} }

View file

@ -9,6 +9,12 @@ in
plugins.undotree = { plugins.undotree = {
enable = mkEnableOption "Enable undotree"; enable = mkEnableOption "Enable undotree";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.undotree;
description = "Plugin to use for undotree";
};
windowLayout = mkOption { windowLayout = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
default = null; default = null;
@ -108,7 +114,7 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.undotree ]; extraPlugins = [ cfg.package ];
globals = { globals = {
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout; undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;

View file

@ -247,6 +247,20 @@
}; };
}; };
autoCmd = build {
autoCmd = [
{
event = [ "BufEnter" "BufWinEnter" ];
pattern = [ "*.c" "*.h" ];
command = "echo 'Entering a C or C++ file'";
}
{
event = "InsertEnter";
command = "norm zz";
}
];
};
ts-custom = build { ts-custom = build {
plugins.treesitter = { plugins.treesitter = {
enable = true; enable = true;