treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
originalName = "committia.vim";
defaultPackage = pkgs.vimPlugins.committia-vim;
globalPrefix = "committia_";
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
maintainers = [helpers.maintainers.alisonjenkins];
maintainers = [ helpers.maintainers.alisonjenkins ];
settingsOptions = {
open_only_vim_starting = helpers.defaultNullOpts.mkBool true ''

File diff suppressed because it is too large Load diff

View file

@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
name = "fugitive";
originalName = "vim-fugitive";
defaultPackage = pkgs.vimPlugins.vim-fugitive;
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
maintainers = [lib.maintainers.GaetanLepage];
maintainers = [ lib.maintainers.GaetanLepage ];
# In typical tpope fashion, this plugin has no config options
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.git-worktree;
in {
in
{
options = {
plugins.git-worktree = {
enable = mkEnableOption "git-worktree";
@ -43,16 +45,17 @@ in {
};
};
config = let
setupOptions = with cfg; {
enabled = cfg.enable;
change_directory_command = cfg.changeDirectoryCommand;
update_on_change = cfg.updateOnChange;
update_on_change_command = cfg.updateOnChangeCommand;
clearjumps_on_change = cfg.clearJumpsOnChange;
inherit autopush;
};
in
config =
let
setupOptions = with cfg; {
enabled = cfg.enable;
change_directory_command = cfg.changeDirectoryCommand;
update_on_change = cfg.updateOnChange;
update_on_change_command = cfg.updateOnChangeCommand;
clearjumps_on_change = cfg.clearJumpsOnChange;
inherit autopush;
};
in
mkIf cfg.enable {
assertions = [
{
@ -66,17 +69,15 @@ in {
plenary-nvim
];
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
extraConfigLua = let
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
in ''
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
${
if cfg.enableTelescope
then telescopeCfg
else ""
}
'';
extraConfigLua =
let
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
in
''
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
${if cfg.enableTelescope then telescopeCfg else ""}
'';
};
}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.gitblame;
in {
in
{
options = {
plugins.gitblame = {
enable = mkEnableOption "gitblame";
@ -22,40 +24,47 @@ in {
highlightGroup = helpers.defaultNullOpts.mkStr "Comment" "The highlight group for virtual text.";
displayVirtualText = helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true) "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
displayVirtualText =
helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true)
"If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString []) "A list of filetypes for which gitblame information will not be displayed.";
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString
[ ]
) "A list of filetypes for which gitblame information will not be displayed.";
delay = helpers.defaultNullOpts.mkUnsignedInt 0 "The delay in milliseconds after which the blame info will be displayed.";
delay =
helpers.defaultNullOpts.mkUnsignedInt 0
"The delay in milliseconds after which the blame info will be displayed.";
virtualTextColumn = helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null) "Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
virtualTextColumn =
helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null)
"Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
extmarkOptions = helpers.defaultNullOpts.mkAttributeSet (toString null) "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)";
};
};
config = let
setupOptions = {
enabled = cfg.enable;
message_template = cfg.messageTemplate;
date_format = cfg.dateFormat;
message_when_not_committed = cfg.messageWhenNotCommitted;
highlight_group = cfg.highlightGroup;
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
if cfg.displayVirtualText
then 1
else 0
);
ignored_filetypes = cfg.ignoredFiletypes;
inherit (cfg) delay;
virtual_text_column = cfg.virtualTextColumn;
set_extmark_options = cfg.extmarkOptions;
};
in
config =
let
setupOptions = {
enabled = cfg.enable;
message_template = cfg.messageTemplate;
date_format = cfg.dateFormat;
message_when_not_committed = cfg.messageWhenNotCommitted;
highlight_group = cfg.highlightGroup;
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
if cfg.displayVirtualText then 1 else 0
);
ignored_filetypes = cfg.ignoredFiletypes;
inherit (cfg) delay;
virtual_text_column = cfg.virtualTextColumn;
set_extmark_options = cfg.extmarkOptions;
};
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraPackages = [pkgs.git];
extraPackages = [ pkgs.git ];
extraConfigLua = ''
require('gitblame').setup${helpers.toLuaObject setupOptions}

View file

@ -5,9 +5,11 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.gitgutter;
in {
in
{
options = {
plugins.gitgutter = {
enable = mkEnableOption "gitgutter";
@ -57,14 +59,16 @@ in {
};
signs = mkOption {
type = let
signOption = desc:
mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
};
in
type =
let
signOption =
desc:
mkOption {
type = types.nullOr types.str;
default = null;
description = "Sign for ${desc}";
};
in
types.submodule {
options = {
added = signOption "added lines";
@ -76,7 +80,7 @@ in {
modifiedRemoved = signOption "modified and removed lines";
};
};
default = {};
default = { };
description = "Custom signs for the sign column";
};
@ -99,22 +103,24 @@ in {
};
grep = mkOption {
type = types.nullOr (types.oneOf [
(types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
type = types.nullOr (
types.oneOf [
(types.submodule {
options = {
command = mkOption {
type = types.str;
description = "The command to use as a grep alternative";
};
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
package = mkOption {
type = types.package;
description = "The package of the grep alternative to use";
};
};
};
})
types.str
]);
})
types.str
]
);
default = null;
description = "A non-standard grep to use instead of the default";
};
@ -169,25 +175,20 @@ in {
};
};
config = let
grepPackage =
if builtins.isAttrs cfg.grep
then [cfg.grep.package]
else [];
grepCommand =
if builtins.isAttrs cfg.grep
then cfg.grep.command
else cfg.grep;
in
config =
let
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
opts = mkIf cfg.recommendedSettings {
updatetime = 100;
foldtext = "gitgutter#fold#foldtext";
};
extraPackages = [pkgs.git] ++ grepPackage;
extraPackages = [ pkgs.git ] ++ grepPackage;
globals = {
gitgutter_max_signs = mkIf (cfg.maxSigns != null) cfg.maxSigns;
@ -200,8 +201,12 @@ in {
gitgutter_sign_added = mkIf (cfg.signs.added != null) cfg.signs.added;
gitgutter_sign_modified = mkIf (cfg.signs.modified != null) cfg.signs.modified;
gitgutter_sign_removed = mkIf (cfg.signs.removed != null) cfg.signs.removed;
gitgutter_sign_removed_first_line = mkIf (cfg.signs.removedFirstLine != null) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (cfg.signs.removedAboveAndBelow != null) cfg.signs.removedAboveAndBelow;
gitgutter_sign_removed_first_line = mkIf (
cfg.signs.removedFirstLine != null
) cfg.signs.removedFirstLine;
gitgutter_sign_removed_above_and_bellow = mkIf (
cfg.signs.removedAboveAndBelow != null
) cfg.signs.removedAboveAndBelow;
gitgutter_sign_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";

View file

@ -8,61 +8,58 @@
with lib;
# We use `mkVimPlugin` to avoid having a `settings` option.
# Indeed, this plugin is not configurable in the common sense (no `setup` function).
helpers.vim-plugin.mkVimPlugin config {
name = "gitignore";
originalName = "gitignore.nvim";
defaultPackage = pkgs.vimPlugins.gitignore-nvim;
helpers.vim-plugin.mkVimPlugin config {
name = "gitignore";
originalName = "gitignore.nvim";
defaultPackage = pkgs.vimPlugins.gitignore-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
extraOptions = {
keymap = mkOption {
type = with types;
nullOr
(
either
str
(submodule {
options = {
key = mkOption {
type = str;
description = "The key to map.";
example = "<leader>gi";
};
mode = helpers.keymaps.mkModeOption "n";
options = helpers.keymaps.mapConfigOptions;
extraOptions = {
keymap = mkOption {
type =
with types;
nullOr (
either str (submodule {
options = {
key = mkOption {
type = str;
description = "The key to map.";
example = "<leader>gi";
};
})
);
default = null;
description = ''
Keyboard shortcut for the `gitignore.generate` command.
Can be:
- A string: which key to bind
- An attrs: if you want to customize the mode and/or the options of the keymap
(`desc`, `silent`, ...)
'';
example = "<leader>gi";
};
};
extraConfig = cfg: {
keymaps =
optional (cfg.keymap != null)
(
(
if isString cfg.keymap
then {
mode = "n";
key = cfg.keymap;
}
else cfg.keymap
)
// {
action.__raw = "require('gitignore').generate";
}
mode = helpers.keymaps.mkModeOption "n";
options = helpers.keymaps.mapConfigOptions;
};
})
);
default = null;
description = ''
Keyboard shortcut for the `gitignore.generate` command.
Can be:
- A string: which key to bind
- An attrs: if you want to customize the mode and/or the options of the keymap
(`desc`, `silent`, ...)
'';
example = "<leader>gi";
};
}
};
extraConfig = cfg: {
keymaps = optional (cfg.keymap != null) (
(
if isString cfg.keymap then
{
mode = "n";
key = cfg.keymap;
}
else
cfg.keymap
)
// {
action.__raw = "require('gitignore').generate";
}
);
};
}

View file

@ -5,22 +5,21 @@
pkgs,
...
}:
with lib; {
options.plugins.gitlinker =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "gitlinker.nvim";
with lib;
{
options.plugins.gitlinker = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "gitlinker.nvim";
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
Adds current line nr in the url for normal mode.
'';
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
Adds current line nr in the url for normal mode.
'';
actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
"copy_to_clipboard"
''
Callback for what to do with the url.
@ -35,21 +34,12 @@ with lib; {
- Raw lua code `actionCallback.__raw = "function() ... end";`.
'';
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
callbacks =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf
(
either
str
helpers.nixvimTypes.rawLua
)
)
callbacks =
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
''
{
"github.com" = "get_github_type_url";
@ -77,43 +67,42 @@ with lib; {
Learn more by reading `:h gitinker-callbacks`.
'';
};
};
config = let
cfg = config.plugins.gitlinker;
in
config =
let
cfg = config.plugins.gitlinker;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
extraConfigLua = let
setupOptions = with cfg;
{
opts = {
inherit remote;
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
action_callback =
if isString actionCallback
then helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
else actionCallback;
print_url = printUrl;
inherit mappings;
};
callbacks =
helpers.ifNonNull' callbacks
(
mapAttrs
(
extraConfigLua =
let
setupOptions =
with cfg;
{
opts = {
inherit remote;
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
action_callback =
if isString actionCallback then
helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
else
actionCallback;
print_url = printUrl;
inherit mappings;
};
callbacks = helpers.ifNonNull' callbacks (
mapAttrs (
source: callback:
if isString callback
then helpers.mkRaw "require('gitlinker.hosts').${callback}"
else callback
)
callbacks
if isString callback then helpers.mkRaw "require('gitlinker.hosts').${callback}" else callback
) callbacks
);
}
// cfg.extraOptions;
in ''
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
'';
}
// cfg.extraOptions;
in
''
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -5,8 +5,9 @@
pkgs,
...
}:
with lib; {
meta.maintainers = [maintainers.traxys];
with lib;
{
meta.maintainers = [ maintainers.traxys ];
options.plugins.gitmessenger = {
enable = mkEnableOption "gitmessenger";
@ -17,20 +18,23 @@ with lib; {
A popup window is no longer closed automatically when moving a cursor after the window is
shown up.
'';
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "current" "all"] ''
When this value is not set to "none", a popup window includes diff hunks of the commit at
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
all diff hunks in the commit.
includeDiff =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"none"
"current"
"all"
]
''
When this value is not set to "none", a popup window includes diff hunks of the commit at
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
all diff hunks in the commit.
Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this
value is set to "none".
'';
gitCommand =
helpers.defaultNullOpts.mkStr "git"
"git command to retrieve commit messages.";
noDefaultMappings =
helpers.defaultNullOpts.mkBool false
"When this value is set, it does not define any key mappings";
Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this
value is set to "none".
'';
gitCommand = helpers.defaultNullOpts.mkStr "git" "git command to retrieve commit messages.";
noDefaultMappings = helpers.defaultNullOpts.mkBool false "When this value is set, it does not define any key mappings";
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
showing a popup does not move the cursor in the window.
@ -92,11 +96,12 @@ with lib; {
'';
};
config = let
cfg = config.plugins.gitmessenger;
in
config =
let
cfg = config.plugins.gitmessenger;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraPlugins = [ cfg.package ];
globals = {
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
git_messenger_include_diff = cfg.includeDiff;

View file

@ -6,150 +6,319 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "gitsigns";
originalName = "gitsigns.nvim";
defaultPackage = pkgs.vimPlugins.gitsigns-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "gitsigns";
originalName = "gitsigns.nvim";
defaultPackage = pkgs.vimPlugins.gitsigns-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO: introduced 2024-03-12, remove on 2024-05-12
deprecateExtraOptions = true;
optionsRenamedToSettings = [
["signs" "add" "hl"]
["signs" "add" "text"]
["signs" "add" "numhl"]
["signs" "add" "linehl"]
["signs" "add" "showCount"]
["signs" "change" "hl"]
["signs" "change" "text"]
["signs" "change" "numhl"]
["signs" "change" "linehl"]
["signs" "change" "showCount"]
["signs" "topdelete" "hl"]
["signs" "topdelete" "text"]
["signs" "topdelete" "numhl"]
["signs" "topdelete" "linehl"]
["signs" "topdelete" "showCount"]
["signs" "changedelete" "hl"]
["signs" "changedelete" "text"]
["signs" "changedelete" "numhl"]
["signs" "changedelete" "linehl"]
["signs" "changedelete" "showCount"]
["signs" "untracked" "hl"]
["signs" "untracked" "text"]
["signs" "untracked" "numhl"]
["signs" "untracked" "linehl"]
["signs" "untracked" "showCount"]
"worktrees"
"signPriority"
"signcolumn"
# TODO: introduced 2024-03-12, remove on 2024-05-12
deprecateExtraOptions = true;
optionsRenamedToSettings = [
[
"signs"
"add"
"hl"
]
[
"signs"
"add"
"text"
]
[
"signs"
"add"
"numhl"
]
[
"signs"
"add"
"linehl"
"showDeleted"
["diffOpts" "algorithm"]
["diffOpts" "internal"]
["diffOpts" "indentHeuristic"]
["diffOpts" "vertical"]
["diffOpts" "linematch"]
"base"
"countChars"
"maxFileLength"
"previewConfig"
"attachToUntracked"
"updateDebounce"
"currentLineBlame"
["currentLineBlameOpts" "virtText"]
["currentLineBlameOpts" "virtTextPos"]
["currentLineBlameOpts" "delay"]
["currentLineBlameOpts" "ignoreWhitespace"]
["currentLineBlameOpts" "virtTextPriority"]
"trouble"
["yadm" "enable"]
"wordDiff"
"debugMode"
];
imports = let
basePluginPaths = ["plugins" "gitsigns"];
settingsPath = basePluginPaths ++ ["settings"];
in [
(
mkRenamedOptionModule
(basePluginPaths ++ ["onAttach" "function"])
(settingsPath ++ ["on_attach"])
]
[
"signs"
"add"
"showCount"
]
[
"signs"
"change"
"hl"
]
[
"signs"
"change"
"text"
]
[
"signs"
"change"
"numhl"
]
[
"signs"
"change"
"linehl"
]
[
"signs"
"change"
"showCount"
]
[
"signs"
"topdelete"
"hl"
]
[
"signs"
"topdelete"
"text"
]
[
"signs"
"topdelete"
"numhl"
]
[
"signs"
"topdelete"
"linehl"
]
[
"signs"
"topdelete"
"showCount"
]
[
"signs"
"changedelete"
"hl"
]
[
"signs"
"changedelete"
"text"
]
[
"signs"
"changedelete"
"numhl"
]
[
"signs"
"changedelete"
"linehl"
]
[
"signs"
"changedelete"
"showCount"
]
[
"signs"
"untracked"
"hl"
]
[
"signs"
"untracked"
"text"
]
[
"signs"
"untracked"
"numhl"
]
[
"signs"
"untracked"
"linehl"
]
[
"signs"
"untracked"
"showCount"
]
"worktrees"
"signPriority"
"signcolumn"
"numhl"
"linehl"
"showDeleted"
[
"diffOpts"
"algorithm"
]
[
"diffOpts"
"internal"
]
[
"diffOpts"
"indentHeuristic"
]
[
"diffOpts"
"vertical"
]
[
"diffOpts"
"linematch"
]
"base"
"countChars"
"maxFileLength"
"previewConfig"
"attachToUntracked"
"updateDebounce"
"currentLineBlame"
[
"currentLineBlameOpts"
"virtText"
]
[
"currentLineBlameOpts"
"virtTextPos"
]
[
"currentLineBlameOpts"
"delay"
]
[
"currentLineBlameOpts"
"ignoreWhitespace"
]
[
"currentLineBlameOpts"
"virtTextPriority"
]
"trouble"
[
"yadm"
"enable"
]
"wordDiff"
"debugMode"
];
imports =
let
basePluginPaths = [
"plugins"
"gitsigns"
];
settingsPath = basePluginPaths ++ [ "settings" ];
in
[
(mkRenamedOptionModule (
basePluginPaths
++ [
"onAttach"
"function"
]
) (settingsPath ++ [ "on_attach" ]))
(mkRenamedOptionModule
(
basePluginPaths
++ [
"watchGitDir"
"enable"
]
)
(
settingsPath
++ [
"watch_gitdir"
"enable"
]
)
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["watchGitDir" "enable"])
(settingsPath ++ ["watch_gitdir" "enable"])
)
(
mkRemovedOptionModule
(basePluginPaths ++ ["watchGitDir" "interval"])
"The option has been removed from upstream."
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["watchGitDir" "followFiles"])
(settingsPath ++ ["watch_gitdir" "follow_files"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["statusFormatter" "function"])
(settingsPath ++ ["status_formatter"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["currentLineBlameFormatter" "normal"])
(settingsPath ++ ["current_line_blame_formatter"])
)
(
mkRenamedOptionModule
(basePluginPaths ++ ["currentLineBlameFormatter" "nonCommitted"])
(settingsPath ++ ["current_line_blame_formatter_nc"])
(mkRemovedOptionModule (
basePluginPaths
++ [
"watchGitDir"
"interval"
]
) "The option has been removed from upstream.")
(mkRenamedOptionModule
(
basePluginPaths
++ [
"watchGitDir"
"followFiles"
]
)
(
settingsPath
++ [
"watch_gitdir"
"follow_files"
]
)
)
(mkRenamedOptionModule (
basePluginPaths
++ [
"statusFormatter"
"function"
]
) (settingsPath ++ [ "status_formatter" ]))
(mkRenamedOptionModule (
basePluginPaths
++ [
"currentLineBlameFormatter"
"normal"
]
) (settingsPath ++ [ "current_line_blame_formatter" ]))
(mkRenamedOptionModule (
basePluginPaths
++ [
"currentLineBlameFormatter"
"nonCommitted"
]
) (settingsPath ++ [ "current_line_blame_formatter_nc" ]))
];
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
description = ''
Which package to use for `git`.
Set to `null` to prevent the installation.
'';
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
description = ''
Which package to use for `git`.
Set to `null` to prevent the installation.
'';
};
};
settingsOptions = import ./options.nix {inherit lib helpers;};
settingsOptions = import ./options.nix { inherit lib helpers; };
settingsExample = {
signs = {
add.text = "";
change.text = "";
delete.text = "_";
topdelete.text = "";
changedelete.text = "~";
untracked.text = "";
};
signcolumn = true;
watch_gitdir.follow_files = true;
current_line_blame = false;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
settingsExample = {
signs = {
add.text = "";
change.text = "";
delete.text = "_";
topdelete.text = "";
changedelete.text = "~";
untracked.text = "";
};
signcolumn = true;
watch_gitdir.follow_files = true;
current_line_blame = false;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
};
extraConfig = cfg: {
warnings =
optional
((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
extraConfig = cfg: {
warnings =
optional ((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
''
Nixvim (plugins.gitsigns): You have enabled `plugins.gitsigns.settings.trouble` but
`plugins.trouble.enable` is `false`.
You should maybe enable the `trouble` plugin.
'';
extraPackages = [cfg.gitPackage];
};
}
extraPackages = [ cfg.gitPackage ];
};
}

View file

@ -1,83 +1,80 @@
{ lib, helpers }:
with lib;
{
lib,
helpers,
}:
with lib; {
signs = let
signOptions = defaults: {
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
Specifies the highlight group to use for the sign.
'';
signs =
let
signOptions = defaults: {
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
Specifies the highlight group to use for the sign.
'';
text = helpers.defaultNullOpts.mkStr defaults.text ''
Specifies the character to use for the sign.
'';
text = helpers.defaultNullOpts.mkStr defaults.text ''
Specifies the character to use for the sign.
'';
numhl = helpers.defaultNullOpts.mkStr defaults.numhl ''
Specifies the highlight group to use for the number column.
'';
numhl = helpers.defaultNullOpts.mkStr defaults.numhl ''
Specifies the highlight group to use for the number column.
'';
linehl = helpers.defaultNullOpts.mkStr defaults.linehl ''
Specifies the highlight group to use for the line.
'';
linehl = helpers.defaultNullOpts.mkStr defaults.linehl ''
Specifies the highlight group to use for the line.
'';
show_count = helpers.defaultNullOpts.mkBool false ''
Showing count of hunk, e.g. number of deleted lines.
'';
};
in {
add = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
change = signOptions {
hl = "GitSignsChange";
text = "";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
delete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
topdelete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
changedelete = signOptions {
hl = "GitSignsChange";
text = "~";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
untracked = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
};
worktrees = let
worktreeType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
toplevel = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
};
gitdir = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
};
show_count = helpers.defaultNullOpts.mkBool false ''
Showing count of hunk, e.g. number of deleted lines.
'';
};
in
{
add = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
change = signOptions {
hl = "GitSignsChange";
text = "";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
delete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
topdelete = signOptions {
hl = "GitSignsDelete";
text = "";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
changedelete = signOptions {
hl = "GitSignsChange";
text = "~";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
untracked = signOptions {
hl = "GitSignsAdd";
text = "";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
};
in
worktrees =
let
worktreeType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
toplevel = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
gitdir = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
};
};
in
helpers.mkNullOrOption (types.listOf worktreeType) ''
Detached working trees.
If normal attaching fails, then each entry in the table is attempted with the work tree
@ -149,57 +146,63 @@ with lib; {
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
'';
diff_opts = let
diffOptType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
algorithm =
helpers.defaultNullOpts.mkEnumFirstDefault
["myers" "minimal" "patience" "histogram"]
''
Diff algorithm to use. Values:
- "myers" the default algorithm
- "minimal" spend extra time to generate the smallest possible diff
- "patience" patience diff algorithm
- "histogram" histogram diff algorithm
diff_opts =
let
diffOptType = types.submodule {
freeformType = with types; attrsOf anything;
options = {
algorithm =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"myers"
"minimal"
"patience"
"histogram"
]
''
Diff algorithm to use. Values:
- "myers" the default algorithm
- "minimal" spend extra time to generate the smallest possible diff
- "patience" patience diff algorithm
- "histogram" histogram diff algorithm
'';
internal = helpers.defaultNullOpts.mkBool false ''
Use Neovim's built in `xdiff` library for running diffs.
'';
internal = helpers.defaultNullOpts.mkBool false ''
Use Neovim's built in `xdiff` library for running diffs.
'';
indent_heuristic = helpers.defaultNullOpts.mkBool false ''
Use the indent heuristic for the internal diff library.
'';
indent_heuristic = helpers.defaultNullOpts.mkBool false ''
Use the indent heuristic for the internal diff library.
'';
vertical = helpers.defaultNullOpts.mkBool true ''
Start diff mode with vertical splits.
'';
vertical = helpers.defaultNullOpts.mkBool true ''
Start diff mode with vertical splits.
'';
linematch = helpers.mkNullOrOption types.int ''
Enable second-stage diff on hunks to align lines.
Requires `internal=true`.
'';
linematch = helpers.mkNullOrOption types.int ''
Enable second-stage diff on hunks to align lines.
Requires `internal=true`.
'';
ignore_blank_lines = helpers.defaultNullOpts.mkBool true ''
Ignore changes where lines are blank.
'';
ignore_blank_lines = helpers.defaultNullOpts.mkBool true ''
Ignore changes where lines are blank.
'';
ignore_whitespace_change = helpers.defaultNullOpts.mkBool true ''
Ignore changes in amount of white space.
It should ignore adding trailing white space, but not leading white space.
'';
ignore_whitespace_change = helpers.defaultNullOpts.mkBool true ''
Ignore changes in amount of white space.
It should ignore adding trailing white space, but not leading white space.
'';
ignore_whitespace = helpers.defaultNullOpts.mkBool true ''
Ignore all white space changes.
'';
ignore_whitespace = helpers.defaultNullOpts.mkBool true ''
Ignore all white space changes.
'';
ignore_whitespace_change_at_eol = helpers.defaultNullOpts.mkBool true ''
Ignore white space changes at end of line.
'';
ignore_whitespace_change_at_eol = helpers.defaultNullOpts.mkBool true ''
Ignore white space changes at end of line.
'';
};
};
};
in
in
helpers.mkNullOrOption diffOptType ''
Diff options.
If set to null they are derived from the vim `diffopt`.
@ -212,49 +215,46 @@ with lib; {
count_chars =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
"__unkeyed_1" = "1";
"__unkeyed_2" = "2";
"__unkeyed_3" = "3";
"__unkeyed_4" = "4";
"__unkeyed_5" = "5";
"__unkeyed_6" = "6";
"__unkeyed_7" = "7";
"__unkeyed_8" = "8";
"__unkeyed_9" = "9";
"+" = ">";
}
''
''
The count characters used when `signs.*.show_count` is enabled.
The `+` entry is used as a fallback. With the default, any count outside of 1-9 uses the `>`
character in the sign.
''
{
"__unkeyed_1" = "1";
"__unkeyed_2" = "2";
"__unkeyed_3" = "3";
"__unkeyed_4" = "4";
"__unkeyed_5" = "5";
"__unkeyed_6" = "6";
"__unkeyed_7" = "7";
"__unkeyed_8" = "8";
"__unkeyed_9" = "9";
"+" = ">";
}
''
''
The count characters used when `signs.*.show_count` is enabled.
The `+` entry is used as a fallback. With the default, any count outside of 1-9 uses the `>`
character in the sign.
Possible use cases for this field:
- to specify unicode characters for the counts instead of 1-9.
- to define characters to be used for counts greater than 9.
'';
Possible use cases for this field:
- to specify unicode characters for the counts instead of 1-9.
- to define characters to be used for counts greater than 9.
'';
status_formatter =
helpers.defaultNullOpts.mkLuaFn
''
function(status)
local added, changed, removed = status.added, status.changed, status.removed
local status_txt = {}
if added and added > 0 then
table.insert(status_txt, '+' .. added)
end
if changed and changed > 0 then
table.insert(status_txt, '~' .. changed)
end
if removed and removed > 0 then
table.insert(status_txt, '-' .. removed)
end
return table.concat(status_txt, ' ')
status_formatter = helpers.defaultNullOpts.mkLuaFn ''
function(status)
local added, changed, removed = status.added, status.changed, status.removed
local status_txt = {}
if added and added > 0 then
table.insert(status_txt, '+' .. added)
end
''
"Function used to format `b:gitsigns_status`.";
if changed and changed > 0 then
table.insert(status_txt, '~' .. changed)
end
if removed and removed > 0 then
table.insert(status_txt, '-' .. removed)
end
return table.concat(status_txt, ' ')
end
'' "Function used to format `b:gitsigns_status`.";
max_file_length = helpers.defaultNullOpts.mkUnsignedInt 40000 ''
Max file length (in lines) to attach to.
@ -262,19 +262,19 @@ with lib; {
preview_config =
helpers.defaultNullOpts.mkAttrsOf types.anything
''
{
border = "single";
style = "minimal";
relative = "cursor";
row = 0;
col = 1;
}
''
''
Option overrides for the Gitsigns preview window.
Table is passed directly to `nvim_open_win`.
'';
''
{
border = "single";
style = "minimal";
relative = "cursor";
row = 0;
col = 1;
}
''
''
Option overrides for the Gitsigns preview window.
Table is passed directly to `nvim_open_win`.
'';
auto_attach = helpers.defaultNullOpts.mkBool true ''
Automatically attach to files.
@ -298,14 +298,21 @@ with lib; {
Whether to show a virtual text blame annotation
'';
virt_text_pos = helpers.defaultNullOpts.mkEnumFirstDefault ["eol" "overlay" "right_align"] ''
Blame annotation position.
virt_text_pos =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"eol"
"overlay"
"right_align"
]
''
Blame annotation position.
Available values:
- `eol` Right after eol character.
- `overlay` Display over the specified column, without shifting the underlying text.
- `right_align` Display right aligned in the window.
'';
Available values:
- `eol` Right after eol character.
- `overlay` Display over the specified column, without shifting the underlying text.
- `right_align` Display right aligned in the window.
'';
delay = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
Sets the delay (in milliseconds) before blame virtual text is displayed.
@ -320,90 +327,84 @@ with lib; {
'';
};
current_line_blame_formatter =
helpers.defaultNullOpts.mkStr
" <author>, <author_time> - <summary> "
''
String or function used to format the virtual text of `current_line_blame`.
current_line_blame_formatter = helpers.defaultNullOpts.mkStr " <author>, <author_time> - <summary> " ''
String or function used to format the virtual text of `current_line_blame`.
When a string, accepts the following format specifiers:
- `<abbrev_sha>`
- `<orig_lnum>`
- `<final_lnum>`
- `<author>`
- `<author_mail>`
- `<author_time>` or `<author_time:FORMAT>`
- `<author_tz>`
- `<committer>`
- `<committer_mail>`
- `<committer_time>` or `<committer_time:FORMAT>`
- `<committer_tz>`
- `<summary>`
- `<previous>`
- `<filename>`
When a string, accepts the following format specifiers:
- `<abbrev_sha>`
- `<orig_lnum>`
- `<final_lnum>`
- `<author>`
- `<author_mail>`
- `<author_time>` or `<author_time:FORMAT>`
- `<author_tz>`
- `<committer>`
- `<committer_mail>`
- `<committer_time>` or `<committer_time:FORMAT>`
- `<committer_tz>`
- `<summary>`
- `<previous>`
- `<filename>`
For `<author_time:FORMAT>` and `<committer_time:FORMAT>`, `FORMAT` can be any valid date
format that is accepted by `os.date()` with the addition of `%R` (defaults to `%Y-%m-%d`):
- `%a` abbreviated weekday name (e.g., Wed)
- `%A` full weekday name (e.g., Wednesday)
- `%b` abbreviated month name (e.g., Sep)
- `%B` full month name (e.g., September)
- `%c` date and time (e.g., 09/16/98 23:48:10)
- `%d` day of the month (16) [01-31]
- `%H` hour, using a 24-hour clock (23) [00-23]
- `%I` hour, using a 12-hour clock (11) [01-12]
- `%M` minute (48) [00-59]
- `%m` month (09) [01-12]
- `%p` either "am" or "pm" (pm)
- `%S` second (10) [00-61]
- `%w` weekday (3) [0-6 = Sunday-Saturday]
- `%x` date (e.g., 09/16/98)
- `%X` time (e.g., 23:48:10)
- `%Y` full year (1998)
- `%y` two-digit year (98) [00-99]
- `%%` the character `%´
- `%R` relative (e.g., 4 months ago)
For `<author_time:FORMAT>` and `<committer_time:FORMAT>`, `FORMAT` can be any valid date
format that is accepted by `os.date()` with the addition of `%R` (defaults to `%Y-%m-%d`):
- `%a` abbreviated weekday name (e.g., Wed)
- `%A` full weekday name (e.g., Wednesday)
- `%b` abbreviated month name (e.g., Sep)
- `%B` full month name (e.g., September)
- `%c` date and time (e.g., 09/16/98 23:48:10)
- `%d` day of the month (16) [01-31]
- `%H` hour, using a 24-hour clock (23) [00-23]
- `%I` hour, using a 12-hour clock (11) [01-12]
- `%M` minute (48) [00-59]
- `%m` month (09) [01-12]
- `%p` either "am" or "pm" (pm)
- `%S` second (10) [00-61]
- `%w` weekday (3) [0-6 = Sunday-Saturday]
- `%x` date (e.g., 09/16/98)
- `%X` time (e.g., 23:48:10)
- `%Y` full year (1998)
- `%y` two-digit year (98) [00-99]
- `%%` the character `%´
- `%R` relative (e.g., 4 months ago)
When a function:
When a function:
Parameters:
- `{name}` Git user name returned from `git config user.name`
- `{blame_info}` Table with the following keys:
- `abbrev_sha`: string
- `orig_lnum`: integer
- `final_lnum`: integer
- `author`: string
- `author_mail`: string
- `author_time`: integer
- `author_tz`: string
- `committer`: string
- `committer_mail`: string
- `committer_time`: integer
- `committer_tz`: string
- `summary`: string
- `previous`: string
- `filename`: string
- `boundary`: true?
Parameters:
- `{name}` Git user name returned from `git config user.name`
- `{blame_info}` Table with the following keys:
- `abbrev_sha`: string
- `orig_lnum`: integer
- `final_lnum`: integer
- `author`: string
- `author_mail`: string
- `author_time`: integer
- `author_tz`: string
- `committer`: string
- `committer_mail`: string
- `committer_time`: integer
- `committer_tz`: string
- `summary`: string
- `previous`: string
- `filename`: string
- `boundary`: true?
Note that the keys map onto the output of:
`git blame --line-porcelain`
Note that the keys map onto the output of:
`git blame --line-porcelain`
- {opts} Passed directly from `settings.current_line_blame_formatter_opts`.
- {opts} Passed directly from `settings.current_line_blame_formatter_opts`.
Return:
The result of this function is passed directly to the `opts.virt_text` field of
`|nvim_buf_set_extmark|` and thus must be a list of `[text, highlight]` tuples.
'';
Return:
The result of this function is passed directly to the `opts.virt_text` field of
`|nvim_buf_set_extmark|` and thus must be a list of `[text, highlight]` tuples.
'';
current_line_blame_formatter_nc =
helpers.defaultNullOpts.mkStr
" <author>"
''
String or function used to format the virtual text of `|gitsigns-config-current_line_blame|`
for lines that aren't committed.
current_line_blame_formatter_nc = helpers.defaultNullOpts.mkStr " <author>" ''
String or function used to format the virtual text of `|gitsigns-config-current_line_blame|`
for lines that aren't committed.
See `|gitsigns-config-current_line_blame_formatter|` for more information.
'';
See `|gitsigns-config-current_line_blame_formatter|` for more information.
'';
trouble = helpers.mkNullOrOption types.bool ''
When using setqflist() or setloclist(), open Trouble instead of the

View file

@ -6,87 +6,89 @@
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "lazygit";
originalName = "lazygit.nvim";
defaultPackage = pkgs.vimPlugins.lazygit-nvim;
globalPrefix = "lazygit_";
helpers.vim-plugin.mkVimPlugin config {
name = "lazygit";
originalName = "lazygit.nvim";
defaultPackage = pkgs.vimPlugins.lazygit-nvim;
globalPrefix = "lazygit_";
maintainers = [helpers.maintainers.AndresBermeoMarinelli];
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
settingsOptions = {
floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "0" ''
Set the transparency of the floating window.
'';
settingsOptions = {
floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "0" ''
Set the transparency of the floating window.
'';
floating_window_scaling_factor =
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative
"0.9" "Set the scaling factor for floating window.";
floating_window_scaling_factor =
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative "0.9"
"Set the scaling factor for floating window.";
floating_window_border_chars =
helpers.defaultNullOpts.mkListOf types.str
''["" "" "" "" "" "" "" ""]''
floating_window_border_chars =
helpers.defaultNullOpts.mkListOf types.str ''["" "" "" "" "" "" "" ""]''
"Customize lazygit popup window border characters.";
floating_window_use_plenary = helpers.defaultNullOpts.mkBool false ''
Whether to use plenary.nvim to manage floating window if available.
floating_window_use_plenary = helpers.defaultNullOpts.mkBool false ''
Whether to use plenary.nvim to manage floating window if available.
'';
use_neovim_remote = helpers.defaultNullOpts.mkBool true ''
Whether to use neovim remote. Will fallback to `false` if neovim-remote is not installed.
'';
use_custom_config_file_path = helpers.defaultNullOpts.mkBool false ''
Config file path is evaluated if this value is `true`.
'';
config_file_path = helpers.defaultNullOpts.mkNullable (
with types; either str (listOf str)
) "[]" "Custom config file path or list of custom config file paths.";
};
settingsExample = {
floating_window_winblend = 0;
floating_window_scaling_factor = 0.9;
floating_window_border_chars = [
""
""
""
""
""
""
""
""
];
floating_window_use_plenary = false;
use_neovim_remote = true;
use_custom_config_file_path = false;
config_file_path = [ ];
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
example = null;
description = ''
The `git` package to use.
Set to `null` to not install any package.
'';
};
use_neovim_remote = helpers.defaultNullOpts.mkBool true ''
Whether to use neovim remote. Will fallback to `false` if neovim-remote is not installed.
lazygitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
example = null;
description = ''
The `lazygit` package to use.
Set to `null` to not install any package.
'';
use_custom_config_file_path = helpers.defaultNullOpts.mkBool false ''
Config file path is evaluated if this value is `true`.
'';
config_file_path =
helpers.defaultNullOpts.mkNullable
(
with types;
either
str (listOf str)
)
"[]"
"Custom config file path or list of custom config file paths.";
};
};
settingsExample = {
floating_window_winblend = 0;
floating_window_scaling_factor = 0.9;
floating_window_border_chars = ["" "" "" "" "" "" "" ""];
floating_window_use_plenary = false;
use_neovim_remote = true;
use_custom_config_file_path = false;
config_file_path = [];
};
extraOptions = {
gitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.git;
example = null;
description = ''
The `git` package to use.
Set to `null` to not install any package.
'';
};
lazygitPackage = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
example = null;
description = ''
The `lazygit` package to use.
Set to `null` to not install any package.
'';
};
};
extraConfig = cfg: {
extraPackages = [
cfg.gitPackage
cfg.lazygitPackage
];
};
}
extraConfig = cfg: {
extraPackages = [
cfg.gitPackage
cfg.lazygitPackage
];
};
}

View file

@ -6,99 +6,124 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "neogit";
defaultPackage = pkgs.vimPlugins.neogit;
extraPackages = [pkgs.git];
helpers.neovim-plugin.mkNeovimPlugin config {
name = "neogit";
defaultPackage = pkgs.vimPlugins.neogit;
extraPackages = [ pkgs.git ];
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-02-29: remove 2024-04-29
deprecateExtraOptions = true;
imports =
map (
# TODO introduced 2024-02-29: remove 2024-04-29
deprecateExtraOptions = true;
imports =
map
(
optionPath:
mkRemovedOptionModule
(["plugins" "neogit"] ++ optionPath)
mkRemovedOptionModule
(
[
"plugins"
"neogit"
]
++ optionPath
)
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
)
[
["disableCommitConfirmation"]
["disableBuiltinNotifications"]
["useMagitKeybindings "]
["commitPopup"]
["sections" "unmerged"]
["sections" "unpulled"]
[ "disableCommitConfirmation" ]
[ "disableBuiltinNotifications" ]
[ "useMagitKeybindings " ]
[ "commitPopup" ]
[
"sections"
"unmerged"
]
[
"sections"
"unpulled"
]
];
optionsRenamedToSettings = [
"disableSigns"
"disableHint"
"disableContextHighlighting"
"autoRefresh"
"graphStyle"
"kind"
"signs"
"integrations"
["sections" "untracked"]
["sections" "unstaged"]
["sections" "staged"]
["sections" "stashes"]
["sections" "recent"]
"mappings"
];
optionsRenamedToSettings = [
"disableSigns"
"disableHint"
"disableContextHighlighting"
"autoRefresh"
"graphStyle"
"kind"
"signs"
"integrations"
[
"sections"
"untracked"
]
[
"sections"
"unstaged"
]
[
"sections"
"staged"
]
[
"sections"
"stashes"
]
[
"sections"
"recent"
]
"mappings"
];
settingsOptions = import ./options.nix {inherit lib helpers;};
settingsOptions = import ./options.nix { inherit lib helpers; };
settingsExample = {
kind = "floating";
commit_popup.kind = "floating";
preview_buffer.kind = "floating";
popup.kind = "floating";
integrations.diffview = false;
disable_commit_confirmation = true;
disable_builtin_notifications = true;
sections = {
untracked.folded = false;
unstaged.folded = false;
staged.folded = false;
stashes.folded = false;
unpulled.folded = false;
unmerged.folded = true;
recent.folded = true;
};
mappings = {
status = {
l = "Toggle";
a = "Stage";
};
settingsExample = {
kind = "floating";
commit_popup.kind = "floating";
preview_buffer.kind = "floating";
popup.kind = "floating";
integrations.diffview = false;
disable_commit_confirmation = true;
disable_builtin_notifications = true;
sections = {
untracked.folded = false;
unstaged.folded = false;
staged.folded = false;
stashes.folded = false;
unpulled.folded = false;
unmerged.folded = true;
recent.folded = true;
};
mappings = {
status = {
l = "Toggle";
a = "Stage";
};
};
};
extraConfig = cfg: {
assertions =
map
(
name: {
assertion = let
extraConfig = cfg: {
assertions =
map
(name: {
assertion =
let
enabled = cfg.settings.integrations.${name};
isEnabled = (isBool enabled) && enabled;
in
isEnabled
-> config.plugins.${name}.enable;
message = ''
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
'';
}
)
isEnabled -> config.plugins.${name}.enable;
message = ''
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
'';
})
[
"telescope"
"diffview"
"fzf-lua"
];
extraPackages =
optional
(hasInfix "which" (cfg.settings.commit_view.verify_commit.__raw or ""))
pkgs.which;
};
}
extraPackages = optional (hasInfix "which" (
cfg.settings.commit_view.verify_commit.__raw or ""
)) pkgs.which;
};
}

View file

@ -1,20 +1,17 @@
{ lib, helpers }:
with lib;
let
mkKindOption = helpers.defaultNullOpts.mkEnum [
"split"
"vsplit"
"split_above"
"tab"
"floating"
"replace"
"auto"
];
in
{
lib,
helpers,
}:
with lib; let
mkKindOption =
helpers.defaultNullOpts.mkEnum
[
"split"
"vsplit"
"split_above"
"tab"
"floating"
"replace"
"auto"
];
in {
filewatcher = {
interval = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
Interval between two refreshes.
@ -26,10 +23,16 @@ in {
'';
};
graph_style = helpers.defaultNullOpts.mkEnumFirstDefault ["ascii" "unicode"] ''
- "ascii" is the graph the git CLI generates
- "unicode" is the graph like https://github.com/rbong/vim-flog
'';
graph_style =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"ascii"
"unicode"
]
''
- "ascii" is the graph the git CLI generates
- "unicode" is the graph like https://github.com/rbong/vim-flog
'';
disable_hint = helpers.defaultNullOpts.mkBool false ''
Hides the hints at the top of the status buffer.
@ -43,16 +46,13 @@ in {
Disables signs for sections/items/hunks.
'';
git_services =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
"github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1";
"bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1";
"gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}";
}
''
"Used to generate URL's for branch popup action 'pull request'.";
git_services = helpers.defaultNullOpts.mkAttrsOf types.str ''
{
"github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1";
"bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1";
"gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}";
}
'' "Used to generate URL's for branch popup action 'pull request'.";
fetch_after_checkout = helpers.defaultNullOpts.mkBool false ''
Perform a fetch if the newly checked out branch has an upstream or pushRemote set.
@ -71,15 +71,13 @@ in {
'';
disable_insert_on_commit =
helpers.defaultNullOpts.mkNullable
(with types; either bool (enum ["auto"]))
"auto"
''
Changes what mode the Commit Editor starts in.
`true` will leave nvim in normal mode, `false` will change nvim to insert mode, and `"auto"`
will change nvim to insert mode IF the commit message is empty, otherwise leaving it in normal
mode.
'';
helpers.defaultNullOpts.mkNullable (with types; either bool (enum [ "auto" ])) "auto"
''
Changes what mode the Commit Editor starts in.
`true` will leave nvim in normal mode, `false` will change nvim to insert mode, and `"auto"`
will change nvim to insert mode IF the commit message is empty, otherwise leaving it in normal
mode.
'';
use_per_project_settings = helpers.defaultNullOpts.mkBool true ''
Scope persisted settings on a per-project basis.
@ -178,24 +176,26 @@ in {
signs =
mapAttrs
(n: v:
helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' ''
The icons to use for open and closed ${n}s.
'')
{
hunk = {
closed = "";
opened = "";
(
n: v:
helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' ''
The icons to use for open and closed ${n}s.
''
)
{
hunk = {
closed = "";
opened = "";
};
item = {
closed = ">";
opened = "v";
};
section = {
closed = ">";
opened = "v";
};
};
item = {
closed = ">";
opened = "v";
};
section = {
closed = ">";
opened = "v";
};
};
integrations = {
telescope = helpers.mkNullOrOption types.bool ''
@ -217,10 +217,11 @@ in {
sections =
mapAttrs
(
name: default:
(
name: default:
mkOption {
type = with types;
type =
with types;
nullOr (submodule {
options = {
folded = mkOption {
@ -237,87 +238,84 @@ in {
inherit default;
description = "Settings for the ${name} section";
}
)
{
sequencer = {
folded = false;
hidden = false;
)
{
sequencer = {
folded = false;
hidden = false;
};
untracked = {
folded = false;
hidden = false;
};
unstaged = {
folded = false;
hidden = false;
};
staged = {
folded = false;
hidden = false;
};
stashes = {
folded = true;
hidden = false;
};
unpulled_upstream = {
folded = true;
hidden = false;
};
unmerged_upstream = {
folded = false;
hidden = false;
};
unpulled_pushRemote = {
folded = true;
hidden = false;
};
unmerged_pushRemote = {
folded = false;
hidden = false;
};
recent = {
folded = true;
hidden = false;
};
rebase = {
folded = true;
hidden = false;
};
};
untracked = {
folded = false;
hidden = false;
};
unstaged = {
folded = false;
hidden = false;
};
staged = {
folded = false;
hidden = false;
};
stashes = {
folded = true;
hidden = false;
};
unpulled_upstream = {
folded = true;
hidden = false;
};
unmerged_upstream = {
folded = false;
hidden = false;
};
unpulled_pushRemote = {
folded = true;
hidden = false;
};
unmerged_pushRemote = {
folded = false;
hidden = false;
};
recent = {
folded = true;
hidden = false;
};
rebase = {
folded = true;
hidden = false;
};
};
ignored_settings =
helpers.defaultNullOpts.mkListOf types.str
''
[
"NeogitPushPopup--force-with-lease"
"NeogitPushPopup--force"
"NeogitPullPopup--rebase"
"NeogitCommitPopup--allow-empty"
"NeogitRevertPopup--no-edit"
]
''
''
Table of settings to never persist.
Uses format "Filetype--cli-value".
'';
mappings = let
mkMappingOption = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [false]));
in {
commit_editor =
mkMappingOption
''
[
"NeogitPushPopup--force-with-lease"
"NeogitPushPopup--force"
"NeogitPullPopup--rebase"
"NeogitCommitPopup--allow-empty"
"NeogitRevertPopup--no-edit"
]
''
''
Table of settings to never persist.
Uses format "Filetype--cli-value".
'';
mappings =
let
mkMappingOption = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ]));
in
{
commit_editor = mkMappingOption ''
{
q = "Close";
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
''
"Mappings for the commit editor.";
'' "Mappings for the commit editor.";
rebase_editor =
mkMappingOption
''
rebase_editor = mkMappingOption ''
{
p = "Pick";
r = "Reword";
@ -334,12 +332,9 @@ in {
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
''
"Mappings for the rebase editor.";
'' "Mappings for the rebase editor.";
finder =
mkMappingOption
''
finder = mkMappingOption ''
{
"<cr>" = "Select";
"<c-c>" = "Close";
@ -352,12 +347,9 @@ in {
"<s-tab>" = "MultiselectTogglePrevious";
"<c-j>" = "NOP";
}
''
"Mappings for the finder.";
'' "Mappings for the finder.";
popup =
mkMappingOption
''
popup = mkMappingOption ''
{
"?" = "HelpPopup";
A = "CherryPickPopup";
@ -375,12 +367,9 @@ in {
r = "RebasePopup";
v = "RevertPopup";
}
''
"Mappings for popups.";
'' "Mappings for popups.";
status =
mkMappingOption
''
status = mkMappingOption ''
{
q = "Close";
I = "InitRepo";
@ -406,9 +395,8 @@ in {
"{" = "GoToPreviousHunkHeader";
"}" = "GoToNextHunkHeader";
}
''
"Mappings for status.";
};
'' "Mappings for status.";
};
notification_icon = helpers.defaultNullOpts.mkStr "󰊢" ''
Icon for notifications.
@ -418,10 +406,9 @@ in {
Set to false if you want to be responsible for creating _ALL_ keymappings.
'';
highlight =
genAttrs ["italic" "bold" "underline"]
(
n:
helpers.defaultNullOpts.mkBool true "Set the ${n} property of the highlight group."
);
highlight = genAttrs [
"italic"
"bold"
"underline"
] (n: helpers.defaultNullOpts.mkBool true "Set the ${n} property of the highlight group.");
}