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": {
"locked": {
"lastModified": 1663491030,
"narHash": "sha256-MVsfBhE9US5DvLtBAaTRjwYdv1tLO8xjahM8qLXTgTo=",
"lastModified": 1673606088,
"narHash": "sha256-wdYD41UwNwPhTdMaG0AIe7fE1bAdyHe6bB4HLUqUvck=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "767542707d394ff15ac1981e903e005ba69528b5",
"rev": "37b97ae3dd714de9a17923d004a2c5b5543dfa6d",
"type": "github"
},
"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 != { }) {
extraConfigLuaPost = ''
config = mkIf (config.highlight != { } || config.matches != { }) {
extraConfigLuaPost = (optionalString (config.highlight != { }) ''
-- Highlight groups {{
do
local highlights = ${helpers.toLuaObject config.highlight}
@ -28,6 +39,18 @@ with lib;
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 = {
enable = mkEnableOption "Enable barbar.nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.barbar-nvim;
description = "Plugin to use for barbar";
};
animations = mkOption {
type = types.nullOr types.bool;
default = null;
@ -50,7 +56,7 @@ in
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
barbar-nvim nvim-web-devicons
cfg.package nvim-web-devicons
];
# maps = genMaps cfg.keys;

View file

@ -26,6 +26,11 @@ in
options = {
plugins.bufferline = {
enable = mkEnableOption "Enable bufferline";
package = mkOption {
type = types.package;
description = "Plugin to use for bufferline";
default = pkgs.vimPlugins.bufferline-nvim;
};
numbers = mkOption {
type = types.nullOr types.lines;
description = "A lua function customizing the styling of numbers.";
@ -109,7 +114,7 @@ in
default = null;
};
diagnosticsIndicator = mkOption {
type = types.nullOr types.lines;
type = types.nullOr helpers.rawType;
default = null;
};
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;
always_show_bufferline = cfg.alwaysShowBufferline;
sort_by = cfg.sortBy;
};
} // cfg.extraOptions;
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
fill = fill;
background = background;
@ -319,7 +330,7 @@ in
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
bufferline-nvim
cfg.package
nvim-web-devicons
];
options.termguicolors = true;

View file

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

View file

@ -9,6 +9,12 @@ in
colorschemes.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";
bold = mkEnableOption "Enable bold";
underline = mkEnableOption "Enable underlined text";
@ -113,7 +119,7 @@ in
config = mkIf cfg.enable {
colorscheme = "gruvbox";
extraPlugins = [ pkgs.vimPlugins.gruvbox-nvim ];
extraPlugins = [ cfg.package ];
globals = {
gruvbox_bold = mkIf (!cfg.bold) 0;

View file

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

View file

@ -7,12 +7,18 @@ in
options = {
colorschemes.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 {
colorscheme = "one";
extraPlugins = [ pkgs.vimPlugins.vim-one ];
extraPlugins = [ cfg.package ];
options = {
termguicolors = true;

View file

@ -7,12 +7,18 @@ in
options = {
colorschemes.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 {
colorscheme = "onedark";
extraPlugins = [ pkgs.vimPlugins.onedark-vim ];
extraPlugins = [ cfg.package ];
options = {
termguicolors = true;

View file

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

View file

@ -11,6 +11,12 @@ in
plugins.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";
autoStart = mkOption {
@ -35,7 +41,7 @@ in
in
mkIf cfg.enable {
extraPlugins = [
plugins.coq-nvim
cfg.package
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
plugins.lsp = {
preConfig = ''

View file

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

View file

@ -17,6 +17,12 @@ in
options.plugins.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 {
default = null;
type = types.nullOr (types.submodule ({ ... }: {
@ -394,7 +400,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-cmp ];
extraPlugins = [ cfg.package ];
extraConfigLua = helpers.wrapDo ''
local cmp = require('cmp')

View file

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

View file

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

View file

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

View file

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

View file

@ -69,6 +69,7 @@ rec {
mkPlugin = { config, lib, ... }: {
name,
description,
package ? null,
extraPlugins ? [],
extraPackages ? [],
options ? {},
@ -81,13 +82,23 @@ rec {
name = opt.global;
value = if cfg.${name} != null then opt.value cfg.${name} else null;
}) 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 {
options.plugins.${name} = {
enable = mkEnableOption description;
} // pluginOptions;
} // packageOption // pluginOptions;
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 {
name = "ledger";
description = "Enable ledger language features";
extraPlugins = [ pkgs.vimPlugins.vim-ledger ];
package = pkgs.vimPlugins.vim-ledger;
options = {
maxWidth = mkDefaultOpt {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs {
name = "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
options = {};

View file

@ -7,6 +7,13 @@
with lib; {
options.plugins.plantuml-syntax = {
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 {
type = types.bool;
default = true;
@ -23,7 +30,7 @@ with lib; {
cfg = config.plugins.plantuml-syntax;
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [plantuml-syntax];
extraPlugins = [ cfg.package ];
globals = {
plantuml_set_makeprg = cfg.setMakeprg;

View file

@ -1,13 +1,18 @@
{
pkgs,
lib,
config,
...
{ pkgs
, lib
, config
, ...
}:
with lib; {
options.plugins.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 {
type = types.nullOr types.ints.positive;
default = null;
@ -15,7 +20,7 @@ with lib; {
};
trimScope = mkOption {
type = types.enum ["outer" "inner"];
type = types.enum [ "outer" "inner" ];
default = "outer";
description = "Which context lines to discard if `max_lines` is exceeded";
};
@ -28,7 +33,7 @@ with lib; {
patterns = mkOption {
type = types.attrsOf (types.listOf types.str);
default = {};
default = { };
description = ''
Patterns to use for context delimitation. The 'default' key matches all filetypes
'';
@ -36,16 +41,17 @@ with lib; {
exactPatterns = mkOption {
type = types.attrsOf types.bool;
default = {};
default = { };
description = "Treat the coresponding entry in patterns as an exact match";
};
};
config = let
cfg = config.plugins.treesitter-context;
in
config =
let
cfg = config.plugins.treesitter-context;
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-context];
extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.context = {
max_lines = cfg.maxLines;

View file

@ -1,105 +1,115 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}:
with lib; {
options.plugins.treesitter-refactor = let
disable = mkOption {
type = types.listOf types.str;
default = [];
description = "List of languages to disable the module on";
};
in {
enable =
mkEnableOption
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
highlightDefinitions = {
inherit disable;
options.plugins.treesitter-refactor =
let
disable = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of languages to disable the module on";
};
in
{
enable =
mkEnableOption
"Highlights definition and usages of the current symbol under the cursor.";
clearOnCursorMove = mkOption {
type = types.bool;
default = true;
description = ''
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
is around `100` you can set this to false to have a less laggy experience.
"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 = {
inherit disable;
enable =
mkEnableOption
"Highlights definition and usages of the current symbol under the cursor.";
clearOnCursorMove = mkOption {
type = types.bool;
default = true;
description = ''
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
is around `100` you can set this to false to have a less laggy experience.
'';
};
};
highlightCurrentScope = {
inherit disable;
enable = mkEnableOption "Highlights the block from the current scope where the cursor is.";
};
smartRename = {
inherit disable;
enable =
mkEnableOption
"Renames the symbol under the cursor within the current scope (and current file).";
keymaps = {
smartRename = mkOption {
type = types.nullOr types.str;
default = "grr";
description = "rename symbol under the cursor";
};
};
};
navigation = {
inherit disable;
enable = mkEnableOption ''
Provides "go to definition" for the symbol under the cursor,
and lists the definitions from the current file.
'';
};
};
highlightCurrentScope = {
inherit disable;
enable = mkEnableOption "Highlights the block from the current scope where the cursor is.";
};
smartRename = {
inherit disable;
enable =
mkEnableOption
"Renames the symbol under the cursor within the current scope (and current file).";
keymaps = {
smartRename = mkOption {
type = types.nullOr types.str;
default = "grr";
description = "rename symbol under the cursor";
};
};
};
navigation = {
inherit disable;
enable = mkEnableOption ''
Provides "go to definition" for the symbol under the cursor,
and lists the definitions from the current file.
'';
keymaps = {
gotoDefinition = mkOption {
type = types.nullOr types.str;
default = "gnd";
description = "go to the definition of the symbol under the cursor";
};
gotoDefinitionLspFallback = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
the symbol can not be resolved. You can use your own fallback function if create a
mapping fo `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
'';
};
listDefinitons = mkOption {
type = types.nullOr types.str;
default = "gnD";
description = "list all definitions from the current file";
};
listDefinitonsToc = mkOption {
type = types.nullOr types.str;
default = "gO";
description = ''
list all definitions from the current file like a table of contents (similar to the one
you see when pressing |gO| in help files).
'';
};
gotoNextUsage = mkOption {
type = types.nullOr types.str;
default = "<a-*>";
description = "go to next usage of identifier under the cursor";
};
gotoPreviousUsage = mkOption {
type = types.nullOr types.str;
default = "<a-#>";
description = "go to previous usage of identifier";
keymaps = {
gotoDefinition = mkOption {
type = types.nullOr types.str;
default = "gnd";
description = "go to the definition of the symbol under the cursor";
};
gotoDefinitionLspFallback = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
the symbol can not be resolved. You can use your own fallback function if create a
mapping fo `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
'';
};
listDefinitons = mkOption {
type = types.nullOr types.str;
default = "gnD";
description = "list all definitions from the current file";
};
listDefinitonsToc = mkOption {
type = types.nullOr types.str;
default = "gO";
description = ''
list all definitions from the current file like a table of contents (similar to the one
you see when pressing |gO| in help files).
'';
};
gotoNextUsage = mkOption {
type = types.nullOr types.str;
default = "<a-*>";
description = "go to next usage of identifier under the cursor";
};
gotoPreviousUsage = mkOption {
type = types.nullOr types.str;
default = "<a-#>";
description = "go to previous usage of identifier";
};
};
};
};
};
config = let
cfg = config.plugins.treesitter-refactor;
in
config =
let
cfg = config.plugins.treesitter-refactor;
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-refactor];
extraPlugins = [ cfg.package ];
plugins.treesitter.moduleConfig.refactor = {
highlight_definitions = {
inherit (cfg.highlightDefinitions) enable disable;
@ -108,20 +118,22 @@ with lib; {
highlight_current_scope = cfg.highlightCurrentScope;
smart_rename = {
inherit (cfg.smartRename) enable disable;
keymaps = {smart_rename = cfg.smartRename.keymaps.smartRename;};
keymaps = { smart_rename = cfg.smartRename.keymaps.smartRename; };
};
navigation = {
inherit (cfg.navigation) enable disable;
keymaps = let
cfgK = cfg.navigation.keymaps;
in {
goto_definition = cfgK.gotoDefinition;
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
list_definitions = cfgK.listDefinitons;
list_definitions_toc = cfgK.listDefinitonsToc;
goto_next_usage = cfgK.gotoNextUsage;
goto_previous_usage = cfgK.gotoPreviousUsage;
};
keymaps =
let
cfgK = cfg.navigation.keymaps;
in
{
goto_definition = cfgK.gotoDefinition;
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
list_definitions = cfgK.listDefinitons;
list_definitions_toc = cfgK.listDefinitonsToc;
goto_next_usage = cfgK.gotoNextUsage;
goto_previous_usage = cfgK.gotoPreviousUsage;
};
};
};
};

View file

@ -9,6 +9,12 @@ in
plugins.treesitter = {
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 {
type = types.bool;
default = true;
@ -75,7 +81,7 @@ in
grammarPackages = mkOption {
type = with types; listOf package;
default = pkgs.tree-sitter.allGrammars;
default = cfg.package.passthru.allGrammars;
description = "Grammar packages to install";
};
@ -126,8 +132,8 @@ in
'';
extraPlugins = with pkgs; if cfg.nixGrammars then
[ (vimPlugins.nvim-treesitter.withPlugins (_: cfg.grammarPackages)) ]
else [ vimPlugins.nvim-treesitter ];
[ (cfg.package.withPlugins (_: cfg.grammarPackages)) ]
else [ cfg.package ];
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
options = mkIf cfg.folding {

View file

@ -5,7 +5,7 @@ in with helpers; with lib;
mkPlugin attrs {
name = "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
options = {

View file

@ -12,6 +12,12 @@ in
options.plugins.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 {
default = null;
type = with types; nullOr bool;
@ -38,7 +44,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [ null-ls-nvim ];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require("null-ls").setup(${helpers.toLuaObject options})

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,13 @@ in
options = {
plugins.lsp-lines = {
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 {
type = types.bool;
default = false;
@ -27,7 +34,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
do

View file

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

View file

@ -9,6 +9,12 @@ with lib;
options.plugins.trouble = {
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";
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";
@ -17,7 +23,7 @@ with lib;
config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [
trouble-nvim
cfg.package
nvim-web-devicons
];
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.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 {
type = types.nullOr types.str;
description = "Path to parent directory of custom database location. Defaults to $XDG_DATA_HOME/nvim";
@ -57,7 +63,7 @@ in
in mkIf cfg.enable {
extraPackages = [ pkgs.sqlite ];
extraPlugins = with pkgs.vimPlugins; [
telescope-frecency-nvim
cfg.package
sqlite-lua
];

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.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 {
type = types.nullOr types.bool;
description = "Whether to fuzzy search. False will do exact matching";
@ -36,7 +42,7 @@ in
case_mode = cfg.caseMode;
};
in mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.telescope-fzf-native-nvim ];
extraPlugins = [ cfg.package ];
plugins.telescope.enabledExtensions = [ "fzf" ];
plugins.telescope.extensionConfig."fzf" = configuration;

View file

@ -7,6 +7,12 @@ in
options.plugins.telescope.extensions.media_files = {
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 {
default = null;
type = with types; nullOr (listOf str);
@ -25,7 +31,7 @@ in
extraPlugins = with pkgs.vimPlugins; [
popup-nvim
plenary-nvim
telescope-media-files-nvim
cfg.package
];
extraPackages = with pkgs; [

View file

@ -8,6 +8,13 @@ in
options = {
plugins.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 {
type = types.nullOr types.bool;
description = "Add a space b/w comment and the line";
@ -97,7 +104,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.comment-nvim ];
extraPlugins = [ cfg.package ];
extraConfigLua =
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
};

View file

@ -9,10 +9,16 @@ in
options = {
plugins.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 {
extraPlugins = [ pkgs.vimPlugins.vim-commentary ];
extraPlugins = [ cfg.package ];
};
}

View file

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

View file

@ -8,11 +8,17 @@ in
options = {
plugins.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 {
extraPlugins = with pkgs.vimPlugins; [
vim-easyescape
extraPlugins = [
cfg.package
];
};
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,6 +10,12 @@ in
options.plugins.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 {
type = with types; nullOr bool;
default = null;
@ -40,7 +46,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ defs.mark-radar ];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require("mark-radar").setup(${opts})

View file

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

View file

@ -8,6 +8,12 @@ in
options.plugins.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 {
type = types.nullOr (types.attrsOf types.str);
default = null;
@ -50,7 +56,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.nvim-autopairs ];
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options})

View file

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

View file

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

View file

@ -8,6 +8,12 @@ in
options.plugins.specs = {
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 {
type = types.bool;
default = true;
@ -137,7 +143,7 @@ in
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.specs-nvim ];
extraPlugins = [ cfg.package ];
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;

View file

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

View file

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

View file

@ -9,6 +9,12 @@ in
plugins.undotree = {
enable = mkEnableOption "Enable undotree";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.undotree;
description = "Plugin to use for undotree";
};
windowLayout = mkOption {
type = types.nullOr types.int;
default = null;
@ -108,7 +114,7 @@ in
};
config = mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.undotree ];
extraPlugins = [ cfg.package ];
globals = {
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 {
plugins.treesitter = {
enable = true;