plugins/git: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:52:32 +01:00
parent 25eed3c2f5
commit a208c7181c
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
8 changed files with 182 additions and 197 deletions

View file

@ -42,13 +42,11 @@ 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.
@ -174,9 +172,14 @@ in
mapAttrs
(
n: v:
helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' ''
The icons to use for open and closed ${n}s.
''
helpers.defaultNullOpts.mkListOf types.str
[
"${v.closed}"
"${v.opened}"
]
''
The icons to use for open and closed ${n}s.
''
)
{
hunk = {
@ -284,15 +287,13 @@ in
ignored_settings =
helpers.defaultNullOpts.mkListOf types.str
''
[
"NeogitPushPopup--force-with-lease"
"NeogitPushPopup--force"
"NeogitPullPopup--rebase"
"NeogitCommitPopup--allow-empty"
"NeogitRevertPopup--no-edit"
]
''
[
"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".
@ -303,127 +304,113 @@ in
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";
"<m-p>" = "PrevMessage";
"<m-n>" = "NextMessage";
"<m-r>" = "ResetMessage";
}
'' "Mappings for the commit editor.";
commit_editor = mkMappingOption {
q = "Close";
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
"<m-p>" = "PrevMessage";
"<m-n>" = "NextMessage";
"<m-r>" = "ResetMessage";
} "Mappings for the commit editor.";
commit_editor_I = mkMappingOption ''
{
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
'' "Mappings for the commit editor (insert mode)";
commit_editor_I = mkMappingOption {
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
} "Mappings for the commit editor (insert mode)";
rebase_editor = mkMappingOption ''
{
p = "Pick";
r = "Reword";
e = "Edit";
s = "Squash";
f = "Fixup";
x = "Execute";
d = "Drop";
b = "Break";
q = "Close";
"<cr>" = "OpenCommit";
gk = "MoveUp";
gj = "MoveDown";
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
"[c" = "OpenOrScrollUp";
"]c" = "OpenOrScrollDown";
}
'' "Mappings for the rebase editor.";
rebase_editor = mkMappingOption {
p = "Pick";
r = "Reword";
e = "Edit";
s = "Squash";
f = "Fixup";
x = "Execute";
d = "Drop";
b = "Break";
q = "Close";
"<cr>" = "OpenCommit";
gk = "MoveUp";
gj = "MoveDown";
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
"[c" = "OpenOrScrollUp";
"]c" = "OpenOrScrollDown";
} "Mappings for the rebase editor.";
rebase_editor_I = mkMappingOption ''
{
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
}
'' "Mappings for the rebase editor (insert mode).";
rebase_editor_I = mkMappingOption {
"<c-c><c-c>" = "Submit";
"<c-c><c-k>" = "Abort";
} "Mappings for the rebase editor (insert mode).";
finder = mkMappingOption ''
{
"<cr>" = "Select";
"<c-c>" = "Close";
"<esc>" = "Close";
"<c-n>" = "Next";
"<c-p>" = "Previous";
"<down>" = "Next";
"<up>" = "Previous";
"<tab>" = "MultiselectToggleNext";
"<s-tab>" = "MultiselectTogglePrevious";
"<c-j>" = "NOP";
"<ScrollWheelDown>" = "ScrollWheelDown";
"<ScrollWheelUp>" = "ScrollWheelUp";
"<ScrollWheelLeft>" = "NOP";
"<ScrollWheelRight>" = "NOP";
"<LeftMouse>" = "MouseClick";
"<2-LeftMouse>" = "NOP";
}
'' "Mappings for the finder.";
finder = mkMappingOption {
"<cr>" = "Select";
"<c-c>" = "Close";
"<esc>" = "Close";
"<c-n>" = "Next";
"<c-p>" = "Previous";
"<down>" = "Next";
"<up>" = "Previous";
"<tab>" = "MultiselectToggleNext";
"<s-tab>" = "MultiselectTogglePrevious";
"<c-j>" = "NOP";
"<ScrollWheelDown>" = "ScrollWheelDown";
"<ScrollWheelUp>" = "ScrollWheelUp";
"<ScrollWheelLeft>" = "NOP";
"<ScrollWheelRight>" = "NOP";
"<LeftMouse>" = "MouseClick";
"<2-LeftMouse>" = "NOP";
} "Mappings for the finder.";
popup = mkMappingOption ''
{
"?" = "HelpPopup";
A = "CherryPickPopup";
d = "DiffPopup";
M = "RemotePopup";
P = "PushPopup";
X = "ResetPopup";
Z = "StashPopup";
i = "IgnorePopup";
t = "TagPopup";
b = "BranchPopup";
B = "BisectPopup";
w = "WorktreePopup";
c = "CommitPopup";
f = "FetchPopup";
l = "LogPopup";
m = "MergePopup";
p = "PullPopup";
r = "RebasePopup";
v = "RevertPopup";
}
'' "Mappings for popups.";
popup = mkMappingOption {
"?" = "HelpPopup";
A = "CherryPickPopup";
d = "DiffPopup";
M = "RemotePopup";
P = "PushPopup";
X = "ResetPopup";
Z = "StashPopup";
i = "IgnorePopup";
t = "TagPopup";
b = "BranchPopup";
B = "BisectPopup";
w = "WorktreePopup";
c = "CommitPopup";
f = "FetchPopup";
l = "LogPopup";
m = "MergePopup";
p = "PullPopup";
r = "RebasePopup";
v = "RevertPopup";
} "Mappings for popups.";
status = mkMappingOption ''
{
q = "Close";
I = "InitRepo";
"1" = "Depth1";
"2" = "Depth2";
"3" = "Depth3";
"4" = "Depth4";
"<tab>" = "Toggle";
x = "Discard";
s = "Stage";
S = "StageUnstaged";
"<c-s>" = "StageAll";
u = "Unstage";
K = "Untrack";
U = "UnstageStaged";
y = "ShowRefs";
"$" = "CommandHistory";
Y = "YankSelected";
"<c-r>" = "RefreshBuffer";
"<cr>" = "GoToFile";
"<c-v>" = "VSplitOpen";
"<c-x>" = "SplitOpen";
"<c-t>" = "TabOpen";
"{" = "GoToPreviousHunkHeader";
"}" = "GoToNextHunkHeader";
"[c" = "OpenOrScrollUp";
"]c" = "OpenOrScrollDown";
}
'' "Mappings for status.";
status = mkMappingOption {
q = "Close";
I = "InitRepo";
"1" = "Depth1";
"2" = "Depth2";
"3" = "Depth3";
"4" = "Depth4";
"<tab>" = "Toggle";
x = "Discard";
s = "Stage";
S = "StageUnstaged";
"<c-s>" = "StageAll";
u = "Unstage";
K = "Untrack";
U = "UnstageStaged";
y = "ShowRefs";
"$" = "CommandHistory";
Y = "YankSelected";
"<c-r>" = "RefreshBuffer";
"<cr>" = "GoToFile";
"<c-v>" = "VSplitOpen";
"<c-x>" = "SplitOpen";
"<c-t>" = "TabOpen";
"{" = "GoToPreviousHunkHeader";
"}" = "GoToNextHunkHeader";
"[c" = "OpenOrScrollUp";
"]c" = "OpenOrScrollDown";
} "Mappings for status.";
};
notification_icon = helpers.defaultNullOpts.mkStr "󰊢" ''