mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 09:18:38 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -5,22 +5,21 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.gitlinker =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "gitlinker.nvim";
|
||||
with lib;
|
||||
{
|
||||
options.plugins.gitlinker = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "gitlinker.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
|
||||
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
|
||||
|
||||
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
|
||||
remote = helpers.mkNullOrOption types.str "Force the use of a specific remote.";
|
||||
|
||||
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
|
||||
Adds current line nr in the url for normal mode.
|
||||
'';
|
||||
addCurrentLineOnNormalMode = helpers.defaultNullOpts.mkBool true ''
|
||||
Adds current line nr in the url for normal mode.
|
||||
'';
|
||||
|
||||
actionCallback =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
|
||||
actionCallback =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
|
||||
"copy_to_clipboard"
|
||||
''
|
||||
Callback for what to do with the url.
|
||||
|
@ -35,21 +34,12 @@ with lib; {
|
|||
- Raw lua code `actionCallback.__raw = "function() ... end";`.
|
||||
'';
|
||||
|
||||
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
|
||||
printUrl = helpers.defaultNullOpts.mkBool true "Print the url after performing the action.";
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
|
||||
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
|
||||
|
||||
callbacks =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
attrsOf
|
||||
(
|
||||
either
|
||||
str
|
||||
helpers.nixvimTypes.rawLua
|
||||
)
|
||||
)
|
||||
callbacks =
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
"github.com" = "get_github_type_url";
|
||||
|
@ -77,43 +67,42 @@ with lib; {
|
|||
|
||||
Learn more by reading `:h gitinker-callbacks`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.plugins.gitlinker;
|
||||
in
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitlinker;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
opts = {
|
||||
inherit remote;
|
||||
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
|
||||
action_callback =
|
||||
if isString actionCallback
|
||||
then helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
|
||||
else actionCallback;
|
||||
print_url = printUrl;
|
||||
inherit mappings;
|
||||
};
|
||||
callbacks =
|
||||
helpers.ifNonNull' callbacks
|
||||
(
|
||||
mapAttrs
|
||||
(
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
opts = {
|
||||
inherit remote;
|
||||
add_current_line_on_normal_mode = addCurrentLineOnNormalMode;
|
||||
action_callback =
|
||||
if isString actionCallback then
|
||||
helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
|
||||
else
|
||||
actionCallback;
|
||||
print_url = printUrl;
|
||||
inherit mappings;
|
||||
};
|
||||
callbacks = helpers.ifNonNull' callbacks (
|
||||
mapAttrs (
|
||||
source: callback:
|
||||
if isString callback
|
||||
then helpers.mkRaw "require('gitlinker.hosts').${callback}"
|
||||
else callback
|
||||
)
|
||||
callbacks
|
||||
if isString callback then helpers.mkRaw "require('gitlinker.hosts').${callback}" else callback
|
||||
) callbacks
|
||||
);
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue