mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/git: move to by-name
This commit is contained in:
parent
d016b139fc
commit
2a91b89445
29 changed files with 0 additions and 15 deletions
59
plugins/by-name/committia/default.nix
Normal file
59
plugins/by-name/committia/default.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
helpers,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "committia";
|
||||
originalName = "committia.vim";
|
||||
package = "committia-vim";
|
||||
globalPrefix = "committia_";
|
||||
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
|
||||
settingsOptions = {
|
||||
open_only_vim_starting = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
If `0`, committia.vim always attempts to open committia's buffer when `COMMIT_EDITMSG` buffer is opened.
|
||||
If you use `vim-fugitive`, I recommend to set this value to `1`.
|
||||
'';
|
||||
|
||||
use_singlecolumn = helpers.defaultNullOpts.mkStr "always" ''
|
||||
If the value is 'always', `committia.vim` always employs single column mode.
|
||||
'';
|
||||
|
||||
min_window_width = helpers.defaultNullOpts.mkUnsignedInt 160 ''
|
||||
If the width of window is narrower than the value, `committia.vim` employs single column mode.
|
||||
'';
|
||||
|
||||
status_window_opencmd = helpers.defaultNullOpts.mkStr "belowright split" ''
|
||||
Vim command which opens a status window in multi-columns mode.
|
||||
'';
|
||||
|
||||
diff_window_opencmd = helpers.defaultNullOpts.mkStr "botright vsplit" ''
|
||||
Vim command which opens a diff window in multi-columns mode.
|
||||
'';
|
||||
|
||||
singlecolumn_diff_window_opencmd = helpers.defaultNullOpts.mkStr "belowright split" ''
|
||||
Vim command which opens a diff window in single-column mode.
|
||||
'';
|
||||
|
||||
edit_window_width = helpers.defaultNullOpts.mkUnsignedInt 80 ''
|
||||
If `committia.vim` is in multi-columns mode, specifies the width of the edit window.
|
||||
'';
|
||||
|
||||
status_window_min_height = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Minimum height of a status window.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
};
|
||||
}
|
838
plugins/by-name/diffview/default.nix
Normal file
838
plugins/by-name/diffview/default.nix
Normal file
|
@ -0,0 +1,838 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.diffview;
|
||||
mkWinConfig =
|
||||
{
|
||||
type ? null,
|
||||
width ? null,
|
||||
height ? null,
|
||||
position ? null,
|
||||
}:
|
||||
with helpers.defaultNullOpts;
|
||||
{
|
||||
type =
|
||||
mkEnum
|
||||
[
|
||||
"split"
|
||||
"float"
|
||||
]
|
||||
type
|
||||
''
|
||||
Determines whether the window should be a float or a normal
|
||||
split.
|
||||
'';
|
||||
|
||||
width = mkInt width ''
|
||||
The width of the window (in character cells). If `type` is
|
||||
`"split"` then this is only applicable when `position` is
|
||||
`"left"|"right"`.
|
||||
'';
|
||||
|
||||
height = mkInt height ''
|
||||
The height of the window (in character cells). If `type` is
|
||||
`"split"` then this is only applicable when `position` is
|
||||
`"top"|"bottom"`.
|
||||
'';
|
||||
|
||||
position =
|
||||
mkEnum
|
||||
[
|
||||
"left"
|
||||
"top"
|
||||
"right"
|
||||
"bottom"
|
||||
]
|
||||
position
|
||||
''
|
||||
Determines where the panel is positioned (only when
|
||||
`type="split"`).
|
||||
'';
|
||||
|
||||
relative =
|
||||
mkEnum
|
||||
[
|
||||
"editor"
|
||||
"win"
|
||||
]
|
||||
"editor"
|
||||
''
|
||||
Determines what the `position` is relative to (when
|
||||
`type="split"`).
|
||||
'';
|
||||
|
||||
win = mkInt 0 ''
|
||||
The window handle of the target relative window (when
|
||||
`type="split"`. Only when `relative="win"`). Use `0` for
|
||||
current window.
|
||||
'';
|
||||
|
||||
winOpts = mkAttributeSet { } ''
|
||||
Table of window local options (see |vim.opt_local|).
|
||||
These options are applied whenever the window is opened.
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.diffview =
|
||||
with helpers.defaultNullOpts;
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "diffview";
|
||||
|
||||
package = lib.mkPackageOption pkgs "diffview" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"diffview-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
iconsPackage = lib.mkPackageOption pkgs [
|
||||
"vimPlugins"
|
||||
"nvim-web-devicons"
|
||||
] { nullable = true; };
|
||||
|
||||
diffBinaries = mkBool false ''
|
||||
Show diffs for binaries
|
||||
'';
|
||||
|
||||
enhancedDiffHl = mkBool false ''
|
||||
See ':h diffview-config-enhanced_diff_hl'
|
||||
'';
|
||||
|
||||
gitCmd = mkListOf types.str [ "git" ] ''
|
||||
The git executable followed by default args.
|
||||
'';
|
||||
|
||||
hgCmd = mkListOf types.str [ "hg" ] ''
|
||||
The hg executable followed by default args.
|
||||
'';
|
||||
|
||||
useIcons = mkOption {
|
||||
type = types.bool;
|
||||
description = "Requires nvim-web-devicons";
|
||||
default = true;
|
||||
};
|
||||
|
||||
showHelpHints = mkBool true ''
|
||||
Show hints for how to open the help panel
|
||||
'';
|
||||
|
||||
watchIndex = mkBool true ''
|
||||
Update views and index buffers when the git index changes.
|
||||
'';
|
||||
|
||||
icons = {
|
||||
folderClosed = mkStr "" ''
|
||||
Only applies when use_icons is true.
|
||||
'';
|
||||
|
||||
folderOpen = mkStr "" ''
|
||||
Only applies when use_icons is true.
|
||||
'';
|
||||
};
|
||||
|
||||
signs = {
|
||||
foldClosed = mkStr "" "";
|
||||
|
||||
foldOpen = mkStr "" "";
|
||||
|
||||
done = mkStr "✓" "";
|
||||
};
|
||||
|
||||
view =
|
||||
let
|
||||
layoutsDescription = ''
|
||||
Configure the layout and behavior of different types of views.
|
||||
For more info, see ':h diffview-config-view.x.layout'.
|
||||
'';
|
||||
diff2HorizontalDescription = ''
|
||||
diff2_horizontal:
|
||||
|
||||
| A | B |
|
||||
'';
|
||||
diff2VerticalDescription = ''
|
||||
diff2_vertical:
|
||||
|
||||
|
||||
A
|
||||
|
||||
─
|
||||
|
||||
B
|
||||
'';
|
||||
in
|
||||
{
|
||||
default = {
|
||||
layout =
|
||||
mkEnum
|
||||
[
|
||||
"diff2_horizontal"
|
||||
"diff2_vertical"
|
||||
]
|
||||
"diff2_horizontal"
|
||||
''
|
||||
Config for changed files, and staged files in diff views.
|
||||
${layoutsDescription}
|
||||
- A: Old state
|
||||
- B: New state
|
||||
|
||||
${diff2HorizontalDescription}
|
||||
|
||||
${diff2VerticalDescription}
|
||||
'';
|
||||
|
||||
winbarInfo = mkBool false ''
|
||||
See ':h diffview-config-view.x.winbar_info'
|
||||
'';
|
||||
};
|
||||
|
||||
mergeTool = {
|
||||
layout =
|
||||
mkEnum
|
||||
[
|
||||
"diff1_plain"
|
||||
"diff3_horizontal"
|
||||
"diff3_vertical"
|
||||
"diff3_mixed"
|
||||
"diff4_mixed"
|
||||
]
|
||||
"diff3_horizontal"
|
||||
''
|
||||
Config for conflicted files in diff views during a merge or rebase.
|
||||
${layoutsDescription}
|
||||
- A: OURS (current branch)
|
||||
- B: LOCAL (the file as it currently exists on disk)
|
||||
- C: THEIRS (incoming branch)
|
||||
- D: BASE (common ancestor)
|
||||
|
||||
diff1_plain:
|
||||
|
||||
B
|
||||
|
||||
diff3_horizontal:
|
||||
|
||||
A | B | C
|
||||
|
||||
diff3_vertical:
|
||||
|
||||
A
|
||||
|
||||
B
|
||||
|
||||
C
|
||||
|
||||
diff3_mixed:
|
||||
|
||||
A | C
|
||||
|
||||
B
|
||||
|
||||
diff4_mixed:
|
||||
|
||||
A | D | C
|
||||
|
||||
B
|
||||
|
||||
'';
|
||||
|
||||
disableDiagnostics = mkBool true ''
|
||||
Temporarily disable diagnostics for conflict buffers while in the view.
|
||||
'';
|
||||
|
||||
winbarInfo = mkBool true ''
|
||||
See ':h diffview-config-view.x.winbar_info'
|
||||
'';
|
||||
};
|
||||
|
||||
fileHistory = {
|
||||
layout =
|
||||
mkEnum
|
||||
[
|
||||
"diff2_horizontal"
|
||||
"diff2_vertical"
|
||||
]
|
||||
"diff2_horizontal"
|
||||
''
|
||||
Config for changed files in file history views.
|
||||
${layoutsDescription}
|
||||
- A: Old state
|
||||
- B: New state
|
||||
|
||||
${diff2HorizontalDescription}
|
||||
|
||||
${diff2VerticalDescription}
|
||||
'';
|
||||
|
||||
winbarInfo = mkBool false ''
|
||||
See ':h diffview-config-view.x.winbar_info'
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
filePanel = {
|
||||
listingStyle =
|
||||
mkEnum
|
||||
[
|
||||
"list"
|
||||
"tree"
|
||||
]
|
||||
"tree"
|
||||
''
|
||||
One of 'list' or 'tree'
|
||||
'';
|
||||
|
||||
treeOptions =
|
||||
let
|
||||
commonDesc = "Only applies when listing_style is 'tree'";
|
||||
in
|
||||
{
|
||||
flattenDirs = mkBool true ''
|
||||
Flatten dirs that only contain one single dir
|
||||
${commonDesc}
|
||||
'';
|
||||
|
||||
folderStatuses =
|
||||
mkEnum
|
||||
[
|
||||
"never"
|
||||
"only_folded"
|
||||
"always"
|
||||
]
|
||||
"only_folded"
|
||||
''
|
||||
One of 'never', 'only_folded' or 'always'.
|
||||
${commonDesc}
|
||||
'';
|
||||
};
|
||||
winConfig = mkWinConfig {
|
||||
type = "split";
|
||||
width = 35;
|
||||
position = "left";
|
||||
};
|
||||
};
|
||||
fileHistoryPanel = {
|
||||
logOptions =
|
||||
let
|
||||
mkNullStr = helpers.mkNullOrOption types.str;
|
||||
mkNullBool = helpers.mkNullOrOption types.bool;
|
||||
logOptions = {
|
||||
base = mkNullStr ''
|
||||
Specify a base git rev from which the right side of the diff
|
||||
will be created. Use the special value `LOCAL` to use the
|
||||
local version of the file.
|
||||
'';
|
||||
|
||||
revRange = mkNullStr ''
|
||||
List only the commits in the specified revision range.
|
||||
'';
|
||||
|
||||
pathArgs = mkListOf types.str [ ] ''
|
||||
Limit the target files to only the files matching the given
|
||||
path arguments (git pathspec is supported).
|
||||
'';
|
||||
|
||||
follow = mkNullBool ''
|
||||
Follow renames (only for single file).
|
||||
'';
|
||||
|
||||
firstParent = mkNullBool ''
|
||||
Follow only the first parent upon seeing a merge commit.
|
||||
'';
|
||||
|
||||
showPulls = mkNullBool ''
|
||||
Show merge commits that are not TREESAME to its first parent,
|
||||
but are to a later parent.
|
||||
'';
|
||||
|
||||
reflog = mkNullBool ''
|
||||
Include all reachable objects mentioned by reflogs.
|
||||
'';
|
||||
|
||||
all = mkNullBool ''
|
||||
Include all refs.
|
||||
'';
|
||||
|
||||
merges = mkNullBool ''
|
||||
List only merge commits.
|
||||
'';
|
||||
|
||||
noMerges = mkNullBool ''
|
||||
List no merge commits.
|
||||
'';
|
||||
|
||||
reverse = mkNullBool ''
|
||||
List commits in reverse order.
|
||||
'';
|
||||
|
||||
cherryPick = mkNullBool ''
|
||||
Omit commits that introduce the same change as another commit
|
||||
on the "other side" when the set of commits are limited with
|
||||
symmetric difference.
|
||||
'';
|
||||
|
||||
leftOnly = mkNullBool ''
|
||||
List only the commits on the left side of a symmetric
|
||||
difference.
|
||||
'';
|
||||
|
||||
rightOnly = mkNullBool ''
|
||||
List only the commits on the right side of a symmetric
|
||||
difference.
|
||||
'';
|
||||
|
||||
maxCount = helpers.mkNullOrOption types.int ''
|
||||
Limit the number of commits.
|
||||
'';
|
||||
|
||||
l = mkListOf types.str [ ] ''
|
||||
`{ ("<start>,<end>:<file>" | ":<funcname>:<file>")... }`
|
||||
|
||||
Trace the evolution of the line range given by <start>,<end>,
|
||||
or by the function name regex <funcname>, within the <file>.
|
||||
'';
|
||||
|
||||
diffMerges =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"off"
|
||||
"on"
|
||||
"first-parent"
|
||||
"separate"
|
||||
"combined"
|
||||
"dense-combined"
|
||||
"remerge"
|
||||
])
|
||||
''
|
||||
Determines how merge commits are treated.
|
||||
'';
|
||||
|
||||
author = mkNullStr ''
|
||||
Limit the commits output to ones with author/committer header
|
||||
lines that match the specified pattern (regular expression).
|
||||
'';
|
||||
|
||||
grep = mkNullStr ''
|
||||
Limit the commits output to ones with log message that matches
|
||||
the specified pattern (regular expression).
|
||||
'';
|
||||
|
||||
g = mkNullStr ''
|
||||
Look for differences whose patch text contains added/removed
|
||||
lines that match the specified pattern (extended regular
|
||||
expression).
|
||||
'';
|
||||
|
||||
s = mkNullStr ''
|
||||
Look for differences that change the number of occurrences of
|
||||
the specified pattern (extended regular expression) in a
|
||||
file.
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
git = {
|
||||
singleFile = logOptions;
|
||||
|
||||
multiFile = logOptions;
|
||||
};
|
||||
hg = {
|
||||
singleFile = logOptions;
|
||||
|
||||
multiFile = logOptions;
|
||||
};
|
||||
};
|
||||
winConfig = mkWinConfig {
|
||||
type = "split";
|
||||
height = 16;
|
||||
position = "bottom";
|
||||
};
|
||||
};
|
||||
|
||||
commitLogPanel = {
|
||||
winConfig = mkWinConfig { type = "float"; };
|
||||
};
|
||||
|
||||
defaultArgs =
|
||||
let
|
||||
commonDesc = "Default args prepended to the arg-list for the listed commands";
|
||||
in
|
||||
{
|
||||
diffviewOpen = mkListOf types.str [ ] commonDesc;
|
||||
|
||||
diffviewFileHistory = mkListOf types.str [ ] commonDesc;
|
||||
};
|
||||
|
||||
hooks =
|
||||
let
|
||||
mkNullStr = helpers.mkNullOrOption types.str;
|
||||
in
|
||||
{
|
||||
viewOpened = mkNullStr ''
|
||||
{view_opened} (`fun(view: View)`)
|
||||
|
||||
Emitted after a new view has been opened. It's called after
|
||||
initializing the layout in the new tabpage (all windows are
|
||||
ready).
|
||||
|
||||
Callback Parameters:
|
||||
{view} (`View`)
|
||||
The `View` instance that was opened.
|
||||
'';
|
||||
|
||||
viewClosed = mkNullStr ''
|
||||
{view_closed} (`fun(view: View)`)
|
||||
|
||||
Emitted after closing a view.
|
||||
|
||||
Callback Parameters:
|
||||
{view} (`View`)
|
||||
The `View` instance that was closed.
|
||||
'';
|
||||
|
||||
viewEnter = mkNullStr ''
|
||||
{view_enter} (`fun(view: View)`)
|
||||
|
||||
Emitted just after entering the tabpage of a view.
|
||||
|
||||
Callback Parameters:
|
||||
{view} (`View`)
|
||||
The `View` instance that was entered.
|
||||
'';
|
||||
|
||||
viewLeave = mkNullStr ''
|
||||
{view_leave} (`fun(view: View)`)
|
||||
|
||||
Emitted just before leaving the tabpage of a view.
|
||||
|
||||
Callback Parameters:
|
||||
{view} (`View`)
|
||||
The `View` instance that's about to be left.
|
||||
'';
|
||||
|
||||
viewPostLayout = mkNullStr ''
|
||||
{view_post_layout} (`fun(view: View)`)
|
||||
|
||||
Emitted after the window layout in a view has been adjusted.
|
||||
|
||||
Callback Parameters:
|
||||
{view} (`View`)
|
||||
The `View` whose layout was adjusted.
|
||||
'';
|
||||
|
||||
diffBufRead = mkNullStr ''
|
||||
{diff_buf_read} (`fun(bufnr: integer, ctx: table)`)
|
||||
|
||||
Emitted after a new diff buffer is ready (the first time it's
|
||||
created and loaded into a window). Diff buffers are all
|
||||
buffers with |diff-mode| enabled. That includes buffers of
|
||||
local files (not created from git).
|
||||
|
||||
This is always called with the new buffer as the current
|
||||
buffer and the correct diff window as the current window such
|
||||
that |:setlocal| will apply settings to the relevant buffer /
|
||||
window.
|
||||
|
||||
Callback Parameters:
|
||||
{bufnr} (`integer`)
|
||||
The buffer number of the new buffer.
|
||||
{ctx} (`table`)
|
||||
• {symbol} (string)
|
||||
A symbol that identifies the window's position in
|
||||
the layout. These symbols correspond with the
|
||||
figures under |diffview-config-view.x.layout|.
|
||||
• {layout_name} (string)
|
||||
The name of the current layout.
|
||||
'';
|
||||
|
||||
diffBufWinEnter = mkNullStr ''
|
||||
{diff_buf_win_enter} (`fun(bufnr: integer, winid: integer, ctx: table)`)
|
||||
|
||||
Emitted after a diff buffer is displayed in a window.
|
||||
|
||||
This is always called with the new buffer as the current
|
||||
buffer and the correct diff window as the current window such
|
||||
that |:setlocal| will apply settings to the relevant buffer /
|
||||
window.
|
||||
|
||||
Callback Parameters:
|
||||
{bufnr} (`integer`)
|
||||
The buffer number of the new buffer.
|
||||
{winid} (`integer`)
|
||||
The window id of window inside which the buffer was
|
||||
displayed.
|
||||
{ctx} (`table`)
|
||||
• {symbol} (string)
|
||||
A symbol that identifies the window's position in
|
||||
the layout. These symbols correspond with the
|
||||
figures under |diffview-config-view.x.layout|.
|
||||
• {layout_name} (string)
|
||||
The name of the current layout.
|
||||
'';
|
||||
};
|
||||
|
||||
keymaps =
|
||||
let
|
||||
keymapList =
|
||||
desc:
|
||||
mkOption {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
description = "mode to bind keybinding to";
|
||||
example = "n";
|
||||
};
|
||||
key = mkOption {
|
||||
type = types.str;
|
||||
description = "key to bind keybinding to";
|
||||
example = "<tab>";
|
||||
};
|
||||
action = mkOption {
|
||||
type = types.str;
|
||||
description = "action for keybinding";
|
||||
example = "action.select_next_entry";
|
||||
};
|
||||
description = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "description for keybinding";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
List of keybindings.
|
||||
${desc}
|
||||
'';
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<tab>";
|
||||
action = "actions.select_next_entry";
|
||||
description = "Open the diff for the next file";
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
disableDefaults = mkBool false ''
|
||||
Disable the default keymaps.
|
||||
'';
|
||||
|
||||
view = keymapList ''
|
||||
The `view` bindings are active in the diff buffers, only when the current
|
||||
tabpage is a Diffview.
|
||||
'';
|
||||
|
||||
diff1 = keymapList ''
|
||||
Mappings in single window diff layouts
|
||||
'';
|
||||
|
||||
diff2 = keymapList ''
|
||||
Mappings in 2-way diff layouts
|
||||
'';
|
||||
diff3 = keymapList ''
|
||||
Mappings in 3-way diff layouts
|
||||
'';
|
||||
diff4 = keymapList ''
|
||||
Mappings in 4-way diff layouts
|
||||
'';
|
||||
filePanel = keymapList ''
|
||||
Mappings in file panel.
|
||||
'';
|
||||
fileHistoryPanel = keymapList ''
|
||||
Mappings in file history panel.
|
||||
'';
|
||||
optionPanel = keymapList ''
|
||||
Mappings in options panel.
|
||||
'';
|
||||
helpPanel = keymapList ''
|
||||
Mappings in help panel.
|
||||
'';
|
||||
};
|
||||
|
||||
disableDefaultKeymaps = mkBool false ''
|
||||
Disable the default keymaps;
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
diff_binaries = diffBinaries;
|
||||
enhanced_diff_hl = enhancedDiffHl;
|
||||
git_cmd = gitCmd;
|
||||
hg_cmd = hgCmd;
|
||||
use_icons = useIcons;
|
||||
show_help_hints = showHelpHints;
|
||||
watch_index = watchIndex;
|
||||
|
||||
icons = {
|
||||
folder_closed = icons.folderClosed;
|
||||
folder_open = icons.folderOpen;
|
||||
};
|
||||
|
||||
signs = with signs; {
|
||||
fold_closed = foldClosed;
|
||||
fold_open = foldOpen;
|
||||
inherit done;
|
||||
};
|
||||
|
||||
view = with view; {
|
||||
default = with default; {
|
||||
inherit layout;
|
||||
winbar_info = winbarInfo;
|
||||
};
|
||||
|
||||
merge_tool = with mergeTool; {
|
||||
inherit layout;
|
||||
disable_diagnostics = disableDiagnostics;
|
||||
winbar_info = winbarInfo;
|
||||
};
|
||||
|
||||
file_history = with fileHistory; {
|
||||
inherit layout;
|
||||
winbar_info = winbarInfo;
|
||||
};
|
||||
};
|
||||
|
||||
file_panel = with filePanel; {
|
||||
listing_style = listingStyle;
|
||||
|
||||
tree_options = with treeOptions; {
|
||||
flatten_dirs = flattenDirs;
|
||||
folder_statuses = folderStatuses;
|
||||
};
|
||||
|
||||
win_config = with winConfig; {
|
||||
inherit type;
|
||||
inherit width;
|
||||
inherit height;
|
||||
inherit position;
|
||||
inherit relative;
|
||||
inherit win;
|
||||
win_opts = winOpts;
|
||||
};
|
||||
};
|
||||
|
||||
file_history_panel = with fileHistoryPanel; {
|
||||
log_options =
|
||||
with logOptions;
|
||||
let
|
||||
setupLogOptions =
|
||||
opts: with opts; {
|
||||
inherit base;
|
||||
rev_range = revRange;
|
||||
path_args = pathArgs;
|
||||
inherit follow;
|
||||
first_parent = firstParent;
|
||||
show_pulls = showPulls;
|
||||
inherit reflog;
|
||||
inherit all;
|
||||
inherit merges;
|
||||
no_merges = noMerges;
|
||||
inherit reverse;
|
||||
cherry_pick = cherryPick;
|
||||
left_only = leftOnly;
|
||||
right_only = rightOnly;
|
||||
max_count = maxCount;
|
||||
L = l;
|
||||
diff_merges = diffMerges;
|
||||
inherit author;
|
||||
inherit grep;
|
||||
G = g;
|
||||
S = s;
|
||||
};
|
||||
in
|
||||
{
|
||||
git = with git; {
|
||||
single_file = setupLogOptions singleFile;
|
||||
multi_file = setupLogOptions multiFile;
|
||||
};
|
||||
|
||||
hg = with hg; {
|
||||
single_file = setupLogOptions singleFile;
|
||||
multi_file = setupLogOptions multiFile;
|
||||
};
|
||||
};
|
||||
|
||||
win_config = with winConfig; {
|
||||
inherit type;
|
||||
inherit width;
|
||||
inherit height;
|
||||
inherit position;
|
||||
inherit relative;
|
||||
inherit win;
|
||||
win_opts = winOpts;
|
||||
};
|
||||
};
|
||||
|
||||
commit_log_panel = with commitLogPanel; {
|
||||
win_config = with winConfig; {
|
||||
inherit type;
|
||||
inherit width;
|
||||
inherit height;
|
||||
inherit position;
|
||||
inherit relative;
|
||||
inherit win;
|
||||
win_opts = winOpts;
|
||||
};
|
||||
};
|
||||
|
||||
default_args = with defaultArgs; {
|
||||
DiffviewOpen = diffviewOpen;
|
||||
DiffviewFileHistory = diffviewFileHistory;
|
||||
};
|
||||
|
||||
hooks = with hooks; {
|
||||
view_opened = viewOpened;
|
||||
view_closed = viewClosed;
|
||||
view_enter = viewEnter;
|
||||
view_leave = viewLeave;
|
||||
view_post_layout = viewPostLayout;
|
||||
diff_buf_read = diffBufRead;
|
||||
diff_buf_win_enter = diffBufWinEnter;
|
||||
};
|
||||
|
||||
keymaps =
|
||||
with keymaps;
|
||||
let
|
||||
convertToKeybinding = attr: [
|
||||
attr.mode
|
||||
attr.key
|
||||
attr.action
|
||||
{ "desc" = attr.description; }
|
||||
];
|
||||
in
|
||||
{
|
||||
view = map convertToKeybinding view;
|
||||
diff1 = map convertToKeybinding diff1;
|
||||
diff2 = map convertToKeybinding diff2;
|
||||
diff3 = map convertToKeybinding diff3;
|
||||
diff4 = map convertToKeybinding diff4;
|
||||
file_panel = map convertToKeybinding filePanel;
|
||||
file_history_panel = map convertToKeybinding fileHistoryPanel;
|
||||
option_panel = map convertToKeybinding optionPanel;
|
||||
help_panel = map convertToKeybinding helpPanel;
|
||||
};
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [
|
||||
cfg.package
|
||||
] ++ (optional (cfg.iconsPackage != null && cfg.useIcons) cfg.iconsPackage);
|
||||
|
||||
extraConfigLua = ''
|
||||
require("diffview").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
24
plugins/by-name/fugitive/default.nix
Normal file
24
plugins/by-name/fugitive/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "fugitive";
|
||||
originalName = "vim-fugitive";
|
||||
package = "vim-fugitive";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# In typical tpope fashion, this plugin has no config options
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
};
|
||||
}
|
92
plugins/by-name/git-conflict/default.nix
Normal file
92
plugins/by-name/git-conflict/default.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "git-conflict";
|
||||
originalName = "git-conflict.nvim";
|
||||
package = "git-conflict-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.gitPackage ]; };
|
||||
|
||||
settingsOptions = {
|
||||
default_mappings =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either bool (attrsOf str)) true
|
||||
''
|
||||
This plugin offers default buffer local mappings inside conflicted files.
|
||||
This is primarily because applying these mappings only to relevant buffers is impossible
|
||||
through global mappings.
|
||||
|
||||
Set to `false` to disable mappings entirely.
|
||||
|
||||
Defaults (if left `true`):
|
||||
```nix
|
||||
{
|
||||
ours = "co";
|
||||
theirs = "ct";
|
||||
none = "c0";
|
||||
both = "cb";
|
||||
next = "[x";
|
||||
prev = "]x";
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
default_commands = helpers.defaultNullOpts.mkBool true ''
|
||||
Set to `false` to disable commands created by this plugin.
|
||||
'';
|
||||
|
||||
disable_diagnostics = helpers.defaultNullOpts.mkBool false ''
|
||||
This will disable the diagnostics in a buffer whilst it is conflicted.
|
||||
'';
|
||||
|
||||
list_opener = helpers.defaultNullOpts.mkStr "copen" ''
|
||||
Command or function to open the conflicts list.
|
||||
'';
|
||||
|
||||
highlights = {
|
||||
incoming = helpers.defaultNullOpts.mkStr "DiffAdd" ''
|
||||
Which highlight group to use for incoming changes.
|
||||
'';
|
||||
|
||||
current = helpers.defaultNullOpts.mkStr "DiffText" ''
|
||||
Which highlight group to use for current changes.
|
||||
'';
|
||||
|
||||
ancestor = helpers.mkNullOrStr ''
|
||||
Which highlight group to use for ancestor.
|
||||
|
||||
Plugin default: `null`
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
default_mappings = {
|
||||
ours = "o";
|
||||
theirs = "t";
|
||||
none = "0";
|
||||
both = "b";
|
||||
next = "n";
|
||||
prev = "p";
|
||||
};
|
||||
default_commands = true;
|
||||
disable_diagnostics = false;
|
||||
list_opener = "copen";
|
||||
highlights = {
|
||||
incoming = "DiffAdd";
|
||||
current = "DiffText";
|
||||
};
|
||||
};
|
||||
}
|
92
plugins/by-name/git-worktree/default.nix
Normal file
92
plugins/by-name/git-worktree/default.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.git-worktree;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.git-worktree = {
|
||||
enable = mkEnableOption "git-worktree";
|
||||
|
||||
package = lib.mkPackageOption pkgs "git-worktree" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"git-worktree-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
|
||||
enableTelescope = mkEnableOption "telescope integration";
|
||||
|
||||
changeDirectoryCommand = helpers.defaultNullOpts.mkStr "cd" ''
|
||||
The vim command used to change to the new worktree directory.
|
||||
Set this to `tcd` if you want to only change the `pwd` for the current vim Tab.
|
||||
'';
|
||||
|
||||
updateOnChange = helpers.defaultNullOpts.mkBool true ''
|
||||
If set to true updates the current buffer to point to the new work tree if the file is found in the new project.
|
||||
Otherwise, the following command will be run.
|
||||
'';
|
||||
|
||||
updateOnChangeCommand = helpers.defaultNullOpts.mkStr "e ." ''
|
||||
The vim command to run during the `update_on_change` event.
|
||||
Note, that this command will only be run when the current file is not found in the new worktree.
|
||||
This option defaults to `e .` which opens the root directory of the new worktree.
|
||||
'';
|
||||
|
||||
clearJumpsOnChange = helpers.defaultNullOpts.mkBool true ''
|
||||
If set to true every time you switch branches, your jumplist will be cleared so that you don't
|
||||
accidentally go backward to a different branch and edit the wrong files.
|
||||
'';
|
||||
|
||||
autopush = helpers.defaultNullOpts.mkBool false ''
|
||||
When creating a new worktree, it will push the branch to the upstream then perform a `git rebase`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
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 = [
|
||||
{
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''Nixvim: The git-worktree telescope integration needs telescope to function as intended'';
|
||||
}
|
||||
];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
plenary-nvim
|
||||
];
|
||||
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
|
||||
in
|
||||
''
|
||||
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
};
|
||||
}
|
137
plugins/by-name/gitblame/default.nix
Normal file
137
plugins/by-name/gitblame/default.nix
Normal file
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
types = lib.nixvim.nixvimTypes;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "gitblame";
|
||||
originalName = "git-blame.nvim";
|
||||
package = "git-blame-nvim";
|
||||
|
||||
maintainers = with lib.maintainers; [ GaetanLepage ];
|
||||
|
||||
# TODO: introduce 2024-08-03. Remove after 24.11
|
||||
optionsRenamedToSettings = [
|
||||
"messageTemplate"
|
||||
"dateFormat"
|
||||
"messageWhenNotCommitted"
|
||||
"highlightGroup"
|
||||
"extmarkOptions"
|
||||
"displayVirtualText"
|
||||
"ignoredFiletypes"
|
||||
"delay"
|
||||
"virtualTextColumn"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
enabled = defaultNullOpts.mkBool true ''
|
||||
Enables the plugin on Neovim startup.
|
||||
You can toggle git blame messages on/off with the `:GitBlameToggle` command.
|
||||
'';
|
||||
|
||||
message_template = defaultNullOpts.mkStr " <author> • <date> • <summary>" ''
|
||||
The template for the blame message that will be shown.
|
||||
|
||||
Available options: `<author>`, `<committer>`, `<date>`, `<committer-date>`, `<summary>`,
|
||||
`<sha>`.
|
||||
'';
|
||||
|
||||
date_format = defaultNullOpts.mkStr "%c" ''
|
||||
The [format](https://www.lua.org/pil/22.1.html) of the date fields in `message_template`.
|
||||
|
||||
See [upstream doc](https://github.com/f-person/git-blame.nvim?tab=readme-ov-file#date-format)
|
||||
for the available options.
|
||||
'';
|
||||
|
||||
message_when_not_committed = defaultNullOpts.mkStr " Not Committed Yet" ''
|
||||
The blame message that will be shown when the current modification hasn't been committed yet.
|
||||
|
||||
Supports the same template options as `message_template`.
|
||||
'';
|
||||
|
||||
highlight_group = defaultNullOpts.mkStr "Comment" ''
|
||||
The highlight group for virtual text.
|
||||
'';
|
||||
|
||||
set_extmark_options = defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
`nvim_buf_set_extmark` is the function used for setting the virtual text.
|
||||
You can view an up-to-date full list of options in the
|
||||
[Neovim documentation](https://neovim.io/doc/user/api.html#nvim_buf_set_extmark()).
|
||||
|
||||
**Warning:** overwriting `id` and `virt_text` will break the plugin behavior.
|
||||
'';
|
||||
|
||||
display_virtual_text = defaultNullOpts.mkBool 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.
|
||||
'';
|
||||
|
||||
ignored_filetypes = defaultNullOpts.mkListOf types.str [ ] ''
|
||||
A list of filetypes for which gitblame information will not be displayed.
|
||||
'';
|
||||
|
||||
delay = defaultNullOpts.mkUnsignedInt 250 ''
|
||||
The delay in milliseconds after which the blame info will be displayed.
|
||||
'';
|
||||
|
||||
virtual_text_column = defaultNullOpts.mkUnsignedInt 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.
|
||||
'';
|
||||
|
||||
use_blame_commit_file_urls = defaultNullOpts.mkBool false ''
|
||||
By default the commands `GitBlameOpenFileURL` and `GitBlameCopyFileURL` open the current file
|
||||
at latest branch commit.
|
||||
If you would like to open these files at the latest blame commit (in other words, the commit
|
||||
marked by the blame), set this to true.
|
||||
For ranges, the blame selected will be the most recent blame from the range.
|
||||
'';
|
||||
|
||||
schedule_event = defaultNullOpts.mkStr "CursorMoved" ''
|
||||
If you are experiencing poor performance (e.g. in particularly large projects) you can use
|
||||
`CursorHold` instead of the default `CursorMoved` autocommand to limit the frequency of events
|
||||
being run.
|
||||
'';
|
||||
|
||||
clear_event = defaultNullOpts.mkStr "CursorMovedI" ''
|
||||
If you are experiencing poor performance (e.g. in particularly large projects) you can use
|
||||
`CursorHoldI` instead of the default `CursorMovedI` autocommand to limit the frequency of
|
||||
events being run.
|
||||
'';
|
||||
|
||||
clipboard_register = defaultNullOpts.mkStr "+" ''
|
||||
By default the `:GitBlameCopySHA`, `:GitBlameCopyFileURL` and `:GitBlameCopyCommitURL`
|
||||
commands use the `+` register.
|
||||
Set this value if you would like to use a different register (such as `*`).
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
message_template = "<summary> • <date> • <author>";
|
||||
date_format = "%r";
|
||||
message_when_not_committed = "Oh please, commit this !";
|
||||
highlight_group = "Question";
|
||||
set_extmark_options.priority = 7;
|
||||
display_virtual_text = false;
|
||||
ignored_filetypes = [
|
||||
"lua"
|
||||
"c"
|
||||
];
|
||||
delay = 1000;
|
||||
virtual_text_column = 80;
|
||||
use_blame_commit_file_urls = true;
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPackages = [ cfg.gitPackage ]; };
|
||||
}
|
239
plugins/by-name/gitgutter/default.nix
Normal file
239
plugins/by-name/gitgutter/default.nix
Normal file
|
@ -0,0 +1,239 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.gitgutter;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.gitgutter = {
|
||||
enable = mkEnableOption "gitgutter";
|
||||
|
||||
package = lib.mkPackageOption pkgs "gitgutter" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"gitgutter"
|
||||
];
|
||||
};
|
||||
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
|
||||
recommendedSettings = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use recommended settings";
|
||||
};
|
||||
|
||||
maxSigns = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Maximum number of signs to show on the screen. Unlimited by default.";
|
||||
};
|
||||
|
||||
showMessageOnHunkJumping = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Show a message when jumping between hunks";
|
||||
};
|
||||
|
||||
defaultMaps = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Let gitgutter set default mappings";
|
||||
};
|
||||
|
||||
allowClobberSigns = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Don't preserve other signs on the sign column";
|
||||
};
|
||||
|
||||
signPriority = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "GitGutter's sign priority on the sign column";
|
||||
};
|
||||
|
||||
matchBackgrounds = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Make the background colors match the sign column";
|
||||
};
|
||||
|
||||
signs = mkOption {
|
||||
type =
|
||||
let
|
||||
signOption =
|
||||
desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Sign for ${desc}";
|
||||
};
|
||||
in
|
||||
types.submodule {
|
||||
options = {
|
||||
added = signOption "added lines";
|
||||
modified = signOption "modified lines";
|
||||
removed = signOption "removed lines";
|
||||
modifiedAbove = signOption "modified line above";
|
||||
removedFirstLine = signOption "a removed first line";
|
||||
removedAboveAndBelow = signOption "lines removed above and below";
|
||||
modifiedRemoved = signOption "modified and removed lines";
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Custom signs for the sign column";
|
||||
};
|
||||
|
||||
diffRelativeToWorkingTree = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Make diffs relative to the working tree instead of the index";
|
||||
};
|
||||
|
||||
extraGitArgs = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Extra arguments to pass to git";
|
||||
};
|
||||
|
||||
extraDiffArgs = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Extra arguments to pass to git diff";
|
||||
};
|
||||
|
||||
grep = mkOption {
|
||||
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";
|
||||
};
|
||||
};
|
||||
})
|
||||
types.str
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "A non-standard grep to use instead of the default";
|
||||
};
|
||||
|
||||
enableByDefault = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable gitgutter by default";
|
||||
};
|
||||
|
||||
signsByDefault = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Show signs by default";
|
||||
};
|
||||
|
||||
highlightLines = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Highlight lines by default";
|
||||
};
|
||||
|
||||
highlightLineNumbers = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Highlight line numbers by default";
|
||||
};
|
||||
|
||||
runAsync = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Disable this to run git diff syncrhonously instead of asynchronously";
|
||||
};
|
||||
|
||||
previewWinFloating = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Preview hunks on floating windows";
|
||||
};
|
||||
|
||||
useLocationList = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Load chunks into windows's location list instead of the quickfix list";
|
||||
};
|
||||
|
||||
terminalReportFocus = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Let the terminal report its focus status";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 ];
|
||||
|
||||
opts = mkIf cfg.recommendedSettings {
|
||||
updatetime = 100;
|
||||
foldtext = "gitgutter#fold#foldtext";
|
||||
};
|
||||
|
||||
extraPackages = [ cfg.gitPackage ] ++ grepPackage;
|
||||
|
||||
globals = {
|
||||
gitgutter_max_signs = mkIf (cfg.maxSigns != null) cfg.maxSigns;
|
||||
gitgutter_show_msg_on_hunk_jumping = mkIf (!cfg.showMessageOnHunkJumping) 0;
|
||||
gitgutter_map_keys = mkIf (!cfg.defaultMaps) 0;
|
||||
gitgutter_sign_allow_clobber = mkIf cfg.allowClobberSigns 1;
|
||||
gitgutter_sign_priority = mkIf (cfg.signPriority != null) cfg.signPriority;
|
||||
gitgutter_set_sign_backgrounds = mkIf cfg.matchBackgrounds 1;
|
||||
|
||||
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_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
|
||||
|
||||
gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";
|
||||
gitgutter_git_args = mkIf (cfg.extraGitArgs != "") cfg.extraGitArgs;
|
||||
gitgutter_diff_args = mkIf (cfg.extraDiffArgs != "") cfg.extraDiffArgs;
|
||||
|
||||
gitgutter_grep = mkIf (grepCommand != null) grepCommand;
|
||||
|
||||
gitgutter_enabled = mkIf (!cfg.enableByDefault) 0;
|
||||
gitgutter_signs = mkIf (!cfg.signsByDefault) 0;
|
||||
|
||||
gitgutter_highlight_lines = mkIf (!cfg.highlightLines) 0;
|
||||
gitgutter_highlight_linenrs = mkIf (!cfg.highlightLineNumbers) 0;
|
||||
gitgutter_async = mkIf (!cfg.runAsync) 0;
|
||||
gitgutter_preview_win_floating = mkIf cfg.previewWinFloating 1;
|
||||
gitgutter_use_location_list = mkIf cfg.useLocationList 1;
|
||||
|
||||
gitgutter_terminal_report_focus = mkIf (!cfg.terminalReportFocus) 0;
|
||||
};
|
||||
};
|
||||
}
|
63
plugins/by-name/gitignore/default.nix
Normal file
63
plugins/by-name/gitignore/default.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
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 {
|
||||
name = "gitignore";
|
||||
originalName = "gitignore.nvim";
|
||||
package = "gitignore-nvim";
|
||||
|
||||
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;
|
||||
};
|
||||
})
|
||||
);
|
||||
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";
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
110
plugins/by-name/gitlinker/default.nix
Normal file
110
plugins/by-name/gitlinker/default.nix
Normal file
|
@ -0,0 +1,110 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.gitlinker = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "gitlinker.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "gitlinker.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"gitlinker-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
actionCallback =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
|
||||
"copy_to_clipboard"
|
||||
''
|
||||
Callback for what to do with the url.
|
||||
|
||||
Can be
|
||||
- the name of a built-in callback. Example: `actionCallback = "copy_to_clipboard";` is
|
||||
setting
|
||||
```lua
|
||||
require('gitlinker.actions').copy_to_clipboard
|
||||
```
|
||||
in lua.
|
||||
- Raw lua code `actionCallback.__raw = "function() ... end";`.
|
||||
'';
|
||||
|
||||
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
|
||||
|
||||
callbacks =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
"github.com" = "get_github_type_url";
|
||||
"gitlab.com" = "get_gitlab_type_url";
|
||||
"try.gitea.io" = "get_gitea_type_url";
|
||||
"codeberg.org" = "get_gitea_type_url";
|
||||
"bitbucket.org" = "get_bitbucket_type_url";
|
||||
"try.gogs.io" = "get_gogs_type_url";
|
||||
"git.sr.ht" = "get_srht_type_url";
|
||||
"git.launchpad.net" = "get_launchpad_type_url";
|
||||
"repo.or.cz" = "get_repoorcz_type_url";
|
||||
"git.kernel.org" = "get_cgit_type_url";
|
||||
"git.savannah.gnu.org" = "get_cgit_type_url";
|
||||
}
|
||||
''
|
||||
Each key can be
|
||||
- the name of a built-in callback. Example: `"get_gitlab_type_url";` is setting
|
||||
```lua
|
||||
require('gitlinker.hosts').get_gitlab_type_url
|
||||
```
|
||||
in lua.
|
||||
- Raw lua code `"github.com".__raw = "function(url_data) ... end";`.
|
||||
|
||||
Learn more by reading `:h gitinker-callbacks`.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitlinker;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
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 (
|
||||
source: callback:
|
||||
if isString callback then helpers.mkRaw "require('gitlinker.hosts').${callback}" else callback
|
||||
) callbacks
|
||||
);
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
127
plugins/by-name/gitmessenger/default.nix
Normal file
127
plugins/by-name/gitmessenger/default.nix
Normal file
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
meta.maintainers = [ maintainers.traxys ];
|
||||
|
||||
options.plugins.gitmessenger = {
|
||||
enable = mkEnableOption "gitmessenger";
|
||||
|
||||
package = lib.mkPackageOption pkgs "git-messenger" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"git-messenger-vim"
|
||||
];
|
||||
};
|
||||
|
||||
closeOnCursorMoved = helpers.defaultNullOpts.mkBool true ''
|
||||
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.
|
||||
|
||||
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.
|
||||
'';
|
||||
alwaysIntoPopup = helpers.defaultNullOpts.mkBool false ''
|
||||
When this value is set to v:true, the cursor goes into a popup window when running
|
||||
:GitMessenger or <Plug>(git-messenger).
|
||||
'';
|
||||
extraBlameArgs = helpers.defaultNullOpts.mkStr "" ''
|
||||
When this variable is set the contents will be appended to the git blame command. Use it to
|
||||
add options (like -w).
|
||||
'';
|
||||
previewMods = helpers.defaultNullOpts.mkStr "" ''
|
||||
This variable is effective only when opening preview window (on Neovim (0.3.0 or earlier)
|
||||
or Vim).
|
||||
|
||||
Command modifiers for opening preview window. The value will be passed as prefix of :pedit
|
||||
command. For example, setting "botright" to the variable opens a preview window at bottom of
|
||||
the current window. Please see :help <mods> for more details.
|
||||
'';
|
||||
|
||||
maxPopupHeight = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Max lines of popup window in an integer value. Setting null means no limit.
|
||||
'';
|
||||
};
|
||||
|
||||
maxPopupWidth = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Max characters of popup window in an integer value. Setting null means no limit.
|
||||
'';
|
||||
};
|
||||
|
||||
dateFormat = helpers.defaultNullOpts.mkStr "%c" ''
|
||||
String value to format dates in popup window. Please see :help strftime() to know the details
|
||||
of the format.
|
||||
'';
|
||||
|
||||
concealWordDiffMarker = helpers.defaultNullOpts.mkBool true ''
|
||||
When this value is set to v:true, markers for word diffs like [-, -], {+, +} are concealed.
|
||||
Set false when you don't want to hide them.
|
||||
|
||||
Note: Word diff is enabled by typing "r" in a popup window.
|
||||
'';
|
||||
|
||||
floatingWinOps = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
Options passed to nvim_open_win() on opening a popup window. This is useful when you want to
|
||||
override some window options.
|
||||
'';
|
||||
|
||||
popupContentMargins = helpers.defaultNullOpts.mkBool true ''
|
||||
Setting true means adding margins in popup window. Blank lines at the top and bottom of popup
|
||||
content are inserted. And every line is indented with one whitespace character. Setting false
|
||||
to this variable removes all the margins.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitmessenger;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
globals = {
|
||||
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
|
||||
git_messenger_include_diff = cfg.includeDiff;
|
||||
git_messenger_git_command = cfg.gitCommand;
|
||||
git_messenger_no_default_mappings = cfg.noDefaultMappings;
|
||||
git_messenger_into_popup_after_show = cfg.intoPopupAfterShow;
|
||||
git_messenger_always_into_popup = cfg.alwaysIntoPopup;
|
||||
git_messenger_extra_blame_args = cfg.extraBlameArgs;
|
||||
git_messenger_preview_mods = cfg.previewMods;
|
||||
git_messenger_max_popup_height = cfg.maxPopupHeight;
|
||||
git_messenger_max_popup_width = cfg.maxPopupWidth;
|
||||
git_messenger_date_format = cfg.dateFormat;
|
||||
git_messenger_conceal_word_diff_marker = cfg.concealWordDiffMarker;
|
||||
git_messenger_floating_win_opts = cfg.floatingWinOps;
|
||||
git_messenger_popup_content_margins = cfg.popupContentMargins;
|
||||
};
|
||||
};
|
||||
}
|
280
plugins/by-name/gitsigns/default.nix
Normal file
280
plugins/by-name/gitsigns/default.nix
Normal file
|
@ -0,0 +1,280 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "gitsigns";
|
||||
originalName = "gitsigns.nvim";
|
||||
package = "gitsigns-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO: introduced 2024-03-12, remove on 2024-05-12
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"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"
|
||||
"wordDiff"
|
||||
"debugMode"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPaths = [
|
||||
"plugins"
|
||||
"gitsigns"
|
||||
];
|
||||
settingsPath = basePluginPaths ++ [ "settings" ];
|
||||
|
||||
highlights = {
|
||||
add = "Add";
|
||||
change = "Change";
|
||||
delete = "Delete";
|
||||
topdelete = "Topdelete";
|
||||
changedelete = "Changedelete";
|
||||
untracked = "Untracked";
|
||||
};
|
||||
|
||||
subHighlights = {
|
||||
hl = "";
|
||||
linehl = "Ln";
|
||||
numhl = "Nr";
|
||||
};
|
||||
|
||||
highlightRemovals = flatten (
|
||||
mapAttrsToList (
|
||||
opt: hlg:
|
||||
mapAttrsToList (subOpt: subHlg: {
|
||||
optionPath = settingsPath ++ [
|
||||
"signs"
|
||||
opt
|
||||
subOpt
|
||||
];
|
||||
hlg = "GitSigns${hlg}${subHlg}";
|
||||
}) subHighlights
|
||||
) highlights
|
||||
);
|
||||
in
|
||||
(map (
|
||||
{ optionPath, hlg }:
|
||||
helpers.mkDeprecatedSubOptionModule optionPath "Please define the `${hlg}` highlight group instead."
|
||||
) highlightRemovals)
|
||||
++ [
|
||||
(mkRenamedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"onAttach"
|
||||
"function"
|
||||
]
|
||||
) (settingsPath ++ [ "on_attach" ]))
|
||||
(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" ]))
|
||||
(helpers.mkDeprecatedSubOptionModule (
|
||||
settingsPath
|
||||
++ [
|
||||
"yadm"
|
||||
"enable"
|
||||
]
|
||||
) "yadm support was removed upstream.")
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
417
plugins/by-name/gitsigns/options.nix
Normal file
417
plugins/by-name/gitsigns/options.nix
Normal file
|
@ -0,0 +1,417 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
signs =
|
||||
let
|
||||
signOptions = defaults: {
|
||||
text = helpers.defaultNullOpts.mkStr defaults.text ''
|
||||
Specifies the character to use for the sign.
|
||||
'';
|
||||
|
||||
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;
|
||||
description = ''
|
||||
Path to the top-level of the parent git repository.
|
||||
'';
|
||||
};
|
||||
|
||||
gitdir = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = ''
|
||||
Path to the git directory of the parent git repository (typically the `.git/` directory).
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
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
|
||||
details set.
|
||||
'';
|
||||
|
||||
on_attach = helpers.mkNullOrLuaFn ''
|
||||
Callback called when attaching to a buffer. Mainly used to setup keymaps
|
||||
when `config.keymaps` is empty. The buffer number is passed as the first
|
||||
argument.
|
||||
|
||||
This callback can return `false` to prevent attaching to the buffer.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(bufnr)
|
||||
if vim.api.nvim_buf_get_name(bufnr):match(<PATTERN>) then
|
||||
-- Don't attach to specific buffers whose name matches a pattern
|
||||
return false
|
||||
end
|
||||
-- Setup keymaps
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'hs', '<cmd>lua require"gitsigns".stage_hunk()<CR>', {})
|
||||
... -- More keymaps
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
watch_gitdir = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
When opening a file, a `libuv` watcher is placed on the respective `.git` directory to detect
|
||||
when changes happen to use as a trigger to update signs.
|
||||
'';
|
||||
|
||||
follow_files = helpers.defaultNullOpts.mkBool true ''
|
||||
If a file is moved with `git mv`, switch the buffer to the new location.
|
||||
'';
|
||||
};
|
||||
|
||||
sign_priority = helpers.defaultNullOpts.mkUnsignedInt 6 ''
|
||||
Priority to use for signs.
|
||||
'';
|
||||
|
||||
signcolumn = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable/disable symbols in the sign column.
|
||||
|
||||
When enabled the highlights defined in `signs.*.hl` and symbols defined in `signs.*.text` are
|
||||
used.
|
||||
'';
|
||||
|
||||
numhl = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable/disable line number highlights.
|
||||
|
||||
When enabled the highlights defined in `signs.*.numhl` are used.
|
||||
If the highlight group does not exist, then it is automatically defined and linked to the
|
||||
corresponding highlight group in `signs.*.hl`.
|
||||
'';
|
||||
|
||||
linehl = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable/disable line highlights.
|
||||
|
||||
When enabled the highlights defined in `signs.*.linehl` are used.
|
||||
If the highlight group does not exist, then it is automatically defined and linked to the
|
||||
corresponding highlight group in `signs.*.hl`.
|
||||
'';
|
||||
|
||||
show_deleted = helpers.defaultNullOpts.mkBool false ''
|
||||
Show the old version of hunks inline in the buffer (via virtual lines).
|
||||
|
||||
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
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
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`.
|
||||
'';
|
||||
|
||||
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 = 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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.mkNullOrOption diffOptType ''
|
||||
Diff options.
|
||||
If set to null they are derived from the vim `diffopt`.
|
||||
'';
|
||||
|
||||
base = helpers.mkNullOrOption types.str ''
|
||||
The object/revision to diff against.
|
||||
See `|gitsigns-revision|`.
|
||||
'';
|
||||
|
||||
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.
|
||||
|
||||
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, ' ')
|
||||
end
|
||||
'' "Function used to format `b:gitsigns_status`.";
|
||||
|
||||
max_file_length = helpers.defaultNullOpts.mkUnsignedInt 40000 ''
|
||||
Max file length (in lines) to attach to.
|
||||
'';
|
||||
|
||||
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`.
|
||||
'';
|
||||
|
||||
auto_attach = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically attach to files.
|
||||
'';
|
||||
|
||||
attach_to_untracked = helpers.defaultNullOpts.mkBool true ''
|
||||
Attach to untracked files.
|
||||
'';
|
||||
|
||||
update_debounce = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
Debounce time for updates (in milliseconds).
|
||||
'';
|
||||
|
||||
current_line_blame = helpers.defaultNullOpts.mkBool false ''
|
||||
Adds an unobtrusive and customisable blame annotation at the end of the current line.
|
||||
The highlight group used for the text is `GitSignsCurrentLineBlame`.
|
||||
'';
|
||||
|
||||
current_line_blame_opts = {
|
||||
virt_text = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show a virtual text blame annotation
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
delay = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
|
||||
Sets the delay (in milliseconds) before blame virtual text is displayed.
|
||||
'';
|
||||
|
||||
ignore_whitespace = helpers.defaultNullOpts.mkBool false ''
|
||||
Ignore whitespace when running blame.
|
||||
'';
|
||||
|
||||
virt_text_priority = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
Priority of virtual text.
|
||||
'';
|
||||
};
|
||||
|
||||
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>`
|
||||
|
||||
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:
|
||||
|
||||
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`
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
quickfix/location list window.
|
||||
|
||||
Default: `pcall(require, 'trouble')`
|
||||
'';
|
||||
|
||||
word_diff = helpers.defaultNullOpts.mkBool false ''
|
||||
Highlight intra-line word differences in the buffer.
|
||||
Requires `config.diff_opts.internal = true`.
|
||||
'';
|
||||
|
||||
debug_mode = helpers.defaultNullOpts.mkBool false ''
|
||||
Enables debug logging and makes the following functions available: `dump_cache`,
|
||||
`debug_messages`, `clear_debug`.
|
||||
'';
|
||||
}
|
88
plugins/by-name/lazygit/default.nix
Normal file
88
plugins/by-name/lazygit/default.nix
Normal file
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "lazygit";
|
||||
originalName = "lazygit.nvim";
|
||||
package = "lazygit-nvim";
|
||||
globalPrefix = "lazygit_";
|
||||
|
||||
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
|
||||
|
||||
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_border_chars = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"╭"
|
||||
"─"
|
||||
"╮"
|
||||
"│"
|
||||
"╯"
|
||||
"─"
|
||||
"╰"
|
||||
"│"
|
||||
] "Customize lazygit popup window border characters.";
|
||||
|
||||
floating_window_use_plenary = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Whether to use plenary.nvim to manage floating window if available.
|
||||
'';
|
||||
|
||||
use_neovim_remote = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Whether to use neovim remote. Will fallback to `0` if neovim-remote is not installed.
|
||||
'';
|
||||
|
||||
use_custom_config_file_path = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Config file path is evaluated if this value is `1`.
|
||||
'';
|
||||
|
||||
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 = 0;
|
||||
use_neovim_remote = 1;
|
||||
use_custom_config_file_path = 0;
|
||||
config_file_path = [ ];
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
|
||||
lazygitPackage = lib.mkPackageOption pkgs "lazygit" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPackages = [
|
||||
cfg.gitPackage
|
||||
cfg.lazygitPackage
|
||||
];
|
||||
};
|
||||
}
|
134
plugins/by-name/neogit/default.nix
Normal file
134
plugins/by-name/neogit/default.nix
Normal file
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "neogit";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-29: remove 2024-04-29
|
||||
deprecateExtraOptions = true;
|
||||
imports =
|
||||
map
|
||||
(
|
||||
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"
|
||||
]
|
||||
];
|
||||
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; };
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
gitPackage = lib.mkPackageOption pkgs "git" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
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`.
|
||||
'';
|
||||
})
|
||||
[
|
||||
"telescope"
|
||||
"diffview"
|
||||
"fzf-lua"
|
||||
];
|
||||
|
||||
extraPackages = [
|
||||
cfg.gitPackage
|
||||
] ++ optional (hasInfix "which" (cfg.settings.commit_view.verify_commit.__raw or "")) pkgs.which;
|
||||
|
||||
};
|
||||
}
|
429
plugins/by-name/neogit/options.nix
Normal file
429
plugins/by-name/neogit/options.nix
Normal file
|
@ -0,0 +1,429 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
let
|
||||
mkKindOption = helpers.defaultNullOpts.mkEnum [
|
||||
"split"
|
||||
"vsplit"
|
||||
"split_above"
|
||||
"tab"
|
||||
"floating"
|
||||
"replace"
|
||||
"auto"
|
||||
];
|
||||
in
|
||||
{
|
||||
filewatcher = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
When enabled, will watch the `.git/` directory for changes and refresh the status buffer
|
||||
in response to filesystem events.
|
||||
'';
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
disable_context_highlighting = helpers.defaultNullOpts.mkBool false ''
|
||||
Disables changing the buffer highlights based on where the cursor is.
|
||||
'';
|
||||
|
||||
disable_signs = helpers.defaultNullOpts.mkBool false ''
|
||||
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'.";
|
||||
|
||||
fetch_after_checkout = helpers.defaultNullOpts.mkBool false ''
|
||||
Perform a fetch if the newly checked out branch has an upstream or pushRemote set.
|
||||
'';
|
||||
|
||||
telescope_sorter = helpers.mkNullOrLuaFn ''
|
||||
Allows a different telescope sorter.
|
||||
Defaults to 'fuzzy_with_index_bias'.
|
||||
The example below will use the native fzf sorter instead.
|
||||
By default, this function returns `nil`.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
require("telescope").extensions.fzf.native_fzf_sorter
|
||||
```
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
use_per_project_settings = helpers.defaultNullOpts.mkBool true ''
|
||||
Scope persisted settings on a per-project basis.
|
||||
'';
|
||||
|
||||
remember_settings = helpers.defaultNullOpts.mkBool true ''
|
||||
Persist the values of switches/options within and across sessions.
|
||||
'';
|
||||
|
||||
auto_refresh = helpers.defaultNullOpts.mkBool true ''
|
||||
Neogit refreshes its internal state after specific events, which can be expensive depending on
|
||||
the repository size.
|
||||
Disabling `auto_refresh` will make it so you have to manually refresh the status after you open
|
||||
it.
|
||||
'';
|
||||
|
||||
sort_branches = helpers.defaultNullOpts.mkStr "-committerdate" ''
|
||||
Value used for `--sort` option for `git branch` command.
|
||||
By default, branches will be sorted by commit date descending.
|
||||
Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt
|
||||
Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options
|
||||
'';
|
||||
|
||||
kind = mkKindOption "tab" ''
|
||||
Change the default way of opening neogit.
|
||||
'';
|
||||
|
||||
disable_line_numbers = helpers.defaultNullOpts.mkBool true ''
|
||||
Disable line numbers and relative line numbers.
|
||||
'';
|
||||
|
||||
console_timeout = helpers.defaultNullOpts.mkUnsignedInt 2000 ''
|
||||
The time after which an output console is shown for slow running commands.
|
||||
'';
|
||||
|
||||
auto_show_console = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically show console if a command takes more than `consoleTimeout` milliseconds.
|
||||
'';
|
||||
|
||||
status = {
|
||||
recent_commit_count = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
||||
Recent commit count in the status buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
commit_editor = {
|
||||
kind = mkKindOption "auto" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
commit_select_view = {
|
||||
kind = mkKindOption "tab" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
commit_view = {
|
||||
kind = mkKindOption "vsplit" "The type of window that should be opened.";
|
||||
|
||||
verify_commit = helpers.mkNullOrStrLuaOr types.bool ''
|
||||
Show commit signature information in the buffer.
|
||||
Can be set to true or false, otherwise we try to find the binary.
|
||||
|
||||
Default: "os.execute('which gpg') == 0"
|
||||
'';
|
||||
};
|
||||
|
||||
log_view = {
|
||||
kind = mkKindOption "tab" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
rebase_editor = {
|
||||
kind = mkKindOption "auto" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
reflog_view = {
|
||||
kind = mkKindOption "tab" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
merge_editor = {
|
||||
kind = mkKindOption "auto" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
description_editor = {
|
||||
kind = mkKindOption "auto" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
tag_editor = {
|
||||
kind = mkKindOption "auto" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
preview_buffer = {
|
||||
kind = mkKindOption "split" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
popup = {
|
||||
kind = mkKindOption "split" "The type of window that should be opened.";
|
||||
};
|
||||
|
||||
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 = "";
|
||||
};
|
||||
item = {
|
||||
closed = ">";
|
||||
opened = "v";
|
||||
};
|
||||
section = {
|
||||
closed = ">";
|
||||
opened = "v";
|
||||
};
|
||||
};
|
||||
|
||||
integrations = {
|
||||
telescope = helpers.mkNullOrOption types.bool ''
|
||||
If enabled, use telescope for menu selection rather than `vim.ui.select`.
|
||||
Allows multi-select and some things that `vim.ui.select` doesn't.
|
||||
'';
|
||||
|
||||
diffview = helpers.mkNullOrOption types.bool ''
|
||||
Neogit only provides inline diffs.
|
||||
If you want a more traditional way to look at diffs, you can use `diffview`.
|
||||
The diffview integration enables the diff popup.
|
||||
'';
|
||||
|
||||
fzf-lua = helpers.mkNullOrOption types.bool ''
|
||||
If enabled, uses fzf-lua for menu selection.
|
||||
If the telescope integration is also selected then telescope is used instead.
|
||||
'';
|
||||
};
|
||||
|
||||
sections =
|
||||
mapAttrs
|
||||
(
|
||||
name: default:
|
||||
mkOption {
|
||||
type =
|
||||
with types;
|
||||
nullOr (submodule {
|
||||
options = {
|
||||
folded = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether or not this section should be open or closed by default.";
|
||||
};
|
||||
|
||||
hidden = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether or not this section should be shown.";
|
||||
};
|
||||
};
|
||||
});
|
||||
inherit default;
|
||||
description = "Settings for the ${name} section";
|
||||
}
|
||||
)
|
||||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
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 {
|
||||
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)";
|
||||
|
||||
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).";
|
||||
|
||||
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.";
|
||||
|
||||
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 "" ''
|
||||
Icon for notifications.
|
||||
'';
|
||||
|
||||
use_default_keymaps = helpers.defaultNullOpts.mkBool true ''
|
||||
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.");
|
||||
}
|
178
plugins/by-name/octo/default.nix
Normal file
178
plugins/by-name/octo/default.nix
Normal file
|
@ -0,0 +1,178 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "octo";
|
||||
originalName = "octo.nvim";
|
||||
package = "octo-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.svl ];
|
||||
|
||||
extraPackages = [ pkgs.gh ];
|
||||
|
||||
settingsOptions = {
|
||||
use_local_fs = helpers.defaultNullOpts.mkBool false ''
|
||||
Use local files on right side of reviews.
|
||||
'';
|
||||
|
||||
enable_builtin = helpers.defaultNullOpts.mkBool false ''
|
||||
Shows a list of builtin actions when no action is provided.
|
||||
'';
|
||||
|
||||
default_remote =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"upstream"
|
||||
"origin"
|
||||
]
|
||||
''
|
||||
Order to try remotes
|
||||
'';
|
||||
|
||||
ssh_aliases = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
|
||||
SSH aliases.
|
||||
'';
|
||||
|
||||
picker_config = {
|
||||
use_emojis = helpers.defaultNullOpts.mkBool false ''
|
||||
Use emojis in picker. Only used by "fzf-lua" picker for now.
|
||||
'';
|
||||
|
||||
mappings =
|
||||
let
|
||||
mkMappingOption = lhs: desc: {
|
||||
lhs = helpers.defaultNullOpts.mkStr lhs ''
|
||||
Key to map.
|
||||
'';
|
||||
|
||||
desc = helpers.defaultNullOpts.mkStr desc ''
|
||||
Description of the mapping.
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
open_in_browser = mkMappingOption "<C-b>" ''
|
||||
Open issue in browser.
|
||||
'';
|
||||
|
||||
copy_url = mkMappingOption "<C-y>" ''
|
||||
Copy url to system clipboard.
|
||||
'';
|
||||
|
||||
checkout_pr = mkMappingOption "<C-o>" ''
|
||||
Checkout pull request.
|
||||
'';
|
||||
|
||||
merge_pr = mkMappingOption "<C-r>" ''
|
||||
Merge pull request.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
reaction_viewer_hint_icon = helpers.defaultNullOpts.mkStr "" ''
|
||||
Marker for user reactions.
|
||||
'';
|
||||
|
||||
user_icon = helpers.defaultNullOpts.mkStr " " ''
|
||||
User Icon.
|
||||
'';
|
||||
|
||||
timeline_marker = helpers.defaultNullOpts.mkStr "" ''
|
||||
Timeline marker.
|
||||
'';
|
||||
|
||||
timeline_indent = helpers.defaultNullOpts.mkStr "2" ''
|
||||
Timeline indentation.
|
||||
'';
|
||||
|
||||
right_bubble_delimiter = helpers.defaultNullOpts.mkStr "" ''
|
||||
Bubble delimiter.
|
||||
'';
|
||||
|
||||
left_bubble_delimiter = helpers.defaultNullOpts.mkStr "" ''
|
||||
Bubble delimiter.
|
||||
'';
|
||||
|
||||
github_hostname = helpers.defaultNullOpts.mkStr "" ''
|
||||
Github Enterprise host.
|
||||
'';
|
||||
|
||||
snippet_context_lines = helpers.defaultNullOpts.mkInt 4 ''
|
||||
Number of lines around commented lines.
|
||||
'';
|
||||
|
||||
gh_env = helpers.defaultNullOpts.mkAttributeSet { } ''
|
||||
Extra environment variables to pass on to GitHub CLI, can be a table or function returning a table.
|
||||
'';
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkInt 5000 ''
|
||||
Timeout for requests between the remote server.
|
||||
'';
|
||||
|
||||
ui = {
|
||||
use_sign_column = helpers.defaultNullOpts.mkBool true ''
|
||||
Show "modified" marks on the sign column.
|
||||
'';
|
||||
};
|
||||
|
||||
picker =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"telescope"
|
||||
"fzf-lua"
|
||||
]
|
||||
''
|
||||
Picker to use.
|
||||
'';
|
||||
|
||||
issues = {
|
||||
order_by = {
|
||||
field =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"CREATED_AT"
|
||||
"COMMENTS"
|
||||
"UPDATED_AT"
|
||||
]
|
||||
''
|
||||
See GitHub's [`IssueOrderField`](https://docs.github.com/en/graphql/reference/enums#issueorderfield) documentation.
|
||||
'';
|
||||
direction =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"DESC"
|
||||
"ASC"
|
||||
]
|
||||
''
|
||||
See GitHub's [`OrderDirection`](https://docs.github.com/en/graphql/reference/enums#orderdirection) documentation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
ssh_aliases = {
|
||||
"github.com-work" = "github.com";
|
||||
};
|
||||
|
||||
# options not defined
|
||||
mappings_disable_default = true;
|
||||
mappings = {
|
||||
issue.react_heart = "<leader>rh";
|
||||
file_panel.select_prev_entry = "[q";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig =
|
||||
cfg:
|
||||
mkMerge [
|
||||
(mkIf (cfg.settings.picker == null || cfg.settings.picker == "telescope") {
|
||||
plugins.telescope.enable = mkDefault true;
|
||||
})
|
||||
(mkIf (cfg.settings.picker == "fzf-lua") { plugins.fzf-lua.enable = mkDefault true; })
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue