mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
13
default.nix
13
default.nix
|
@ -1,14 +1,11 @@
|
|||
(
|
||||
import
|
||||
(
|
||||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
url =
|
||||
lock.nodes.flake-compat.locked.url
|
||||
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{src = ./.;}
|
||||
)
|
||||
.defaultNix
|
||||
) { src = ./.; }).defaultNix
|
||||
|
|
|
@ -2,15 +2,16 @@
|
|||
rawModules,
|
||||
helpers,
|
||||
pkgs,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
pkgsDoc =
|
||||
import (pkgs.applyPatches {
|
||||
import
|
||||
(pkgs.applyPatches {
|
||||
name = "nixpkgs-nixvim-doc";
|
||||
src = pkgs.path;
|
||||
patches = [
|
||||
./either_recursive.patch
|
||||
];
|
||||
}) {
|
||||
patches = [ ./either_recursive.patch ];
|
||||
})
|
||||
{
|
||||
inherit (pkgs) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
@ -24,21 +25,21 @@
|
|||
name = "<${repo}/${subpath}>";
|
||||
};
|
||||
|
||||
transformOptions = opt:
|
||||
transformOptions =
|
||||
opt:
|
||||
opt
|
||||
// {
|
||||
declarations =
|
||||
map (
|
||||
declarations = map (
|
||||
decl:
|
||||
if lib.hasPrefix nixvimPath (toString decl)
|
||||
then
|
||||
gitHubDeclaration "nix-community" "nixvim" "main"
|
||||
(lib.removePrefix "/" (lib.removePrefix nixvimPath (toString decl)))
|
||||
else if decl == "lib/modules.nix"
|
||||
then gitHubDeclaration "NixOS" "nixpkgs" "master" decl
|
||||
else decl
|
||||
if lib.hasPrefix nixvimPath (toString decl) then
|
||||
gitHubDeclaration "nix-community" "nixvim" "main" (
|
||||
lib.removePrefix "/" (lib.removePrefix nixvimPath (toString decl))
|
||||
)
|
||||
opt.declarations;
|
||||
else if decl == "lib/modules.nix" then
|
||||
gitHubDeclaration "NixOS" "nixpkgs" "master" decl
|
||||
else
|
||||
decl
|
||||
) opt.declarations;
|
||||
};
|
||||
|
||||
nixvmConfigType = lib.mkOptionType {
|
||||
|
@ -48,8 +49,7 @@
|
|||
# Evaluation is irrelevant, only used for documentation.
|
||||
};
|
||||
|
||||
topLevelModules =
|
||||
[
|
||||
topLevelModules = [
|
||||
../wrappers/modules/output.nix
|
||||
# Fake module to avoid a duplicated documentation
|
||||
(lib.setDefaultModuleLocation "${nixvimPath}/wrappers/modules/files.nix" {
|
||||
|
@ -67,23 +67,15 @@
|
|||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
++ (rawModules pkgsDoc);
|
||||
] ++ (rawModules pkgsDoc);
|
||||
|
||||
hmOptions =
|
||||
builtins.removeAttrs
|
||||
(lib.evalModules {
|
||||
modules = [
|
||||
(import ../wrappers/modules/hm.nix {inherit lib;})
|
||||
];
|
||||
})
|
||||
.options
|
||||
["_module"];
|
||||
hmOptions = builtins.removeAttrs (lib.evalModules {
|
||||
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
||||
}).options [ "_module" ];
|
||||
in
|
||||
rec {
|
||||
options-json =
|
||||
(pkgsDoc.nixosOptionsDoc
|
||||
{
|
||||
(pkgsDoc.nixosOptionsDoc {
|
||||
inherit
|
||||
(lib.evalModules {
|
||||
modules = topLevelModules;
|
||||
|
@ -93,8 +85,7 @@ in
|
|||
;
|
||||
inherit transformOptions;
|
||||
warningsAreErrors = false;
|
||||
})
|
||||
.optionsJSON;
|
||||
}).optionsJSON;
|
||||
man-docs = pkgsDoc.callPackage ./man { inherit options-json; };
|
||||
}
|
||||
# Do not check if documentation builds fine on darwin as it fails:
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
installShellFiles,
|
||||
nixos-render-docs,
|
||||
pandoc,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
manualFilter = ''
|
||||
local text = pandoc.text
|
||||
|
||||
|
@ -23,13 +24,16 @@
|
|||
end
|
||||
'';
|
||||
|
||||
manHeader = let
|
||||
manHeader =
|
||||
let
|
||||
mkMDSection = file: "<(pandoc --lua-filter <(echo \"$manualFilter\") -f gfm -t man ${file})";
|
||||
in
|
||||
runCommand "nixvim-general-doc-manpage" {
|
||||
runCommand "nixvim-general-doc-manpage"
|
||||
{
|
||||
nativeBuildInputs = [ pandoc ];
|
||||
inherit manualFilter;
|
||||
} ''
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
cat \
|
||||
${./nixvim-header-start.5} \
|
||||
|
@ -38,11 +42,16 @@
|
|||
${./nixvim-header-end.5} \
|
||||
>$out/nixvim-header.5
|
||||
'';
|
||||
# FIXME add platform specific docs to manpage
|
||||
in
|
||||
runCommand "nixvim-configuration-reference-manpage" {
|
||||
nativeBuildInputs = [installShellFiles nixos-render-docs];
|
||||
} ''
|
||||
# FIXME add platform specific docs to manpage
|
||||
runCommand "nixvim-configuration-reference-manpage"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
nixos-render-docs
|
||||
];
|
||||
}
|
||||
''
|
||||
# Generate man-pages
|
||||
mkdir -p $out/share/man/man5
|
||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||
|
|
|
@ -7,22 +7,26 @@
|
|||
transformOptions,
|
||||
hmOptions,
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
options = lib.evalModules {
|
||||
inherit modules;
|
||||
specialArgs = {inherit pkgs lib helpers;};
|
||||
specialArgs = {
|
||||
inherit pkgs lib helpers;
|
||||
};
|
||||
};
|
||||
|
||||
inherit (options.config.meta) nixvimInfo;
|
||||
|
||||
mkMDDoc = options:
|
||||
mkMDDoc =
|
||||
options:
|
||||
(nixosOptionsDoc {
|
||||
inherit options transformOptions;
|
||||
warningsAreErrors = false;
|
||||
})
|
||||
.optionsCommonMark;
|
||||
}).optionsCommonMark;
|
||||
|
||||
removeUnwanted = attrs:
|
||||
removeUnwanted =
|
||||
attrs:
|
||||
builtins.removeAttrs attrs [
|
||||
"_module"
|
||||
"_freeformOptions"
|
||||
|
@ -35,20 +39,19 @@ with lib; let
|
|||
|
||||
getSubOptions = opts: path: removeUnwanted (opts.type.getSubOptions path);
|
||||
|
||||
isVisible = opts:
|
||||
if isOption opts
|
||||
then attrByPath ["visible"] true opts
|
||||
else if opts.isOption
|
||||
then attrByPath ["index" "options" "visible"] true opts
|
||||
else let
|
||||
filterFunc =
|
||||
filterAttrs
|
||||
(
|
||||
_: v:
|
||||
if isAttrs v
|
||||
then isVisible v
|
||||
else true
|
||||
);
|
||||
isVisible =
|
||||
opts:
|
||||
if isOption opts then
|
||||
attrByPath [ "visible" ] true opts
|
||||
else if opts.isOption then
|
||||
attrByPath [
|
||||
"index"
|
||||
"options"
|
||||
"visible"
|
||||
] true opts
|
||||
else
|
||||
let
|
||||
filterFunc = filterAttrs (_: v: if isAttrs v then isVisible v else true);
|
||||
|
||||
hasEmptyIndex = (filterFunc opts.index.options) == { };
|
||||
hasEmptyComponents = (filterFunc opts.components) == { };
|
||||
|
@ -58,13 +61,14 @@ with lib; let
|
|||
wrapModule = path: opts: isOpt: rec {
|
||||
index = {
|
||||
options =
|
||||
if isOpt
|
||||
then opts
|
||||
else filterAttrs (_: component: component.isOption && (isVisible component)) opts;
|
||||
if isOpt then
|
||||
opts
|
||||
else
|
||||
filterAttrs (_: component: component.isOption && (isVisible component)) opts;
|
||||
path = removeWhitespace (concatStringsSep "/" path);
|
||||
moduleDoc =
|
||||
if builtins.length path >= 2 && lib.hasAttrByPath path nixvimInfo
|
||||
then let
|
||||
if builtins.length path >= 2 && lib.hasAttrByPath path nixvimInfo then
|
||||
let
|
||||
info = lib.getAttrFromPath path nixvimInfo;
|
||||
maintainers = lib.unique (options.config.meta.maintainers.${info.file} or [ ]);
|
||||
maintainersNames = builtins.map (m: m.name) maintainers;
|
||||
|
@ -72,34 +76,40 @@ with lib; let
|
|||
"# ${lib.last path}\n\n"
|
||||
+ (lib.optionalString (info.description != null) "${info.description}\n\n")
|
||||
+ (lib.optionalString (info.url != null) "**Url:** [${info.url}](${info.url})\n\n")
|
||||
+ (lib.optionalString (builtins.length maintainers > 0)
|
||||
"**Maintainers:** ${lib.concatStringsSep ", " maintainersNames}\n\n")
|
||||
else null;
|
||||
+ (lib.optionalString (
|
||||
builtins.length maintainers > 0
|
||||
) "**Maintainers:** ${lib.concatStringsSep ", " maintainersNames}\n\n")
|
||||
else
|
||||
null;
|
||||
};
|
||||
|
||||
components =
|
||||
if isOpt
|
||||
then {}
|
||||
else filterAttrs (_: component: !component.isOption && (isVisible component)) opts;
|
||||
if isOpt then
|
||||
{ }
|
||||
else
|
||||
filterAttrs (_: component: !component.isOption && (isVisible component)) opts;
|
||||
|
||||
hasComponents = components != { };
|
||||
|
||||
isOption = isOpt;
|
||||
};
|
||||
|
||||
processModulesRec = modules: let
|
||||
recurse = path: mods: let
|
||||
g = name: opts:
|
||||
if !isOption opts
|
||||
then wrapModule (path ++ [name]) (recurse (path ++ [name]) opts) false
|
||||
else let
|
||||
processModulesRec =
|
||||
modules:
|
||||
let
|
||||
recurse =
|
||||
path: mods:
|
||||
let
|
||||
g =
|
||||
name: opts:
|
||||
if !isOption opts then
|
||||
wrapModule (path ++ [ name ]) (recurse (path ++ [ name ]) opts) false
|
||||
else
|
||||
let
|
||||
subOpts = getSubOptions opts (path ++ [ name ]);
|
||||
in
|
||||
if subOpts != {}
|
||||
then
|
||||
wrapModule
|
||||
(path ++ [name])
|
||||
(
|
||||
if subOpts != { } then
|
||||
wrapModule (path ++ [ name ]) (
|
||||
(recurse (path ++ [ name ]) subOpts)
|
||||
// {
|
||||
# This is necessary to include the submodule option's definition in the docs (description, type, etc.)
|
||||
|
@ -110,23 +120,19 @@ with lib; let
|
|||
type.getSubOptions = _: _: { }; # Used to exclude suboptions from the submodule definition itself
|
||||
};
|
||||
}
|
||||
)
|
||||
false
|
||||
else wrapModule (path ++ [name]) opts true;
|
||||
) false
|
||||
else
|
||||
wrapModule (path ++ [ name ]) opts true;
|
||||
in
|
||||
mapAttrs g mods;
|
||||
in
|
||||
foldlAttrs
|
||||
(
|
||||
acc: name: opts: let
|
||||
group =
|
||||
if !opts.hasComponents
|
||||
then "Neovim Options"
|
||||
else "none";
|
||||
foldlAttrs (
|
||||
acc: name: opts:
|
||||
let
|
||||
group = if !opts.hasComponents then "Neovim Options" else "none";
|
||||
|
||||
last =
|
||||
acc.${group}
|
||||
or {
|
||||
acc.${group} or {
|
||||
index = {
|
||||
options = { };
|
||||
path = removeWhitespace "${group}";
|
||||
|
@ -142,19 +148,12 @@ with lib; let
|
|||
acc
|
||||
// {
|
||||
${group} = recursiveUpdate last {
|
||||
index.options = optionalAttrs isOpt {
|
||||
${name} = opts.index.options;
|
||||
};
|
||||
index.options = optionalAttrs isOpt { ${name} = opts.index.options; };
|
||||
|
||||
components = optionalAttrs (!isOpt) {
|
||||
${name} = recursiveUpdate opts {
|
||||
index.path =
|
||||
removeWhitespace
|
||||
(
|
||||
concatStringsSep "/"
|
||||
(
|
||||
(optional (group != "none") group) ++ [opts.index.path]
|
||||
)
|
||||
index.path = removeWhitespace (
|
||||
concatStringsSep "/" ((optional (group != "none") group) ++ [ opts.index.path ])
|
||||
);
|
||||
hasComponents = true;
|
||||
};
|
||||
|
@ -163,21 +162,22 @@ with lib; let
|
|||
hasComponents = last.components != { };
|
||||
};
|
||||
}
|
||||
)
|
||||
{}
|
||||
(recurse [] modules);
|
||||
) { } (recurse [ ] modules);
|
||||
|
||||
mapModulesToString = f: modules: let
|
||||
recurse = mods: let
|
||||
g = name: opts:
|
||||
if (opts ? "isGroup")
|
||||
then
|
||||
if name != "none"
|
||||
then (f name opts) + ("\n" + recurse opts.components)
|
||||
else recurse opts.components
|
||||
else if opts.hasComponents
|
||||
then (f name opts) + ("\n" + recurse opts.components)
|
||||
else f name opts;
|
||||
mapModulesToString =
|
||||
f: modules:
|
||||
let
|
||||
recurse =
|
||||
mods:
|
||||
let
|
||||
g =
|
||||
name: opts:
|
||||
if (opts ? "isGroup") then
|
||||
if name != "none" then (f name opts) + ("\n" + recurse opts.components) else recurse opts.components
|
||||
else if opts.hasComponents then
|
||||
(f name opts) + ("\n" + recurse opts.components)
|
||||
else
|
||||
f name opts;
|
||||
in
|
||||
concatStringsSep "\n" (mapAttrsToList g mods);
|
||||
in
|
||||
|
@ -185,24 +185,16 @@ with lib; let
|
|||
|
||||
docs = rec {
|
||||
modules = processModulesRec (removeUnwanted options.options);
|
||||
commands =
|
||||
mapModulesToString
|
||||
(
|
||||
name: opts: let
|
||||
isBranch =
|
||||
if (hasSuffix "index" opts.index.path)
|
||||
then true
|
||||
else opts.hasComponents;
|
||||
path =
|
||||
if isBranch
|
||||
then "${opts.index.path}/index.md"
|
||||
else "${opts.index.path}.md";
|
||||
commands = mapModulesToString (
|
||||
name: opts:
|
||||
let
|
||||
isBranch = if (hasSuffix "index" opts.index.path) then true else opts.hasComponents;
|
||||
path = if isBranch then "${opts.index.path}/index.md" else "${opts.index.path}.md";
|
||||
in
|
||||
(optionalString isBranch
|
||||
"mkdir -p ${opts.index.path}\n")
|
||||
(optionalString isBranch "mkdir -p ${opts.index.path}\n")
|
||||
+ (
|
||||
if opts.index.moduleDoc == null
|
||||
then "cp ${mkMDDoc opts.index.options} ${path}"
|
||||
if opts.index.moduleDoc == null then
|
||||
"cp ${mkMDDoc opts.index.options} ${path}"
|
||||
else
|
||||
# Including moduleDoc's text directly will result in bash interpreting special chars,
|
||||
# write it to the nix store and `cat` the file instead.
|
||||
|
@ -213,33 +205,29 @@ with lib; let
|
|||
} > ${path}
|
||||
''
|
||||
)
|
||||
)
|
||||
modules;
|
||||
) modules;
|
||||
};
|
||||
|
||||
mdbook = {
|
||||
nixvimOptions =
|
||||
mapModulesToString
|
||||
(
|
||||
name: opts: let
|
||||
isBranch =
|
||||
if name == "index"
|
||||
then true
|
||||
else opts.hasComponents && opts.index.options != {};
|
||||
nixvimOptions = mapModulesToString (
|
||||
name: opts:
|
||||
let
|
||||
isBranch = if name == "index" then true else opts.hasComponents && opts.index.options != { };
|
||||
|
||||
path =
|
||||
if isBranch
|
||||
then "${opts.index.path}/index.md"
|
||||
else if !opts.hasComponents
|
||||
then "${opts.index.path}.md"
|
||||
else "";
|
||||
if isBranch then
|
||||
"${opts.index.path}/index.md"
|
||||
else if !opts.hasComponents then
|
||||
"${opts.index.path}.md"
|
||||
else
|
||||
"";
|
||||
|
||||
indentLevel = with builtins; length (filter isString (split "/" opts.index.path)) - 1;
|
||||
|
||||
padding = concatStrings (builtins.genList (_: "\t") indentLevel);
|
||||
in "${padding}- [${name}](${path})"
|
||||
)
|
||||
docs.modules;
|
||||
in
|
||||
"${padding}- [${name}](${path})"
|
||||
) docs.modules;
|
||||
};
|
||||
|
||||
prepareMD = ''
|
||||
|
@ -268,7 +256,11 @@ in
|
|||
phases = [ "buildPhase" ];
|
||||
|
||||
buildInputs = [ pkgs.mdbook ];
|
||||
inputs = sourceFilesBySuffices ./. [".md" ".toml" ".js"];
|
||||
inputs = sourceFilesBySuffices ./. [
|
||||
".md"
|
||||
".toml"
|
||||
".js"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
dest=$out/share/doc
|
||||
|
|
15
example.nix
15
example.nix
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
# This just enables NixVim.
|
||||
# If all you have is this, then there will be little visible difference
|
||||
|
@ -60,8 +61,16 @@
|
|||
# This is one of lightline's example configurations
|
||||
active = {
|
||||
left = [
|
||||
["mode" "paste"]
|
||||
["readonly" "filename" "modified" "helloworld"]
|
||||
[
|
||||
"mode"
|
||||
"paste"
|
||||
]
|
||||
[
|
||||
"readonly"
|
||||
"filename"
|
||||
"modified"
|
||||
"helloworld"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{inputs, ...}: {
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./dev
|
||||
./helpers.nix
|
||||
|
@ -12,11 +13,9 @@
|
|||
./wrappers.nix
|
||||
];
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
perSystem =
|
||||
{ pkgs, system, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
pkgsUnfree = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
{ inputs, ... }: {
|
||||
imports = [ inputs.pre-commit-hooks.flakeModule ./devshell.nix ];
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
./devshell.nix
|
||||
];
|
||||
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
|
||||
pre-commit = {
|
||||
|
@ -12,8 +18,7 @@
|
|||
};
|
||||
statix = {
|
||||
enable = true;
|
||||
excludes =
|
||||
[ "plugins/lsp/language-servers/rust-analyzer-config.nix" ];
|
||||
excludes = [ "plugins/lsp/language-servers/rust-analyzer-config.nix" ];
|
||||
};
|
||||
typos.enable = true;
|
||||
};
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
];
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.devshell.flakeModule ];
|
||||
|
||||
perSystem = {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
devshells.default = {
|
||||
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
|
||||
|
||||
commands = let
|
||||
commands =
|
||||
let
|
||||
# Thanks to this, the user can choose to use `nix-output-monitor` (`nom`) instead of plain `nix`
|
||||
nix = "$([ '$\{NIXVIM_NOM:-0}' = '1' ] && echo ${pkgs.lib.getExe pkgs.nom} || echo nix)";
|
||||
in [
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "checks";
|
||||
help = "Run all nixvim checks";
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{getHelpers, ...}: {
|
||||
_module.args.getHelpers = pkgs: _nixvimTests:
|
||||
{ getHelpers, ... }:
|
||||
{
|
||||
_module.args.getHelpers =
|
||||
pkgs: _nixvimTests:
|
||||
import ../lib/helpers.nix {
|
||||
inherit pkgs _nixvimTests;
|
||||
inherit (pkgs) lib;
|
||||
};
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
perSystem =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
_module.args.helpers = getHelpers pkgs false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
{
|
||||
perSystem = {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
legacyPackages = rec {
|
||||
inherit makeNixvimWithModule;
|
||||
makeNixvim = configuration:
|
||||
makeNixvim =
|
||||
configuration:
|
||||
makeNixvimWithModule {
|
||||
module = {
|
||||
config = configuration;
|
||||
|
|
|
@ -3,14 +3,11 @@
|
|||
lib,
|
||||
withSystem,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
flake.lib = lib.genAttrs config.systems (
|
||||
lib.flip withSystem (
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{ pkgs, config, ... }:
|
||||
import ../lib {
|
||||
inherit pkgs lib;
|
||||
inherit (config.legacyPackages) makeNixvim makeNixvimWithModule;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{modules, ...}: {
|
||||
{ modules, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
modules = pkgs: let
|
||||
modules =
|
||||
pkgs:
|
||||
let
|
||||
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix";
|
||||
|
||||
nixvimExtraArgsModule = rec {
|
||||
|
@ -13,12 +16,15 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
in [
|
||||
in
|
||||
[
|
||||
../modules
|
||||
nixpkgsMaintainersList
|
||||
nixvimExtraArgsModule
|
||||
({lib, ...}:
|
||||
with lib; {
|
||||
(
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
# Attribute may contain the following fields:
|
||||
# - name: Name of the module
|
||||
# - kind: Either colorschemes or plugins
|
||||
|
@ -29,9 +35,7 @@
|
|||
#
|
||||
# We need to use an attrs instead of a submodule to handle the merge.
|
||||
options.meta.nixvimInfo = mkOption {
|
||||
type =
|
||||
(types.nullOr types.attrs)
|
||||
// {
|
||||
type = (types.nullOr types.attrs) // {
|
||||
# This will create an attrset of the form:
|
||||
# {
|
||||
# "path"."to"."plugin" = { "<name>" = <info>; };
|
||||
|
@ -43,14 +47,19 @@
|
|||
# description = null or "<DESCRIPTION>";
|
||||
# url = null or "<URL>";
|
||||
# }
|
||||
merge = _: defs:
|
||||
lib.foldl' (acc: def:
|
||||
merge =
|
||||
_: defs:
|
||||
lib.foldl'
|
||||
(
|
||||
acc: def:
|
||||
lib.recursiveUpdate acc {
|
||||
"${def.value.kind}"."${def.value.name}" = {
|
||||
inherit (def.value) url description;
|
||||
inherit (def) file;
|
||||
};
|
||||
}) {
|
||||
}
|
||||
)
|
||||
{
|
||||
plugins = { };
|
||||
colorschemes = { };
|
||||
}
|
||||
|
@ -62,15 +71,14 @@
|
|||
Nixvim related information on the module
|
||||
'';
|
||||
};
|
||||
})
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
perSystem =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
modules = modules pkgs;
|
||||
rawModules = modules;
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.easyOverlay
|
||||
];
|
||||
perSystem = {
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
|
||||
perSystem =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
final,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
overlayAttrs = {
|
||||
nixvim = {
|
||||
inherit
|
||||
(config.legacyPackages)
|
||||
makeNixvim
|
||||
makeNixvimWithModule
|
||||
;
|
||||
inherit (config.legacyPackages) makeNixvim makeNixvimWithModule;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
perSystem = {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
rawModules,
|
||||
helpers,
|
||||
...
|
||||
}: {
|
||||
packages = import ../docs {
|
||||
inherit rawModules pkgs helpers;
|
||||
};
|
||||
}:
|
||||
{
|
||||
packages = import ../docs { inherit rawModules pkgs helpers; };
|
||||
|
||||
# Test that all packages build fine when running `nix flake check`.
|
||||
checks = config.packages;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
self,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
flake.templates = {
|
||||
default = {
|
||||
path = ../templates/simple;
|
||||
|
@ -12,20 +9,25 @@
|
|||
|
||||
# The following adds the template flake's checks to the main (current) flake's checks.
|
||||
# It ensures that the template's own checks are successful.
|
||||
perSystem = {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
checks = let
|
||||
}:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
# Approximates https://github.com/NixOS/nix/blob/7cd08ae379746749506f2e33c3baeb49b58299b8/src/libexpr/flake/call-flake.nix#L46
|
||||
# s/flake.outputs/args.outputs/
|
||||
callFlake = args @ {
|
||||
callFlake =
|
||||
args@{
|
||||
inputs,
|
||||
outputs,
|
||||
sourceInfo,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
outputs = args.outputs (inputs // { self = result; });
|
||||
result =
|
||||
outputs
|
||||
|
@ -49,12 +51,6 @@
|
|||
|
||||
templateChecks = templateFlakeOutputs.checks.${system};
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(
|
||||
checkName: check: {
|
||||
"template-${checkName}" = check;
|
||||
}
|
||||
)
|
||||
templateChecks;
|
||||
lib.concatMapAttrs (checkName: check: { "template-${checkName}" = check; }) templateChecks;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{self, ...}: {
|
||||
perSystem = {
|
||||
{ self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
|
@ -7,12 +9,14 @@
|
|||
makeNixvimWithModuleUnfree,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
checks = {
|
||||
tests = import ../tests {
|
||||
inherit pkgs helpers makeNixvimWithModule;
|
||||
inherit (pkgs) lib;
|
||||
makeNixvim = configuration:
|
||||
makeNixvim =
|
||||
configuration:
|
||||
makeNixvimWithModuleUnfree {
|
||||
module = {
|
||||
config = configuration;
|
||||
|
@ -25,9 +29,7 @@
|
|||
inherit makeNixvimWithModule;
|
||||
};
|
||||
|
||||
extend = import ../tests/extend.nix {
|
||||
inherit pkgs makeNixvimWithModule;
|
||||
};
|
||||
extend = import ../tests/extend.nix { inherit pkgs makeNixvimWithModule; };
|
||||
|
||||
enable-except-in-tests = import ../tests/enable-except-in-tests.nix {
|
||||
inherit pkgs makeNixvimWithModule;
|
||||
|
|
|
@ -4,30 +4,28 @@
|
|||
getHelpers,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
wrapperArgs = {
|
||||
inherit modules;
|
||||
inherit self;
|
||||
inherit getHelpers;
|
||||
};
|
||||
in {
|
||||
perSystem = {
|
||||
in
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
system,
|
||||
pkgs,
|
||||
pkgsUnfree,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
_module.args = {
|
||||
makeNixvimWithModule =
|
||||
import ../wrappers/standalone.nix
|
||||
pkgs
|
||||
wrapperArgs;
|
||||
makeNixvimWithModule = import ../wrappers/standalone.nix pkgs wrapperArgs;
|
||||
|
||||
makeNixvimWithModuleUnfree =
|
||||
import ../wrappers/standalone.nix
|
||||
pkgsUnfree
|
||||
wrapperArgs;
|
||||
makeNixvimWithModuleUnfree = import ../wrappers/standalone.nix pkgsUnfree wrapperArgs;
|
||||
};
|
||||
|
||||
checks =
|
||||
|
@ -37,8 +35,7 @@ in {
|
|||
inherit pkgs;
|
||||
inherit (inputs) home-manager;
|
||||
nixvim = self;
|
||||
})
|
||||
.activationPackage;
|
||||
}).activationPackage;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
|
||||
nixos-module =
|
||||
|
@ -46,11 +43,7 @@ in {
|
|||
inherit system;
|
||||
inherit (inputs) nixpkgs;
|
||||
nixvim = self;
|
||||
})
|
||||
.config
|
||||
.system
|
||||
.build
|
||||
.toplevel;
|
||||
}).config.system.build.toplevel;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
darwin-module =
|
||||
|
@ -58,8 +51,7 @@ in {
|
|||
inherit system;
|
||||
inherit (inputs) nix-darwin;
|
||||
nixvim = self;
|
||||
})
|
||||
.system;
|
||||
}).system;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
nixvimOptions,
|
||||
nixvimTypes,
|
||||
}:
|
||||
with lib; rec {
|
||||
with lib;
|
||||
rec {
|
||||
autoGroupOption = types.submodule {
|
||||
options = {
|
||||
clear = mkOption {
|
||||
|
@ -75,7 +76,5 @@ with lib; rec {
|
|||
nested = nixvimOptions.defaultNullOpts.mkBool false "Run nested autocommands.";
|
||||
};
|
||||
|
||||
autoCmdOption = types.submodule {
|
||||
options = autoCmdOptions;
|
||||
};
|
||||
autoCmdOption = types.submodule { options = autoCmdOptions; };
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ lib, pkgs }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
}: {
|
||||
/*
|
||||
Write a lua file to the nix store, formatted using stylua.
|
||||
|
||||
|
@ -16,7 +14,8 @@
|
|||
- [name] The name of the derivation
|
||||
- [text] The content of the lua file
|
||||
*/
|
||||
writeLua = name: text:
|
||||
writeLua =
|
||||
name: text:
|
||||
pkgs.runCommand name { inherit text; } ''
|
||||
echo -n "$text" > "$out"
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
pkgs,
|
||||
_nixvimTests ? false,
|
||||
...
|
||||
} @ args: {
|
||||
}@args:
|
||||
{
|
||||
# Add all exported modules here
|
||||
check = import ../tests/test-derivation.nix {
|
||||
inherit makeNixvim makeNixvimWithModule pkgs;
|
||||
};
|
||||
check = import ../tests/test-derivation.nix { inherit makeNixvim makeNixvimWithModule pkgs; };
|
||||
helpers = import ./helpers.nix (args // { inherit _nixvimTests; });
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
pkgs,
|
||||
_nixvimTests,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
nixvimBuilders = import ./builders.nix { inherit lib pkgs; };
|
||||
nixvimTypes = import ./types.nix { inherit lib nixvimOptions; };
|
||||
nixvimUtils = import ./utils.nix { inherit lib _nixvimTests; };
|
||||
|
@ -14,7 +15,14 @@ in
|
|||
maintainers = import ./maintainers.nix;
|
||||
keymaps = import ./keymap-helpers.nix { inherit lib nixvimOptions nixvimTypes; };
|
||||
autocmd = import ./autocmd-helpers.nix { inherit lib nixvimOptions nixvimTypes; };
|
||||
neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions nixvimUtils toLuaObject;};
|
||||
neovim-plugin = import ./neovim-plugin.nix {
|
||||
inherit
|
||||
lib
|
||||
nixvimOptions
|
||||
nixvimUtils
|
||||
toLuaObject
|
||||
;
|
||||
};
|
||||
vim-plugin = import ./vim-plugin.nix { inherit lib nixvimOptions nixvimUtils; };
|
||||
inherit nixvimTypes;
|
||||
inherit toLuaObject;
|
||||
|
|
|
@ -3,40 +3,25 @@
|
|||
nixvimOptions,
|
||||
nixvimTypes,
|
||||
}:
|
||||
with lib; rec {
|
||||
with lib;
|
||||
rec {
|
||||
# These are the configuration options that change the behavior of each mapping.
|
||||
mapConfigOptions = {
|
||||
silent =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||
silent = nixvimOptions.defaultNullOpts.mkBool false "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||
|
||||
nowait =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||
nowait = nixvimOptions.defaultNullOpts.mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||
|
||||
script =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Equivalent to adding <script> to a map.";
|
||||
script = nixvimOptions.defaultNullOpts.mkBool false "Equivalent to adding <script> to a map.";
|
||||
|
||||
expr =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||
expr = nixvimOptions.defaultNullOpts.mkBool false "Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||
|
||||
unique =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
||||
unique = nixvimOptions.defaultNullOpts.mkBool false "Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
||||
|
||||
noremap =
|
||||
nixvimOptions.defaultNullOpts.mkBool true
|
||||
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
||||
noremap = nixvimOptions.defaultNullOpts.mkBool true "Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
||||
|
||||
remap =
|
||||
nixvimOptions.defaultNullOpts.mkBool false
|
||||
"Make the mapping recursive. Inverses \"noremap\"";
|
||||
remap = nixvimOptions.defaultNullOpts.mkBool false "Make the mapping recursive. Inverses \"noremap\"";
|
||||
|
||||
desc =
|
||||
nixvimOptions.mkNullOrOption types.str
|
||||
"A textual description of this keybind, to be shown in which-key, if you have it.";
|
||||
desc = nixvimOptions.mkNullOrOption types.str "A textual description of this keybind, to be shown in which-key, if you have it.";
|
||||
};
|
||||
|
||||
modes = {
|
||||
|
@ -71,56 +56,50 @@ with lib; rec {
|
|||
modeEnum =
|
||||
types.enum
|
||||
# ["" "n" "v" ...]
|
||||
(
|
||||
map
|
||||
(
|
||||
{short, ...}: short
|
||||
)
|
||||
(attrValues modes)
|
||||
);
|
||||
(map ({ short, ... }: short) (attrValues modes));
|
||||
|
||||
mapOptionSubmodule = mkMapOptionSubmodule { };
|
||||
|
||||
mkModeOption = default:
|
||||
mkModeOption =
|
||||
default:
|
||||
mkOption {
|
||||
type = with types;
|
||||
either
|
||||
modeEnum
|
||||
(listOf modeEnum);
|
||||
type = with types; either modeEnum (listOf modeEnum);
|
||||
description = ''
|
||||
One or several modes.
|
||||
Use the short-names (`"n"`, `"v"`, ...).
|
||||
See `:h map-modes` to learn more.
|
||||
'';
|
||||
inherit default;
|
||||
example = ["n" "v"];
|
||||
example = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
};
|
||||
|
||||
mkMapOptionSubmodule = defaults: (with types;
|
||||
mkMapOptionSubmodule =
|
||||
defaults:
|
||||
(
|
||||
with types;
|
||||
submodule {
|
||||
options = {
|
||||
key = mkOption ({
|
||||
key = mkOption (
|
||||
{
|
||||
type = str;
|
||||
description = "The key to map.";
|
||||
example = "<C-m>";
|
||||
}
|
||||
// (
|
||||
optionalAttrs
|
||||
(defaults ? key)
|
||||
{default = defaults.key;}
|
||||
));
|
||||
// (optionalAttrs (defaults ? key) { default = defaults.key; })
|
||||
);
|
||||
|
||||
mode = mkModeOption defaults.mode or "";
|
||||
|
||||
action = mkOption ({
|
||||
action = mkOption (
|
||||
{
|
||||
type = nixvimTypes.maybeRaw str;
|
||||
description = "The action to execute.";
|
||||
}
|
||||
// (
|
||||
optionalAttrs
|
||||
(defaults ? action)
|
||||
{default = defaults.action;}
|
||||
));
|
||||
// (optionalAttrs (defaults ? action) { default = defaults.action; })
|
||||
);
|
||||
|
||||
lua = mkOption {
|
||||
type = bool;
|
||||
|
@ -133,17 +112,18 @@ with lib; rec {
|
|||
|
||||
options = mapConfigOptions;
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
# Correctly merge two attrs (partially) representing a mapping.
|
||||
mergeKeymap = defaults: keymap: let
|
||||
mergeKeymap =
|
||||
defaults: keymap:
|
||||
let
|
||||
# First, merge the `options` attrs of both options.
|
||||
mergedOpts = (defaults.options or { }) // (keymap.options or { });
|
||||
in
|
||||
# Then, merge the root attrs together and add the previously merged `options` attrs.
|
||||
(defaults // keymap) // { options = mergedOpts; };
|
||||
|
||||
mkKeymaps = defaults:
|
||||
map
|
||||
(mergeKeymap defaults);
|
||||
mkKeymaps = defaults: map (mergeKeymap defaults);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
github = "MattSturgeon";
|
||||
githubId = 5046562;
|
||||
name = "Matt Sturgeon";
|
||||
keys = [
|
||||
{fingerprint = "7082 22EA 1808 E39A 83AC 8B18 4F91 844C ED1A 8299";}
|
||||
];
|
||||
keys = [ { fingerprint = "7082 22EA 1808 E39A 83AC 8B18 4F91 844C ED1A 8299"; } ];
|
||||
};
|
||||
DanielLaing = {
|
||||
email = "daniel@daniellaing.com";
|
||||
|
@ -28,9 +26,7 @@
|
|||
github = "Bodleum";
|
||||
githubId = 60107449;
|
||||
name = "Daniel Laing";
|
||||
keys = [
|
||||
{fingerprint = "0821 8B96 DC73 85E5 BB7C A535 D264 3BD2 13BC 0FA8";}
|
||||
];
|
||||
keys = [ { fingerprint = "0821 8B96 DC73 85E5 BB7C A535 D264 3BD2 13BC 0FA8"; } ];
|
||||
};
|
||||
JanKremer = {
|
||||
email = "mail@jankremer.eu";
|
||||
|
@ -38,9 +34,7 @@
|
|||
github = "janurskremer";
|
||||
githubId = 79042825;
|
||||
name = "Jan Kremer";
|
||||
keys = [
|
||||
{fingerprint = "20AF 0A65 9F2B 93AD 9184 15D1 A7DA 689C B3B0 78EC";}
|
||||
];
|
||||
keys = [ { fingerprint = "20AF 0A65 9F2B 93AD 9184 15D1 A7DA 689C B3B0 78EC"; } ];
|
||||
};
|
||||
Kareem-Medhat = {
|
||||
email = "kareemmedhatnabil@gmail.com";
|
||||
|
|
|
@ -4,19 +4,20 @@
|
|||
toLuaObject,
|
||||
nixvimUtils,
|
||||
}:
|
||||
with lib; rec {
|
||||
mkSettingsOption = {
|
||||
with lib;
|
||||
rec {
|
||||
mkSettingsOption =
|
||||
{
|
||||
pluginName ? null,
|
||||
options ? { },
|
||||
description ?
|
||||
if pluginName != null
|
||||
then "Options provided to the `require('${pluginName}').setup` function."
|
||||
else throw "mkSettingsOption: Please provide either a `pluginName` or `description`.",
|
||||
if pluginName != null then
|
||||
"Options provided to the `require('${pluginName}').setup` function."
|
||||
else
|
||||
throw "mkSettingsOption: Please provide either a `pluginName` or `description`.",
|
||||
example ? null,
|
||||
}:
|
||||
nixvimOptions.mkSettingsOption {
|
||||
inherit options description example;
|
||||
};
|
||||
nixvimOptions.mkSettingsOption { inherit options description example; };
|
||||
|
||||
# TODO: DEPRECATED: use the `settings` option instead
|
||||
extraOptionsOptions = {
|
||||
|
@ -30,7 +31,9 @@ with lib; rec {
|
|||
};
|
||||
};
|
||||
|
||||
mkNeovimPlugin = config: {
|
||||
mkNeovimPlugin =
|
||||
config:
|
||||
{
|
||||
name,
|
||||
maintainers,
|
||||
url ? defaultPackage.meta.homepage,
|
||||
|
@ -54,58 +57,42 @@ with lib; rec {
|
|||
extraPlugins ? [ ],
|
||||
extraPackages ? [ ],
|
||||
callSetup ? true,
|
||||
}: let
|
||||
namespace =
|
||||
if isColorscheme
|
||||
then "colorschemes"
|
||||
else "plugins";
|
||||
in {
|
||||
}:
|
||||
let
|
||||
namespace = if isColorscheme then "colorschemes" else "plugins";
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit
|
||||
description
|
||||
name
|
||||
url
|
||||
;
|
||||
inherit description name url;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
|
||||
imports = let
|
||||
basePluginPath = [namespace name];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
namespace
|
||||
name
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
imports
|
||||
++ (
|
||||
optional
|
||||
deprecateExtraOptions
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["extraOptions"])
|
||||
settingsPath
|
||||
)
|
||||
)
|
||||
++ (
|
||||
map
|
||||
(
|
||||
option: let
|
||||
optionPath =
|
||||
if isString option
|
||||
then [option]
|
||||
else option; # option is already a path (i.e. a list)
|
||||
++ (optional deprecateExtraOptions (
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath
|
||||
))
|
||||
++ (map (
|
||||
option:
|
||||
let
|
||||
optionPath = if isString option then [ option ] else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map nixvimUtils.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(settingsPath ++ optionPathSnakeCase)
|
||||
)
|
||||
optionsRenamedToSettings
|
||||
);
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
|
||||
options.${namespace}.${name} =
|
||||
{
|
||||
options.${namespace}.${name} = {
|
||||
enable = mkEnableOption originalName;
|
||||
|
||||
package = nixvimOptions.mkPackageOption originalName defaultPackage;
|
||||
|
@ -115,18 +102,14 @@ with lib; rec {
|
|||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
};
|
||||
}
|
||||
// extraOptions;
|
||||
} // extraOptions;
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cfg = config.${namespace}.${name};
|
||||
extraConfigNamespace =
|
||||
if isColorscheme
|
||||
then "extraConfigLuaPre"
|
||||
else "extraConfigLua";
|
||||
extraConfigNamespace = if isColorscheme then "extraConfigLuaPre" else "extraConfigLua";
|
||||
in
|
||||
mkIf cfg.enable (
|
||||
mkMerge [
|
||||
mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
extraPlugins = [ cfg.package ] ++ extraPlugins;
|
||||
inherit extraPackages;
|
||||
|
@ -135,11 +118,8 @@ with lib; rec {
|
|||
require('${luaName}').setup(${toLuaObject cfg.settings})
|
||||
'';
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) {
|
||||
inherit colorscheme;
|
||||
})
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { inherit colorscheme; })
|
||||
(extraConfig cfg)
|
||||
]
|
||||
);
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
220
lib/options.nix
220
lib/options.nix
|
@ -4,21 +4,23 @@
|
|||
nixvimUtils,
|
||||
}:
|
||||
with lib;
|
||||
with nixvimUtils; rec {
|
||||
with nixvimUtils;
|
||||
rec {
|
||||
# Creates an option with a nullable type that defaults to null.
|
||||
mkNullOrOption = type: desc:
|
||||
mkNullOrOption =
|
||||
type: desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
};
|
||||
|
||||
mkCompositeOption = desc: options:
|
||||
mkNullOrOption (types.submodule {inherit options;}) desc;
|
||||
mkCompositeOption = desc: options: mkNullOrOption (types.submodule { inherit options; }) desc;
|
||||
|
||||
mkNullOrStr = mkNullOrOption (with nixvimTypes; maybeRaw str);
|
||||
|
||||
mkNullOrLua = desc:
|
||||
mkNullOrLua =
|
||||
desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr nixvimTypes.strLua;
|
||||
default = null;
|
||||
|
@ -26,7 +28,8 @@ with nixvimUtils; rec {
|
|||
apply = mkRaw;
|
||||
};
|
||||
|
||||
mkNullOrLuaFn = desc:
|
||||
mkNullOrLuaFn =
|
||||
desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr nixvimTypes.strLuaFn;
|
||||
default = null;
|
||||
|
@ -34,37 +37,35 @@ with nixvimUtils; rec {
|
|||
apply = mkRaw;
|
||||
};
|
||||
|
||||
mkNullOrStrLuaOr = ty: desc:
|
||||
mkNullOrStrLuaOr =
|
||||
ty: desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr (types.either nixvimTypes.strLua ty);
|
||||
default = null;
|
||||
description = desc;
|
||||
apply = v:
|
||||
if builtins.isString v
|
||||
then mkRaw v
|
||||
else v;
|
||||
apply = v: if builtins.isString v then mkRaw v else v;
|
||||
};
|
||||
|
||||
mkNullOrStrLuaFnOr = ty: desc:
|
||||
mkNullOrStrLuaFnOr =
|
||||
ty: desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr (types.either nixvimTypes.strLuaFn ty);
|
||||
default = null;
|
||||
description = desc;
|
||||
apply = v:
|
||||
if builtins.isString v
|
||||
then mkRaw v
|
||||
else v;
|
||||
apply = v: if builtins.isString v then mkRaw v else v;
|
||||
};
|
||||
|
||||
defaultNullOpts = rec {
|
||||
mkNullable = type: default: desc:
|
||||
mkNullable =
|
||||
type: default: desc:
|
||||
mkNullOrOption type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
|
@ -73,33 +74,41 @@ with nixvimUtils; rec {
|
|||
|
||||
mkNullableWithRaw = type: mkNullable (maybeRaw type);
|
||||
|
||||
mkStrLuaOr = type: default: desc:
|
||||
mkNullOrStrLuaOr type (let
|
||||
mkStrLuaOr =
|
||||
type: default: desc:
|
||||
mkNullOrStrLuaOr type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'');
|
||||
''
|
||||
);
|
||||
|
||||
mkStrLuaFnOr = type: default: desc:
|
||||
mkNullOrStrLuaFnOr type (let
|
||||
mkStrLuaFnOr =
|
||||
type: default: desc:
|
||||
mkNullOrStrLuaFnOr type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'');
|
||||
''
|
||||
);
|
||||
|
||||
mkLua = default: desc:
|
||||
mkNullOrLua
|
||||
(
|
||||
mkLua =
|
||||
default: desc:
|
||||
mkNullOrLua (
|
||||
(optionalString (desc != "") ''
|
||||
${desc}
|
||||
|
||||
|
@ -109,14 +118,16 @@ with nixvimUtils; rec {
|
|||
''
|
||||
);
|
||||
|
||||
mkLuaFn = default: desc: let
|
||||
mkLuaFn =
|
||||
default: desc:
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
mkNullOrLuaFn
|
||||
(
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
mkNullOrLuaFn (
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
|
@ -129,120 +140,106 @@ with nixvimUtils; rec {
|
|||
mkPositiveInt = default: mkNullable (with nixvimTypes; maybeRaw ints.positive) (toString default);
|
||||
# Unsigned: >=0
|
||||
mkUnsignedInt = default: mkNullable (with nixvimTypes; maybeRaw ints.unsigned) (toString default);
|
||||
mkBool = default:
|
||||
mkNullable (with nixvimTypes; maybeRaw bool) (
|
||||
if default
|
||||
then "true"
|
||||
else "false"
|
||||
);
|
||||
mkBool =
|
||||
default: mkNullable (with nixvimTypes; maybeRaw bool) (if default then "true" else "false");
|
||||
mkStr = default: mkNullable (with nixvimTypes; maybeRaw str) ''${builtins.toString default}'';
|
||||
mkAttributeSet = default: mkNullable nixvimTypes.attrs ''${default}'';
|
||||
mkListOf = ty: default: mkNullable (with nixvimTypes; listOf (maybeRaw ty)) default;
|
||||
mkAttrsOf = ty: default: mkNullable (with nixvimTypes; attrsOf (maybeRaw ty)) default;
|
||||
mkEnum = enumValues: default: mkNullable (with nixvimTypes; maybeRaw (enum enumValues)) ''"${default}"'';
|
||||
mkEnum =
|
||||
enumValues: default: mkNullable (with nixvimTypes; maybeRaw (enum enumValues)) ''"${default}"'';
|
||||
mkEnumFirstDefault = enumValues: mkEnum enumValues (head enumValues);
|
||||
mkBorder = default: name: desc:
|
||||
mkNullable
|
||||
(with nixvimTypes; maybeRaw border)
|
||||
default
|
||||
(let
|
||||
mkBorder =
|
||||
default: name: desc:
|
||||
mkNullable (with nixvimTypes; maybeRaw border) default (
|
||||
let
|
||||
defaultDesc = ''
|
||||
Defines the border to use for ${name}.
|
||||
Accepts same border values as `nvim_open_win()`. See `:help nvim_open_win()` for more info.
|
||||
'';
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
${defaultDesc}
|
||||
'');
|
||||
mkSeverity = default: desc:
|
||||
''
|
||||
);
|
||||
mkSeverity =
|
||||
default: desc:
|
||||
mkOption {
|
||||
type = with types;
|
||||
nullOr
|
||||
(
|
||||
either ints.unsigned
|
||||
(
|
||||
enum
|
||||
["error" "warn" "info" "hint"]
|
||||
)
|
||||
type =
|
||||
with types;
|
||||
nullOr (
|
||||
either ints.unsigned (enum [
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"hint"
|
||||
])
|
||||
);
|
||||
default = null;
|
||||
apply =
|
||||
mapNullable
|
||||
(
|
||||
value:
|
||||
if isInt value
|
||||
then value
|
||||
else mkRaw "vim.diagnostic.severity.${strings.toUpper value}"
|
||||
apply = mapNullable (
|
||||
value: if isInt value then value else mkRaw "vim.diagnostic.severity.${strings.toUpper value}"
|
||||
);
|
||||
description = let
|
||||
description =
|
||||
let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
mkLogLevel = default: desc:
|
||||
mkLogLevel =
|
||||
default: desc:
|
||||
mkOption {
|
||||
type = with types;
|
||||
nullOr
|
||||
(
|
||||
either
|
||||
ints.unsigned
|
||||
nixvimTypes.logLevel
|
||||
);
|
||||
type = with types; nullOr (either ints.unsigned nixvimTypes.logLevel);
|
||||
default = null;
|
||||
apply =
|
||||
mapNullable
|
||||
(
|
||||
value:
|
||||
if isInt value
|
||||
then value
|
||||
else mkRaw "vim.log.levels.${strings.toUpper value}"
|
||||
apply = mapNullable (
|
||||
value: if isInt value then value else mkRaw "vim.log.levels.${strings.toUpper value}"
|
||||
);
|
||||
description = let
|
||||
description =
|
||||
let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
|
||||
mkHighlight = default: name: desc:
|
||||
mkNullable
|
||||
nixvimTypes.highlight
|
||||
default
|
||||
(
|
||||
if desc == ""
|
||||
then "Highlight settings."
|
||||
else desc
|
||||
);
|
||||
mkHighlight =
|
||||
default: name: desc:
|
||||
mkNullable nixvimTypes.highlight default (if desc == "" then "Highlight settings." else desc);
|
||||
};
|
||||
|
||||
mkPackageOption = name: default:
|
||||
mkPackageOption =
|
||||
name: default:
|
||||
mkOption {
|
||||
type = types.package;
|
||||
inherit default;
|
||||
description = "Plugin to use for ${name}";
|
||||
};
|
||||
|
||||
mkSettingsOption = {
|
||||
mkSettingsOption =
|
||||
{
|
||||
options ? { },
|
||||
description,
|
||||
example ? null,
|
||||
}:
|
||||
mkOption {
|
||||
type = with types;
|
||||
type =
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
inherit options;
|
||||
|
@ -250,8 +247,8 @@ with nixvimUtils; rec {
|
|||
default = { };
|
||||
inherit description;
|
||||
example =
|
||||
if example == null
|
||||
then {
|
||||
if example == null then
|
||||
{
|
||||
foo_bar = 42;
|
||||
hostname = "localhost:8080";
|
||||
callback.__raw = ''
|
||||
|
@ -260,6 +257,7 @@ with nixvimUtils; rec {
|
|||
end
|
||||
'';
|
||||
}
|
||||
else example;
|
||||
else
|
||||
example;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,46 +1,44 @@
|
|||
{ lib }:
|
||||
with lib; rec {
|
||||
with lib;
|
||||
rec {
|
||||
# Black functional magic that converts a bunch of different Nix types to their
|
||||
# lua equivalents!
|
||||
toLuaObject = args:
|
||||
if builtins.isAttrs args
|
||||
then
|
||||
if hasAttr "__raw" args
|
||||
then args.__raw
|
||||
else if hasAttr "__empty" args
|
||||
then "{ }"
|
||||
toLuaObject =
|
||||
args:
|
||||
if builtins.isAttrs args then
|
||||
if hasAttr "__raw" args then
|
||||
args.__raw
|
||||
else if hasAttr "__empty" args then
|
||||
"{ }"
|
||||
else
|
||||
"{"
|
||||
+ (concatStringsSep ","
|
||||
(mapAttrsToList
|
||||
(n: v:
|
||||
if (builtins.match "__unkeyed.*" n) != null
|
||||
then toLuaObject v
|
||||
else if n == "__emptyString"
|
||||
then "[''] = " + (toLuaObject v)
|
||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||
(filterAttrs
|
||||
(
|
||||
+ (concatStringsSep "," (
|
||||
mapAttrsToList (
|
||||
n: v:
|
||||
v != null && (toLuaObject v != "{}")
|
||||
)
|
||||
args)))
|
||||
if (builtins.match "__unkeyed.*" n) != null then
|
||||
toLuaObject v
|
||||
else if n == "__emptyString" then
|
||||
"[''] = " + (toLuaObject v)
|
||||
else
|
||||
"[${toLuaObject n}] = " + (toLuaObject v)
|
||||
) (filterAttrs (n: v: v != null && (toLuaObject v != "{}")) args)
|
||||
))
|
||||
+ "}"
|
||||
else if builtins.isList args
|
||||
then "{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args
|
||||
then
|
||||
else if builtins.isList args then
|
||||
"{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args then
|
||||
# This should be enough!
|
||||
builtins.toJSON args
|
||||
else if builtins.isPath args
|
||||
then builtins.toJSON (toString args)
|
||||
else if builtins.isBool args
|
||||
then "${boolToString args}"
|
||||
else if builtins.isFloat args
|
||||
then "${toString args}"
|
||||
else if builtins.isInt args
|
||||
then "${toString args}"
|
||||
else if (args == null)
|
||||
then "nil"
|
||||
else "";
|
||||
else if builtins.isPath args then
|
||||
builtins.toJSON (toString args)
|
||||
else if builtins.isBool args then
|
||||
"${boolToString args}"
|
||||
else if builtins.isFloat args then
|
||||
"${toString args}"
|
||||
else if builtins.isInt args then
|
||||
"${toString args}"
|
||||
else if (args == null) then
|
||||
"nil"
|
||||
else
|
||||
"";
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
{
|
||||
lib,
|
||||
nixvimOptions,
|
||||
...
|
||||
}:
|
||||
{ lib, nixvimOptions, ... }:
|
||||
with lib;
|
||||
with nixvimOptions;
|
||||
with lib.types; let
|
||||
strLikeType = description:
|
||||
with lib.types;
|
||||
let
|
||||
strLikeType =
|
||||
description:
|
||||
mkOptionType {
|
||||
name = "str";
|
||||
inherit description;
|
||||
|
@ -26,19 +24,24 @@ in
|
|||
check = isRawType;
|
||||
};
|
||||
|
||||
maybeRaw = type:
|
||||
types.either
|
||||
type
|
||||
rawLua;
|
||||
maybeRaw = type: types.either type rawLua;
|
||||
|
||||
border = with types;
|
||||
border =
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
(listOf str)
|
||||
(listOf (listOf str))
|
||||
];
|
||||
|
||||
logLevel = types.enum ["off" "error" "warn" "info" "debug" "trace"];
|
||||
logLevel = types.enum [
|
||||
"off"
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"debug"
|
||||
"trace"
|
||||
];
|
||||
|
||||
highlight = types.submodule {
|
||||
# Adds flexibility for other keys
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
{ lib, _nixvimTests }:
|
||||
with lib;
|
||||
{
|
||||
lib,
|
||||
_nixvimTests,
|
||||
}:
|
||||
with lib; {
|
||||
listToUnkeyedAttrs = list:
|
||||
builtins.listToAttrs
|
||||
(lib.lists.imap0 (idx: lib.nameValuePair "__unkeyed-${toString idx}") list);
|
||||
listToUnkeyedAttrs =
|
||||
list:
|
||||
builtins.listToAttrs (lib.lists.imap0 (idx: lib.nameValuePair "__unkeyed-${toString idx}") list);
|
||||
|
||||
enableExceptInTests = !_nixvimTests;
|
||||
|
||||
emptyTable = {"__empty" = null;};
|
||||
emptyTable = {
|
||||
"__empty" = null;
|
||||
};
|
||||
|
||||
/*
|
||||
Convert a string from camelCase to snake_case
|
||||
Type: string -> string
|
||||
*/
|
||||
toSnakeCase = let
|
||||
toSnakeCase =
|
||||
let
|
||||
splitByWords = builtins.split "([A-Z])";
|
||||
processWord = s:
|
||||
if isString s
|
||||
then s
|
||||
else "_" + toLower (elemAt s 0);
|
||||
processWord = s: if isString s then s else "_" + toLower (elemAt s 0);
|
||||
in
|
||||
string: let
|
||||
string:
|
||||
let
|
||||
words = splitByWords string;
|
||||
in
|
||||
concatStrings (map processWord words);
|
||||
|
@ -31,15 +30,9 @@ with lib; {
|
|||
|
||||
mkIfNonNull = x: (mkIfNonNull' x x);
|
||||
|
||||
ifNonNull' = x: y:
|
||||
if (x == null)
|
||||
then null
|
||||
else y;
|
||||
ifNonNull' = x: y: if (x == null) then null else y;
|
||||
|
||||
mkRaw = r:
|
||||
if (isString r && (r != ""))
|
||||
then {__raw = r;}
|
||||
else null;
|
||||
mkRaw = r: if (isString r && (r != "")) then { __raw = r; } else null;
|
||||
|
||||
wrapDo = string: ''
|
||||
do
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
nixvimOptions,
|
||||
nixvimUtils,
|
||||
}:
|
||||
with lib; {
|
||||
mkVimPlugin = config: {
|
||||
with lib;
|
||||
{
|
||||
mkVimPlugin =
|
||||
config:
|
||||
{
|
||||
name,
|
||||
url ?
|
||||
if defaultPackage != null
|
||||
then defaultPackage.meta.homepage
|
||||
else null,
|
||||
url ? if defaultPackage != null then defaultPackage.meta.homepage else null,
|
||||
maintainers,
|
||||
imports ? [ ],
|
||||
description ? null,
|
||||
|
@ -30,11 +30,9 @@ with lib; {
|
|||
extraConfig ? cfg: { },
|
||||
extraPlugins ? [ ],
|
||||
extraPackages ? [ ],
|
||||
}: let
|
||||
namespace =
|
||||
if isColorscheme
|
||||
then "colorschemes"
|
||||
else "plugins";
|
||||
}:
|
||||
let
|
||||
namespace = if isColorscheme then "colorschemes" else "plugins";
|
||||
|
||||
cfg = config.${namespace}.${name};
|
||||
|
||||
|
@ -42,17 +40,14 @@ with lib; {
|
|||
|
||||
# does this evaluate package?
|
||||
packageOption =
|
||||
if defaultPackage == null
|
||||
then {}
|
||||
else {
|
||||
package = nixvimOptions.mkPackageOption name defaultPackage;
|
||||
};
|
||||
if defaultPackage == null then
|
||||
{ }
|
||||
else
|
||||
{ package = nixvimOptions.mkPackageOption name defaultPackage; };
|
||||
|
||||
createSettingsOption = (isString globalPrefix) && (globalPrefix != "");
|
||||
|
||||
settingsOption =
|
||||
optionalAttrs createSettingsOption
|
||||
{
|
||||
settingsOption = optionalAttrs createSettingsOption {
|
||||
settings = nixvimOptions.mkSettingsOption {
|
||||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
|
@ -68,73 +63,50 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit
|
||||
description
|
||||
name
|
||||
url
|
||||
;
|
||||
inherit description name url;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
options.${namespace}.${name} =
|
||||
{
|
||||
options.${namespace}.${name} = {
|
||||
enable = mkEnableOption originalName;
|
||||
}
|
||||
// settingsOption
|
||||
// packageOption
|
||||
// extraOptions;
|
||||
} // settingsOption // packageOption // extraOptions;
|
||||
|
||||
imports = let
|
||||
basePluginPath = [namespace name];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
namespace
|
||||
name
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
imports
|
||||
++ (
|
||||
optional
|
||||
(deprecateExtraConfig && createSettingsOption)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["extraConfig"])
|
||||
settingsPath
|
||||
)
|
||||
)
|
||||
++ (
|
||||
map
|
||||
(
|
||||
option: let
|
||||
optionPath =
|
||||
if isString option
|
||||
then [option]
|
||||
else option; # option is already a path (i.e. a list)
|
||||
++ (optional (deprecateExtraConfig && createSettingsOption) (
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extraConfig" ]) settingsPath
|
||||
))
|
||||
++ (map (
|
||||
option:
|
||||
let
|
||||
optionPath = if isString option then [ option ] else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map nixvimUtils.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(settingsPath ++ optionPathSnakeCase)
|
||||
)
|
||||
optionsRenamedToSettings
|
||||
);
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(
|
||||
mkMerge [
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
inherit extraPackages;
|
||||
globals = mapAttrs' (n: nameValuePair (globalPrefix + n)) globals;
|
||||
# does this evaluate package? it would not be desired to evaluate package if we use another package.
|
||||
extraPlugins = extraPlugins ++ optional (defaultPackage != null) cfg.package;
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) {
|
||||
inherit colorscheme;
|
||||
})
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { inherit colorscheme; })
|
||||
(extraConfig cfg)
|
||||
]
|
||||
);
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
autoGroups = mkOption {
|
||||
type = types.attrsOf helpers.autocmd.autoGroupOption;
|
||||
|
@ -35,7 +36,8 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
inherit (config) autoGroups autoCmd;
|
||||
in
|
||||
mkIf (autoGroups != { } || autoCmd != { }) {
|
||||
|
@ -43,10 +45,7 @@ with lib; {
|
|||
# TODO remove in early December 2023.
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
all
|
||||
(x: x.description == null)
|
||||
autoCmd;
|
||||
assertion = all (x: x.description == null) autoCmd;
|
||||
message = ''
|
||||
RENAMED OPTION: `autoCmd[].description` has been renamed `autoCmd[].desc`.
|
||||
Please update your configuration.
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.clipboard;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
clipboard = {
|
||||
register = mkOption {
|
||||
|
@ -14,9 +16,7 @@ in {
|
|||
Sets the register to use for the clipboard.
|
||||
Learn more at https://neovim.io/doc/user/options.html#'clipboard'.
|
||||
'';
|
||||
type = with types;
|
||||
nullOr
|
||||
(either str (listOf str));
|
||||
type = with types; nullOr (either str (listOf str));
|
||||
default = null;
|
||||
example = "unnamedplus";
|
||||
};
|
||||
|
@ -25,12 +25,10 @@ in {
|
|||
type = types.submodule {
|
||||
options =
|
||||
mapAttrs
|
||||
(
|
||||
name: packageName: {
|
||||
(name: packageName: {
|
||||
enable = mkEnableOption name;
|
||||
package = mkPackageOption pkgs packageName { };
|
||||
}
|
||||
)
|
||||
})
|
||||
{
|
||||
wl-copy = "wl-clipboard";
|
||||
xclip = "xclip";
|
||||
|
@ -49,9 +47,6 @@ in {
|
|||
config = {
|
||||
opts.clipboard = mkIf (cfg.register != null) cfg.register;
|
||||
|
||||
extraPackages =
|
||||
mapAttrsToList
|
||||
(n: v: v.package)
|
||||
(filterAttrs (n: v: v.enable) cfg.providers);
|
||||
extraPackages = mapAttrsToList (n: v: v.package) (filterAttrs (n: v: v.enable) cfg.providers);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options = {
|
||||
colorscheme = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
commandAttributes = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
|
@ -12,13 +13,32 @@ with lib; let
|
|||
description = "The command to run.";
|
||||
};
|
||||
|
||||
nargs = helpers.mkNullOrOption (types.enum ["0" "1" "*" "?" "+"]) ''
|
||||
nargs =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"0"
|
||||
"1"
|
||||
"*"
|
||||
"?"
|
||||
"+"
|
||||
])
|
||||
''
|
||||
The number of arguments to expect, see :h command-nargs.
|
||||
'';
|
||||
complete = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) ''
|
||||
Tab-completion behaviour, see :h command-complete.
|
||||
'';
|
||||
range = helpers.mkNullOrOption (with types; oneOf [bool int (enum ["%"])]) ''
|
||||
range =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
bool
|
||||
int
|
||||
(enum [ "%" ])
|
||||
]
|
||||
)
|
||||
''
|
||||
Whether the command accepts a range, see :h command-range.
|
||||
'';
|
||||
count = helpers.mkNullOrOption (with types; either bool int) ''
|
||||
|
@ -37,14 +57,16 @@ with lib; let
|
|||
# TODO: command-preview, need to grab a function here.
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.userCommands = mkOption {
|
||||
type = types.attrsOf commandAttributes;
|
||||
default = { };
|
||||
description = "A list of user commands to add to the configuration.";
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cleanupCommand = _: cmd: {
|
||||
inherit (cmd) command;
|
||||
options = filterAttrs (name: _: name != "command") cmd;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{lib, ...}: {
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.enableMan = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
{ lib, config, ... }:
|
||||
with lib;
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
imports = [
|
||||
(lib.mkRenamedOptionModule ["plugins" "editorconfig" "enable"] ["editorconfig" "enable"])
|
||||
(lib.mkRemovedOptionModule ["plugins" "editorconfig" "package"] "editorconfig is now builtin, no plugin required")
|
||||
(lib.mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"editorconfig"
|
||||
"enable"
|
||||
]
|
||||
[
|
||||
"editorconfig"
|
||||
"enable"
|
||||
]
|
||||
)
|
||||
(lib.mkRemovedOptionModule [
|
||||
"plugins"
|
||||
"editorconfig"
|
||||
"package"
|
||||
] "editorconfig is now builtin, no plugin required")
|
||||
];
|
||||
|
||||
options.editorconfig = {
|
||||
|
@ -39,12 +50,15 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cfg = config.editorconfig;
|
||||
in {
|
||||
in
|
||||
{
|
||||
globals.editorconfig = mkIf (!cfg.enable) false;
|
||||
|
||||
extraConfigLua = let
|
||||
extraConfigLua =
|
||||
let
|
||||
mkProperty = name: function: ''
|
||||
__editorconfig.properties.${name} = ${function}
|
||||
'';
|
||||
|
|
|
@ -4,34 +4,36 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
filetypeDefinition =
|
||||
helpers.mkNullOrOption
|
||||
(with types;
|
||||
attrsOf (
|
||||
oneOf [
|
||||
with lib;
|
||||
let
|
||||
filetypeDefinition = helpers.mkNullOrOption (
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
# Raw filetype
|
||||
str
|
||||
# Function to set the filetype
|
||||
helpers.nixvimTypes.rawLua
|
||||
# ["filetype" {priority = xx;}]
|
||||
(listOf (either str (submodule {
|
||||
(listOf (
|
||||
either str (submodule {
|
||||
options = {
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
priority = mkOption { type = int; };
|
||||
};
|
||||
};
|
||||
})))
|
||||
]
|
||||
));
|
||||
in {
|
||||
})
|
||||
))
|
||||
])
|
||||
);
|
||||
in
|
||||
{
|
||||
options.filetype =
|
||||
helpers.mkCompositeOption ''
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Define additional filetypes. The values can either be a literal filetype or a function
|
||||
taking the filepath and the buffer number.
|
||||
|
||||
For more information check `:h vim.filetype.add()`
|
||||
'' {
|
||||
''
|
||||
{
|
||||
extension = filetypeDefinition "set filetypes matching the file extension";
|
||||
filename = filetypeDefinition "set filetypes matching the file name (or path)";
|
||||
pattern = filetypeDefinition "set filetypes matching the specified pattern";
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf helpers.nixvimTypes.highlight;
|
||||
|
@ -43,9 +44,7 @@ with lib; {
|
|||
config = {
|
||||
extraConfigLuaPre =
|
||||
(optionalString (config.highlight != { })
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
|
@ -56,11 +55,10 @@ with lib; {
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'')
|
||||
''
|
||||
)
|
||||
+ (optionalString (config.match != { })
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
-- Match groups {{
|
||||
do
|
||||
|
@ -71,13 +69,12 @@ with lib; {
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'');
|
||||
''
|
||||
);
|
||||
|
||||
extraConfigLuaPost =
|
||||
optionalString (config.highlightOverride != { })
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
keymaps = mkOption {
|
||||
type =
|
||||
types.listOf
|
||||
helpers.keymaps.mapOptionSubmodule;
|
||||
type = types.listOf helpers.keymaps.mapOptionSubmodule;
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
|
@ -44,24 +43,16 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
normalizeMapping = keyMapping: {
|
||||
inherit
|
||||
(keyMapping)
|
||||
mode
|
||||
key
|
||||
options
|
||||
;
|
||||
inherit (keyMapping) mode key options;
|
||||
|
||||
action =
|
||||
if keyMapping.lua
|
||||
then helpers.mkRaw keyMapping.action
|
||||
else keyMapping.action;
|
||||
action = if keyMapping.lua then helpers.mkRaw keyMapping.action else keyMapping.action;
|
||||
};
|
||||
in {
|
||||
extraConfigLua =
|
||||
optionalString (config.keymaps != [])
|
||||
''
|
||||
in
|
||||
{
|
||||
extraConfigLua = optionalString (config.keymaps != [ ]) ''
|
||||
-- Set up keybinds {{{
|
||||
do
|
||||
local __nixvim_binds = ${helpers.toLuaObject (map normalizeMapping config.keymaps)}
|
||||
|
@ -72,12 +63,11 @@ with lib; {
|
|||
-- }}}
|
||||
'';
|
||||
|
||||
autoGroups = mapAttrs' (event: mappings: nameValuePair "nixvim_binds_${event}" {clear = true;}) config.keymapsOnEvents;
|
||||
autoGroups = mapAttrs' (
|
||||
event: mappings: nameValuePair "nixvim_binds_${event}" { clear = true; }
|
||||
) config.keymapsOnEvents;
|
||||
|
||||
autoCmd =
|
||||
mapAttrsToList
|
||||
(
|
||||
event: mappings: {
|
||||
autoCmd = mapAttrsToList (event: mappings: {
|
||||
inherit event;
|
||||
group = "nixvim_binds_${event}";
|
||||
callback = helpers.mkRaw ''
|
||||
|
@ -91,8 +81,6 @@ with lib; {
|
|||
end
|
||||
'';
|
||||
desc = "Load keymaps for ${event}";
|
||||
}
|
||||
)
|
||||
config.keymapsOnEvents;
|
||||
}) config.keymapsOnEvents;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.luaLoader;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.luaLoader = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -27,9 +25,6 @@ in {
|
|||
};
|
||||
|
||||
config = {
|
||||
extraConfigLuaPre =
|
||||
if cfg.enable
|
||||
then "vim.loader.enable()"
|
||||
else "vim.loader.disable()";
|
||||
extraConfigLuaPre = if cfg.enable then "vim.loader.enable()" else "vim.loader.disable()";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
optionsAttrs = {
|
||||
opts = {
|
||||
prettyName = "options";
|
||||
|
@ -34,47 +35,40 @@ with lib; let
|
|||
description = "Global variables (`vim.g.*`)";
|
||||
};
|
||||
};
|
||||
in {
|
||||
options =
|
||||
mapAttrs
|
||||
(
|
||||
_: {description, ...}:
|
||||
in
|
||||
{
|
||||
options = mapAttrs (
|
||||
_:
|
||||
{ description, ... }:
|
||||
mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
default = { };
|
||||
inherit description;
|
||||
}
|
||||
)
|
||||
optionsAttrs;
|
||||
) optionsAttrs;
|
||||
|
||||
# Added 2024-03-29 (do not remove)
|
||||
imports =
|
||||
mapAttrsToList
|
||||
(old: new: mkRenamedOptionModule [old] [new])
|
||||
{
|
||||
imports = mapAttrsToList (old: new: mkRenamedOptionModule [ old ] [ new ]) {
|
||||
options = "opts";
|
||||
globalOptions = "globalOpts";
|
||||
localOptions = "localOpts";
|
||||
};
|
||||
|
||||
config = {
|
||||
extraConfigLuaPre =
|
||||
concatLines
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
optionName: {
|
||||
extraConfigLuaPre = concatLines (
|
||||
mapAttrsToList (
|
||||
optionName:
|
||||
{
|
||||
prettyName,
|
||||
luaVariableName,
|
||||
luaApi,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
varName = "nixvim_${luaVariableName}";
|
||||
optionDefinitions = config.${optionName};
|
||||
in
|
||||
optionalString
|
||||
(optionDefinitions != {})
|
||||
''
|
||||
optionalString (optionDefinitions != { }) ''
|
||||
-- Set up ${prettyName} {{{
|
||||
do
|
||||
local ${varName} = ${helpers.toLuaObject optionDefinitions}
|
||||
|
@ -85,8 +79,7 @@ in {
|
|||
end
|
||||
-- }}}
|
||||
''
|
||||
)
|
||||
optionsAttrs
|
||||
) optionsAttrs
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
config = mkOption {
|
||||
|
@ -12,9 +9,7 @@ with lib; let
|
|||
default = "";
|
||||
};
|
||||
|
||||
optional =
|
||||
mkEnableOption "optional"
|
||||
// {
|
||||
optional = mkEnableOption "optional" // {
|
||||
description = "Don't load by default (load with :packadd)";
|
||||
};
|
||||
|
||||
|
@ -24,7 +19,8 @@ with lib; let
|
|||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
extraPlugins = mkOption {
|
||||
type = with types; listOf (either package pluginWithConfigType);
|
||||
|
@ -74,7 +70,10 @@ in {
|
|||
};
|
||||
|
||||
type = mkOption {
|
||||
type = types.enum ["vim" "lua"];
|
||||
type = types.enum [
|
||||
"vim"
|
||||
"lua"
|
||||
];
|
||||
default = "lua";
|
||||
description = "Whether the generated file is a vim or a lua file";
|
||||
};
|
||||
|
@ -104,7 +103,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
contentLua = ''
|
||||
${config.extraConfigLuaPre}
|
||||
vim.cmd([[
|
||||
|
@ -124,10 +124,8 @@ in {
|
|||
${config.extraConfigLuaPost}
|
||||
EOF
|
||||
'';
|
||||
in {
|
||||
content =
|
||||
if config.type == "lua"
|
||||
then contentLua
|
||||
else contentVim;
|
||||
in
|
||||
{
|
||||
content = if config.type == "lua" then contentLua else contentVim;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../plugins/default.nix
|
||||
];
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ../plugins/default.nix ];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ lib, ... }:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
warnings = mkOption {
|
||||
type = types.listOf types.str;
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.barbar;
|
||||
|
||||
bufferOptions = {
|
||||
|
@ -14,17 +15,20 @@ with lib; let
|
|||
buffers in the tabline.
|
||||
'';
|
||||
|
||||
bufferNumber =
|
||||
helpers.mkNullOrOption types.bool
|
||||
"Whether to show the `bufnr` for the associated buffer.";
|
||||
bufferNumber = helpers.mkNullOrOption types.bool "Whether to show the `bufnr` for the associated buffer.";
|
||||
|
||||
button =
|
||||
helpers.mkNullOrOption (with types; either str (enum [false]))
|
||||
"the button which is clicked to close / save a buffer, or indicate that it is pinned.";
|
||||
button = helpers.mkNullOrOption (
|
||||
with types; either str (enum [ false ])
|
||||
) "the button which is clicked to close / save a buffer, or indicate that it is pinned.";
|
||||
|
||||
diagnostics =
|
||||
genAttrs
|
||||
["error" "warn" "info" "hint"]
|
||||
[
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"hint"
|
||||
]
|
||||
(
|
||||
name:
|
||||
helpers.mkCompositeOption "${name} diagnostic icon." {
|
||||
|
@ -35,9 +39,7 @@ with lib; let
|
|||
);
|
||||
|
||||
filetype = {
|
||||
customColors =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Sets the icon's highlight group. If false, will use nvim-web-devicons colors";
|
||||
customColors = helpers.defaultNullOpts.mkBool false "Sets the icon's highlight group. If false, will use nvim-web-devicons colors";
|
||||
|
||||
enable = helpers.defaultNullOpts.mkBool true "Show the filetype icon.";
|
||||
};
|
||||
|
@ -48,12 +50,10 @@ with lib; let
|
|||
};
|
||||
};
|
||||
|
||||
stateOptions =
|
||||
{
|
||||
stateOptions = {
|
||||
modified = bufferOptions;
|
||||
pinned = bufferOptions;
|
||||
}
|
||||
// bufferOptions;
|
||||
} // bufferOptions;
|
||||
|
||||
keymapsActions = {
|
||||
previous = "Previous";
|
||||
|
@ -78,23 +78,18 @@ with lib; let
|
|||
orderByLanguage = "OrderByLanguage";
|
||||
orderByWindowNumber = "OrderByWindowNumber";
|
||||
};
|
||||
in {
|
||||
options.plugins.barbar =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.barbar = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
|
||||
|
||||
animation = helpers.defaultNullOpts.mkBool true "Enable/disable animations";
|
||||
|
||||
autoHide =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Enable/disable auto-hiding the tab bar when there is a single buffer.";
|
||||
autoHide = helpers.defaultNullOpts.mkBool false "Enable/disable auto-hiding the tab bar when there is a single buffer.";
|
||||
|
||||
tabpages =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Enable/disable current/total tabpages indicator (top right corner).";
|
||||
tabpages = helpers.defaultNullOpts.mkBool true "Enable/disable current/total tabpages indicator (top right corner).";
|
||||
|
||||
clickable = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable clickable tabs
|
||||
|
@ -111,31 +106,32 @@ in {
|
|||
'';
|
||||
|
||||
focusOnClose =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["left" "right"]
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
''
|
||||
A buffer to this direction will be focused (if it exists) when closing the current buffer.
|
||||
'';
|
||||
|
||||
highlightAlternate = helpers.defaultNullOpts.mkBool false "Highlight alternate buffers";
|
||||
|
||||
highlightInactiveFileIcons =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Highlight file icons in inactive buffers";
|
||||
highlightInactiveFileIcons = helpers.defaultNullOpts.mkBool false "Highlight file icons in inactive buffers";
|
||||
|
||||
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
||||
|
||||
icons =
|
||||
stateOptions
|
||||
// (
|
||||
mapAttrs
|
||||
(name: description:
|
||||
// (mapAttrs
|
||||
(
|
||||
name: description:
|
||||
mkOption {
|
||||
type = types.submodule {
|
||||
options = stateOptions;
|
||||
};
|
||||
type = types.submodule { options = stateOptions; };
|
||||
default = { };
|
||||
inherit description;
|
||||
})
|
||||
}
|
||||
)
|
||||
{
|
||||
alternate = "The icons used for an alternate buffer.";
|
||||
current = "The icons for the current buffer.";
|
||||
|
@ -170,9 +166,7 @@ in {
|
|||
helpers.defaultNullOpts.mkInt 1
|
||||
"Sets the minimum padding width with which to surround each tab";
|
||||
|
||||
maximumLength =
|
||||
helpers.defaultNullOpts.mkInt 30
|
||||
"Sets the maximum buffer name length.";
|
||||
maximumLength = helpers.defaultNullOpts.mkInt 30 "Sets the maximum buffer name length.";
|
||||
|
||||
semanticLetters = helpers.defaultNullOpts.mkBool true ''
|
||||
If set, the letters for each buffer in buffer-pick mode will be assigned based on their
|
||||
|
@ -181,33 +175,25 @@ in {
|
|||
order of usability (see `letters` option)
|
||||
'';
|
||||
|
||||
letters =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
"asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP"
|
||||
''
|
||||
letters = helpers.defaultNullOpts.mkStr "asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP" ''
|
||||
New buffer letters are assigned in this order.
|
||||
This order is optimal for the qwerty keyboard layout but might need adjustment for other layouts.
|
||||
'';
|
||||
|
||||
sidebarFiletypes =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
sidebarFiletypes = helpers.mkNullOrOption (
|
||||
with types;
|
||||
attrsOf (
|
||||
either
|
||||
(enum [true])
|
||||
(types.submodule {
|
||||
either (enum [ true ]) (
|
||||
types.submodule {
|
||||
options = {
|
||||
text = helpers.mkNullOrOption types.str "The text used for the offset";
|
||||
|
||||
event =
|
||||
helpers.mkNullOrOption types.str
|
||||
"The event which the sidebar executes when leaving.";
|
||||
event = helpers.mkNullOrOption types.str "The event which the sidebar executes when leaving.";
|
||||
};
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
"Set the filetypes which barbar will offset itself for";
|
||||
) "Set the filetypes which barbar will offset itself for";
|
||||
|
||||
noNameTitle = helpers.mkNullOrOption types.str ''
|
||||
Sets the name of unnamed buffers.
|
||||
|
@ -219,19 +205,14 @@ in {
|
|||
{
|
||||
silent = mkEnableOption "silent keymaps for barbar";
|
||||
}
|
||||
// (
|
||||
mapAttrs
|
||||
(
|
||||
optionName: funcName:
|
||||
helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
|
||||
)
|
||||
keymapsActions
|
||||
);
|
||||
// (mapAttrs (
|
||||
optionName: funcName: helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
|
||||
) keymapsActions);
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions =
|
||||
{
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
inherit (cfg) animation;
|
||||
auto_hide = cfg.autoHide;
|
||||
inherit (cfg) tabpages;
|
||||
|
@ -242,9 +223,10 @@ in {
|
|||
highlight_alternate = cfg.highlightAlternate;
|
||||
highlight_inactive_file_icons = cfg.highlightInactiveFileIcons;
|
||||
highlight_visible = cfg.highlightVisible;
|
||||
icons = let
|
||||
handleBufferOption = bufferOption:
|
||||
with bufferOption; {
|
||||
icons =
|
||||
let
|
||||
handleBufferOption =
|
||||
bufferOption: with bufferOption; {
|
||||
buffer_index = bufferIndex;
|
||||
buffer_number = bufferNumber;
|
||||
inherit button;
|
||||
|
@ -255,25 +237,19 @@ in {
|
|||
*/
|
||||
let
|
||||
setIcons = filterAttrs (n: v: v != null) cfg.icons.diagnostics;
|
||||
setIconsList =
|
||||
mapAttrsToList
|
||||
(name: value: {
|
||||
setIconsList = mapAttrsToList (name: value: {
|
||||
key = "vim.diagnostic.severity.${strings.toUpper name}";
|
||||
value = helpers.ifNonNull' value (helpers.toLuaObject {
|
||||
value = helpers.ifNonNull' value (
|
||||
helpers.toLuaObject {
|
||||
enabled = value.enable;
|
||||
inherit (value) icon;
|
||||
});
|
||||
})
|
||||
setIcons;
|
||||
}
|
||||
);
|
||||
}) setIcons;
|
||||
in
|
||||
helpers.mkRaw (
|
||||
"{"
|
||||
+ concatStringsSep ","
|
||||
(
|
||||
map
|
||||
(iconOption: "[${iconOption.key}] = ${iconOption.value}")
|
||||
setIconsList
|
||||
)
|
||||
+ concatStringsSep "," (map (iconOption: "[${iconOption.key}] = ${iconOption.value}") setIconsList)
|
||||
+ "}"
|
||||
);
|
||||
filetype = with filetype; {
|
||||
|
@ -283,33 +259,22 @@ in {
|
|||
inherit separator;
|
||||
};
|
||||
|
||||
handleStateOption = stateOption:
|
||||
handleStateOption =
|
||||
stateOption:
|
||||
with stateOption;
|
||||
{
|
||||
modified = handleBufferOption modified;
|
||||
pinned = handleBufferOption pinned;
|
||||
}
|
||||
// (
|
||||
handleBufferOption
|
||||
(
|
||||
getAttrs (attrNames stateOption)
|
||||
stateOption
|
||||
)
|
||||
);
|
||||
// (handleBufferOption (getAttrs (attrNames stateOption) stateOption));
|
||||
in
|
||||
(
|
||||
handleStateOption
|
||||
(
|
||||
getAttrs
|
||||
(attrNames stateOptions)
|
||||
cfg.icons
|
||||
)
|
||||
)
|
||||
// (
|
||||
genAttrs
|
||||
["alternate" "current" "inactive" "visible"]
|
||||
(optionName: handleStateOption cfg.icons.${optionName})
|
||||
);
|
||||
(handleStateOption (getAttrs (attrNames stateOptions) cfg.icons))
|
||||
// (genAttrs [
|
||||
"alternate"
|
||||
"current"
|
||||
"inactive"
|
||||
"visible"
|
||||
] (optionName: handleStateOption cfg.icons.${optionName}));
|
||||
inherit (cfg) hide;
|
||||
insert_at_end = cfg.insertAtEnd;
|
||||
insert_at_start = cfg.insertAtStart;
|
||||
|
@ -320,27 +285,21 @@ in {
|
|||
inherit (cfg) letters;
|
||||
no_name_title = cfg.noNameTitle;
|
||||
sidebar_filetypes = cfg.sidebarFiletypes;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
} // cfg.extraOptions;
|
||||
|
||||
keymaps =
|
||||
flatten
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
optionName: funcName: let
|
||||
keymaps = flatten (
|
||||
mapAttrsToList (
|
||||
optionName: funcName:
|
||||
let
|
||||
key = cfg.keymaps.${optionName};
|
||||
in
|
||||
optional
|
||||
(key != null)
|
||||
{
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = "<Cmd>Buffer${funcName}<CR>";
|
||||
options.silent = cfg.keymaps.silent;
|
||||
}
|
||||
)
|
||||
keymapsActions
|
||||
) keymapsActions
|
||||
);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.barbecue;
|
||||
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
|
||||
in {
|
||||
options.plugins.barbecue =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.barbecue = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "barbecue-nvim";
|
||||
|
||||
package = helpers.mkPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
|
||||
|
@ -120,13 +120,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
kinds =
|
||||
mapAttrs
|
||||
(
|
||||
name: default:
|
||||
helpers.defaultNullOpts.mkStr default "icon for ${name}."
|
||||
)
|
||||
{
|
||||
kinds = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
|
||||
File = "";
|
||||
Module = "";
|
||||
Namespace = "";
|
||||
|
@ -156,19 +150,17 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
attach_navic = attachNavic;
|
||||
create_autocmd = createAutocmd;
|
||||
include_buftypes = includeBuftypes;
|
||||
exclude_filetypes = excludeFiletypes;
|
||||
modifiers = {
|
||||
inherit
|
||||
(modifiers)
|
||||
dirname
|
||||
basename
|
||||
;
|
||||
inherit (modifiers) dirname basename;
|
||||
};
|
||||
show_dirname = showDirname;
|
||||
show_basename = showBasename;
|
||||
|
@ -180,12 +172,7 @@ in {
|
|||
inherit theme;
|
||||
context_follow_icon_color = contextFollowIconColor;
|
||||
symbols = {
|
||||
inherit
|
||||
(symbols)
|
||||
modified
|
||||
ellipsis
|
||||
separator
|
||||
;
|
||||
inherit (symbols) modified ellipsis separator;
|
||||
};
|
||||
inherit kinds;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.bufferline;
|
||||
|
||||
highlightOptions = {
|
||||
|
@ -88,28 +89,31 @@ with lib; let
|
|||
|
||||
trunc_marker = "trunkMarker";
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.bufferline =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
plugins.bufferline = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "bufferline";
|
||||
|
||||
package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim;
|
||||
|
||||
mode = helpers.defaultNullOpts.mkEnumFirstDefault ["buffers" "tabs"] "mode";
|
||||
mode = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"buffers"
|
||||
"tabs"
|
||||
] "mode";
|
||||
|
||||
themable =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether or not bufferline highlights can be overridden externally";
|
||||
themable = helpers.defaultNullOpts.mkBool true "Whether or not bufferline highlights can be overridden externally";
|
||||
|
||||
numbers =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
(enum ["none" "ordinal" "buffer_id" "both"])
|
||||
helpers.nixvimTypes.rawLua
|
||||
either (enum [
|
||||
"none"
|
||||
"ordinal"
|
||||
"buffer_id"
|
||||
"both"
|
||||
]) helpers.nixvimTypes.rawLua
|
||||
)
|
||||
"none"
|
||||
''
|
||||
|
@ -123,45 +127,41 @@ in {
|
|||
|
||||
bufferCloseIcon = helpers.defaultNullOpts.mkStr "" "The close icon for each buffer.";
|
||||
|
||||
modifiedIcon =
|
||||
helpers.defaultNullOpts.mkStr "●"
|
||||
"The icon indicating a buffer was modified.";
|
||||
modifiedIcon = helpers.defaultNullOpts.mkStr "●" "The icon indicating a buffer was modified.";
|
||||
|
||||
closeIcon = helpers.defaultNullOpts.mkStr "" "The close icon.";
|
||||
|
||||
closeCommand =
|
||||
helpers.defaultNullOpts.mkStr "bdelete! %d"
|
||||
"Command or function run when closing a buffer.";
|
||||
closeCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when closing a buffer.";
|
||||
|
||||
leftMouseCommand =
|
||||
helpers.defaultNullOpts.mkStr "buffer %d"
|
||||
"Command or function run when clicking on a buffer.";
|
||||
leftMouseCommand = helpers.defaultNullOpts.mkStr "buffer %d" "Command or function run when clicking on a buffer.";
|
||||
|
||||
rightMouseCommand =
|
||||
helpers.defaultNullOpts.mkStr "bdelete! %d"
|
||||
"Command or function run when right clicking on a buffer.";
|
||||
rightMouseCommand = helpers.defaultNullOpts.mkStr "bdelete! %d" "Command or function run when right clicking on a buffer.";
|
||||
|
||||
middleMouseCommand =
|
||||
helpers.defaultNullOpts.mkStr "null"
|
||||
"Command or function run when middle clicking on a buffer.";
|
||||
middleMouseCommand = helpers.defaultNullOpts.mkStr "null" "Command or function run when middle clicking on a buffer.";
|
||||
|
||||
indicator = {
|
||||
icon = helpers.defaultNullOpts.mkStr "▎" "icon";
|
||||
|
||||
style = helpers.defaultNullOpts.mkEnumFirstDefault ["icon" "underline"] "style";
|
||||
style = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"icon"
|
||||
"underline"
|
||||
] "style";
|
||||
};
|
||||
|
||||
leftTruncMarker = helpers.defaultNullOpts.mkStr "" "left trunc marker";
|
||||
|
||||
rightTruncMarker = helpers.defaultNullOpts.mkStr "" "right trunc marker";
|
||||
|
||||
separatorStyle =
|
||||
helpers.defaultNullOpts.mkEnum ["slant" "padded_slant" "slope" "padded_slope" "thick" "thin"] "thin"
|
||||
"Separator style";
|
||||
separatorStyle = helpers.defaultNullOpts.mkEnum [
|
||||
"slant"
|
||||
"padded_slant"
|
||||
"slope"
|
||||
"padded_slope"
|
||||
"thick"
|
||||
"thin"
|
||||
] "thin" "Separator style";
|
||||
|
||||
nameFormatter =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
''
|
||||
nameFormatter = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A lua function that can be used to modify the buffer's label.
|
||||
The argument 'buf' containing a name, path and bufnr is supplied.
|
||||
'';
|
||||
|
@ -178,9 +178,7 @@ in {
|
|||
|
||||
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
|
||||
|
||||
getElementIcon =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
''
|
||||
getElementIcon = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
Lua function returning an element icon.
|
||||
|
||||
```
|
||||
|
@ -190,53 +188,39 @@ in {
|
|||
|
||||
showCloseIcon = helpers.defaultNullOpts.mkBool true "Whether to show the close icon.";
|
||||
|
||||
showTabIndicators =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to show the tab indicators.";
|
||||
showTabIndicators = helpers.defaultNullOpts.mkBool true "Whether to show the tab indicators.";
|
||||
|
||||
showDuplicatePrefix =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to show the prefix of duplicated files.";
|
||||
showDuplicatePrefix = helpers.defaultNullOpts.mkBool true "Whether to show the prefix of duplicated files.";
|
||||
|
||||
enforceRegularTabs =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Whether to enforce regular tabs.";
|
||||
enforceRegularTabs = helpers.defaultNullOpts.mkBool false "Whether to enforce regular tabs.";
|
||||
|
||||
alwaysShowBufferline =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to always show the bufferline.";
|
||||
alwaysShowBufferline = helpers.defaultNullOpts.mkBool true "Whether to always show the bufferline.";
|
||||
|
||||
persistBufferSort =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to make the buffer sort persistent.";
|
||||
persistBufferSort = helpers.defaultNullOpts.mkBool true "Whether to make the buffer sort persistent.";
|
||||
|
||||
maxPrefixLength = helpers.defaultNullOpts.mkInt 15 "Maximum prefix length";
|
||||
|
||||
sortBy = helpers.defaultNullOpts.mkStr "id" "sort by";
|
||||
|
||||
diagnostics =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; either bool (enum ["nvim_lsp" "coc"])) "false" "diagnostics";
|
||||
diagnostics = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
either bool (enum [
|
||||
"nvim_lsp"
|
||||
"coc"
|
||||
])
|
||||
) "false" "diagnostics";
|
||||
|
||||
diagnosticsIndicator =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
"Either `null` or a function that returns the diagnostics indicator.";
|
||||
diagnosticsIndicator = helpers.defaultNullOpts.mkLuaFn "null" "Either `null` or a function that returns the diagnostics indicator.";
|
||||
|
||||
diagnosticsUpdateInInsert =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether diagnostics should update in insert mode";
|
||||
diagnosticsUpdateInInsert = helpers.defaultNullOpts.mkBool true "Whether diagnostics should update in insert mode";
|
||||
|
||||
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
|
||||
|
||||
groups = {
|
||||
items =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]"
|
||||
"List of groups.";
|
||||
items = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" "List of groups.";
|
||||
|
||||
options = {
|
||||
toggleHiddenOnEnter =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Re-open hidden groups on bufenter.";
|
||||
toggleHiddenOnEnter = helpers.defaultNullOpts.mkBool true "Re-open hidden groups on bufenter.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -252,18 +236,13 @@ in {
|
|||
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
|
||||
};
|
||||
|
||||
customFilter =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
''
|
||||
customFilter = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
```
|
||||
fun(buf: number, bufnums: number[]): boolean
|
||||
```
|
||||
'';
|
||||
|
||||
highlights =
|
||||
genAttrs
|
||||
(attrValues highlightOptions)
|
||||
(
|
||||
highlights = genAttrs (attrValues highlightOptions) (
|
||||
name:
|
||||
helpers.mkNullOrOption helpers.nixvimTypes.highlight ''
|
||||
Highlight group definition for ${name}.
|
||||
|
@ -272,15 +251,11 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
options =
|
||||
{
|
||||
inherit
|
||||
mode
|
||||
themable
|
||||
numbers
|
||||
;
|
||||
options = {
|
||||
inherit mode themable numbers;
|
||||
buffer_close_icon = bufferCloseIcon;
|
||||
modified_icon = modifiedIcon;
|
||||
close_icon = closeIcon;
|
||||
|
@ -319,27 +294,17 @@ in {
|
|||
};
|
||||
};
|
||||
hover = {
|
||||
inherit
|
||||
(hover)
|
||||
enabled
|
||||
reveal
|
||||
delay
|
||||
;
|
||||
inherit (hover) enabled reveal delay;
|
||||
};
|
||||
debug = {
|
||||
inherit (debug) logging;
|
||||
};
|
||||
custom_filter = customFilter;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
} // cfg.extraOptions;
|
||||
|
||||
highlights =
|
||||
mapAttrs
|
||||
(
|
||||
pluginOptionName: nixvimOptionName:
|
||||
cfg.highlights.${nixvimOptionName}
|
||||
)
|
||||
highlightOptions;
|
||||
highlights = mapAttrs (
|
||||
pluginOptionName: nixvimOptionName: cfg.highlights.${nixvimOptionName}
|
||||
) highlightOptions;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -5,23 +5,17 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.navic;
|
||||
in {
|
||||
options.plugins.navic =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.navic = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-navic";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
|
||||
|
||||
icons =
|
||||
mapAttrs
|
||||
(
|
||||
name: default:
|
||||
helpers.defaultNullOpts.mkStr default "icon for ${name}."
|
||||
)
|
||||
{
|
||||
icons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
|
||||
File = " ";
|
||||
Module = " ";
|
||||
Namespace = " ";
|
||||
|
@ -91,8 +85,10 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit
|
||||
icons
|
||||
|
|
|
@ -28,11 +28,7 @@ with lib;
|
|||
Set to `true` to use `mirage` variant instead of `dark` for dark background.
|
||||
'';
|
||||
|
||||
overrides =
|
||||
helpers.defaultNullOpts.mkStrLuaOr
|
||||
(with helpers.nixvimTypes; attrsOf highlight)
|
||||
"{}"
|
||||
''
|
||||
overrides = helpers.defaultNullOpts.mkStrLuaOr (with helpers.nixvimTypes; attrsOf highlight) "{}" ''
|
||||
A dictionary of group names, each associated with a dictionary of parameters
|
||||
(`bg`, `fg`, `sp` and `style`) and colors in hex.
|
||||
|
||||
|
|
|
@ -20,47 +20,60 @@ with lib;
|
|||
colorscheme = null;
|
||||
|
||||
# TODO introduced 2024-03-12: remove 2024-05-12
|
||||
imports = let
|
||||
basePluginPath = ["colorschemes" "base16"];
|
||||
in [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["customColorScheme"])
|
||||
(basePluginPath ++ ["colorscheme"])
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["useTruecolor"])
|
||||
["options" "termguicolors"]
|
||||
)
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"colorschemes"
|
||||
"base16"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "customColorScheme" ]) (
|
||||
basePluginPath ++ [ "colorscheme" ]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "useTruecolor" ]) [
|
||||
"options"
|
||||
"termguicolors"
|
||||
])
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
colorscheme = let
|
||||
colorscheme =
|
||||
let
|
||||
customColorschemeType = types.submodule {
|
||||
options =
|
||||
listToAttrs
|
||||
(
|
||||
options = listToAttrs (
|
||||
map
|
||||
(
|
||||
colorId: rec {
|
||||
(colorId: rec {
|
||||
name = "base0" + colorId;
|
||||
value = mkOption {
|
||||
type = types.str;
|
||||
description = "The value for color `${name}`.";
|
||||
example = "#16161D";
|
||||
};
|
||||
}
|
||||
)
|
||||
["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"]
|
||||
})
|
||||
[
|
||||
"0"
|
||||
"1"
|
||||
"2"
|
||||
"3"
|
||||
"4"
|
||||
"5"
|
||||
"6"
|
||||
"7"
|
||||
"8"
|
||||
"9"
|
||||
"A"
|
||||
"B"
|
||||
"C"
|
||||
"D"
|
||||
"E"
|
||||
"F"
|
||||
]
|
||||
);
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
type = with types;
|
||||
either
|
||||
(enum (import ./theme-list.nix))
|
||||
customColorschemeType;
|
||||
type = with types; either (enum (import ./theme-list.nix)) customColorschemeType;
|
||||
description = ''
|
||||
The base16 colorscheme to use.
|
||||
It can either be the name of a builtin colorscheme or an attrs specifying each color explicitly.
|
||||
|
@ -97,7 +110,8 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg:
|
||||
extraConfig =
|
||||
cfg:
|
||||
mkMerge [
|
||||
{
|
||||
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
|
||||
|
@ -106,9 +120,7 @@ with lib;
|
|||
|
||||
opts.termguicolors = mkDefault true;
|
||||
}
|
||||
(mkIf (isString cfg.colorscheme) {
|
||||
colorscheme = "base16-${cfg.colorscheme}";
|
||||
})
|
||||
(mkIf (isString cfg.colorscheme) { colorscheme = "base16-${cfg.colorscheme}"; })
|
||||
(mkIf (isAttrs cfg.colorscheme) {
|
||||
extraConfigLuaPre = ''
|
||||
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
|
||||
|
|
|
@ -16,34 +16,95 @@ with lib;
|
|||
# TODO introduced 2024-03-27: remove 2024-05-27
|
||||
optionsRenamedToSettings = [
|
||||
"flavour"
|
||||
["background" "light"]
|
||||
["background" "dark"]
|
||||
[
|
||||
"background"
|
||||
"light"
|
||||
]
|
||||
[
|
||||
"background"
|
||||
"dark"
|
||||
]
|
||||
"transparentBackground"
|
||||
["dimInactive" "enabled"]
|
||||
["dimInactive" "shade"]
|
||||
["dimInactive" "percentage"]
|
||||
["styles" "comments"]
|
||||
["styles" "conditionals"]
|
||||
["styles" "loops"]
|
||||
["styles" "functions"]
|
||||
["styles" "keywords"]
|
||||
["styles" "strings"]
|
||||
["styles" "variables"]
|
||||
["styles" "numbers"]
|
||||
["styles" "booleans"]
|
||||
["styles" "properties"]
|
||||
["styles" "types"]
|
||||
["styles" "operators"]
|
||||
[
|
||||
"dimInactive"
|
||||
"enabled"
|
||||
]
|
||||
[
|
||||
"dimInactive"
|
||||
"shade"
|
||||
]
|
||||
[
|
||||
"dimInactive"
|
||||
"percentage"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"comments"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"conditionals"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"loops"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"functions"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"keywords"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"strings"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"variables"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"numbers"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"booleans"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"properties"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"types"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"operators"
|
||||
]
|
||||
"colorOverrides"
|
||||
"customHighlights"
|
||||
"integrations"
|
||||
];
|
||||
imports =
|
||||
mapAttrsToList (
|
||||
mapAttrsToList
|
||||
(
|
||||
old: new:
|
||||
mkRenamedOptionModule
|
||||
["colorschemes" "catppuccin" old]
|
||||
["colorschemes" "catppuccin" "settings" new]
|
||||
[
|
||||
"colorschemes"
|
||||
"catppuccin"
|
||||
old
|
||||
]
|
||||
[
|
||||
"colorschemes"
|
||||
"catppuccin"
|
||||
"settings"
|
||||
new
|
||||
]
|
||||
)
|
||||
{
|
||||
showBufferEnd = "show_end_of_buffer";
|
||||
|
@ -53,29 +114,31 @@ with lib;
|
|||
disableUnderline = "no_underline";
|
||||
};
|
||||
|
||||
settingsOptions = let
|
||||
settingsOptions =
|
||||
let
|
||||
flavours = [
|
||||
"latte"
|
||||
"mocha"
|
||||
"frappe"
|
||||
"macchiato"
|
||||
];
|
||||
in {
|
||||
compile_path =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath 'cache' .. '/catppuccin'";}''
|
||||
"Set the compile cache directory.";
|
||||
in
|
||||
{
|
||||
compile_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath 'cache' .. '/catppuccin'";}'' "Set the compile cache directory.";
|
||||
|
||||
flavour = helpers.mkNullOrOption (types.enum (flavours ++ [ "auto" ])) ''
|
||||
Theme flavour.
|
||||
'';
|
||||
|
||||
background = let
|
||||
mkBackgroundStyle = name:
|
||||
background =
|
||||
let
|
||||
mkBackgroundStyle =
|
||||
name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault flavours ''
|
||||
Background for `${name}` background.
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
light = mkBackgroundStyle "light";
|
||||
|
||||
dark = mkBackgroundStyle "dark";
|
||||
|
@ -169,17 +232,13 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
color_overrides =
|
||||
genAttrs
|
||||
(flavours ++ ["all"])
|
||||
(
|
||||
color_overrides = genAttrs (flavours ++ [ "all" ]) (
|
||||
flavour:
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
"{}"
|
||||
(
|
||||
if flavour == "all"
|
||||
then "Override colors for all the flavours."
|
||||
else "Override colors for the ${flavour} flavour."
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str "{}" (
|
||||
if flavour == "all" then
|
||||
"Override colors for all the flavours."
|
||||
else
|
||||
"Override colors for the ${flavour} flavour."
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -236,7 +295,10 @@ with lib;
|
|||
term_colors = true;
|
||||
color_overrides.mocha.base = "#1e1e2f";
|
||||
styles = {
|
||||
booleans = ["bold" "italic"];
|
||||
booleans = [
|
||||
"bold"
|
||||
"italic"
|
||||
];
|
||||
conditionals = [ "bold" ];
|
||||
};
|
||||
integrations = {
|
||||
|
@ -252,7 +314,5 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.colorschemes.dracula;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
colorschemes.dracula = {
|
||||
enable = mkEnableOption "dracula";
|
||||
|
|
|
@ -19,9 +19,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
|||
map
|
||||
(
|
||||
optionName:
|
||||
lib.mkRemovedOptionModule
|
||||
["colorschemes" "gruvbox" optionName]
|
||||
"Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
|
||||
lib.mkRemovedOptionModule [
|
||||
"colorschemes"
|
||||
"gruvbox"
|
||||
optionName
|
||||
] "Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
|
||||
)
|
||||
[
|
||||
"italics"
|
||||
|
|
|
@ -22,16 +22,19 @@ with lib;
|
|||
|
||||
# TODO introduced 2024-03-15: remove 2024-05-15
|
||||
deprecateExtraOptions = true;
|
||||
imports = let
|
||||
basePluginPath = ["colorschemes" "kanagawa"];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"colorschemes"
|
||||
"kanagawa"
|
||||
];
|
||||
in
|
||||
(
|
||||
map
|
||||
(map
|
||||
(
|
||||
optionPath:
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(basePluginPath ++ ["settings"] ++ optionPath)
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (
|
||||
basePluginPath ++ [ "settings" ] ++ optionPath
|
||||
)
|
||||
)
|
||||
[
|
||||
[ "compile" ]
|
||||
|
@ -44,26 +47,34 @@ with lib;
|
|||
[ "transparent" ]
|
||||
[ "dimInactive" ]
|
||||
[ "terminalColors" ]
|
||||
["colors" "palette"]
|
||||
["colors" "theme"]
|
||||
[
|
||||
"colors"
|
||||
"palette"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"theme"
|
||||
]
|
||||
[ "theme" ]
|
||||
["background" "dark"]
|
||||
["background" "light"]
|
||||
[
|
||||
"background"
|
||||
"dark"
|
||||
]
|
||||
[
|
||||
"background"
|
||||
"light"
|
||||
]
|
||||
]
|
||||
)
|
||||
++ [
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["overrides"])
|
||||
''
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "overrides" ]) ''
|
||||
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
|
||||
```
|
||||
function(colors)
|
||||
...
|
||||
end
|
||||
```
|
||||
''
|
||||
)
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
|
|
|
@ -14,7 +14,5 @@ with lib;
|
|||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -24,7 +24,5 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
allow_italics = true;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = lib.mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -13,7 +13,5 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = lib.mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -51,25 +51,22 @@ with lib;
|
|||
mapAttrs
|
||||
(
|
||||
name: colorNames:
|
||||
helpers.defaultNullOpts.mkAttrsOf (
|
||||
types.submodule {
|
||||
options =
|
||||
genAttrs
|
||||
colorNames
|
||||
(
|
||||
helpers.defaultNullOpts.mkAttrsOf
|
||||
(types.submodule {
|
||||
options = genAttrs colorNames (
|
||||
colorName:
|
||||
mkOption {
|
||||
type = types.str;
|
||||
description = "Definition of color '${colorName}'";
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
})
|
||||
"{}"
|
||||
''
|
||||
Custom palettes for ${name} colors.
|
||||
''
|
||||
) {
|
||||
)
|
||||
{
|
||||
main = [
|
||||
"color0"
|
||||
"color1"
|
||||
|
@ -113,23 +110,23 @@ with lib;
|
|||
Whether to enable caching.
|
||||
'';
|
||||
|
||||
cache_dir =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath('cache') .. '/palette'";}''
|
||||
"Cache directory.";
|
||||
cache_dir = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/palette'";}'' "Cache directory.";
|
||||
};
|
||||
|
||||
settingsExample = { };
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions =
|
||||
mapAttrsToList (
|
||||
name: defaultPaletteNames: let
|
||||
mapAttrsToList
|
||||
(
|
||||
name: defaultPaletteNames:
|
||||
let
|
||||
customPalettesNames = attrNames cfg.settings.custom_palettes.${name};
|
||||
allowedPaletteNames = customPalettesNames ++ defaultPaletteNames;
|
||||
|
||||
palette = cfg.settings.palettes.${name};
|
||||
in {
|
||||
in
|
||||
{
|
||||
assertion = isString palette -> elem palette allowedPaletteNames;
|
||||
message = ''
|
||||
Nixvim (colorschemes.palette): `settings.palettes.${name}` (${palette}") is not part of the allowed ${name} palette names (${concatStringsSep " " allowedPaletteNames}).
|
||||
|
@ -137,9 +134,20 @@ with lib;
|
|||
}
|
||||
)
|
||||
{
|
||||
main = ["dark" "light"];
|
||||
accent = ["pastel" "dark" "bright"];
|
||||
state = ["pastel" "dark" "bright"];
|
||||
main = [
|
||||
"dark"
|
||||
"light"
|
||||
];
|
||||
accent = [
|
||||
"pastel"
|
||||
"dark"
|
||||
"bright"
|
||||
];
|
||||
state = [
|
||||
"pastel"
|
||||
"dark"
|
||||
"bright"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,48 +18,69 @@ with lib;
|
|||
"groups"
|
||||
"highlightGroups"
|
||||
];
|
||||
imports = let
|
||||
basePluginPath = ["colorschemes" "rose-pine"];
|
||||
in [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["style"])
|
||||
(basePluginPath ++ ["settings" "dark_variant"])
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["dimInactive"])
|
||||
(basePluginPath ++ ["settings" "dim_inactive_windows"])
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["disableItalics"])
|
||||
"Use `colorschemes.rose-pine.settings.enable.italics` instead."
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["boldVerticalSplit"])
|
||||
"Use `colorschemes.rose-pine.settings.highlight_groups` instead."
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["transparentFloat"])
|
||||
"Use `colorschemes.rose-pine.settings.highlight_groups.NormalFloat` instead."
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ ["transparentBackground"])
|
||||
(basePluginPath ++ ["settings" "enable" "transparency"])
|
||||
)
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"colorschemes"
|
||||
"rose-pine"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "style" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"dark_variant"
|
||||
]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "dimInactive" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"dim_inactive_windows"
|
||||
]
|
||||
))
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "disableItalics" ]
|
||||
) "Use `colorschemes.rose-pine.settings.enable.italics` instead.")
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "boldVerticalSplit" ]
|
||||
) "Use `colorschemes.rose-pine.settings.highlight_groups` instead.")
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "transparentFloat" ]
|
||||
) "Use `colorschemes.rose-pine.settings.highlight_groups.NormalFloat` instead.")
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "transparentBackground" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"enable"
|
||||
"transparency"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
variant = helpers.mkNullOrOption (types.enum ["auto" "main" "moon" "dawn"]) ''
|
||||
variant =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"auto"
|
||||
"main"
|
||||
"moon"
|
||||
"dawn"
|
||||
])
|
||||
''
|
||||
Set the desired variant: "auto" will follow the vim background, defaulting to `dark_variant`
|
||||
or "main" for dark and "dawn" for light.
|
||||
'';
|
||||
|
||||
dark_variant = helpers.defaultNullOpts.mkEnumFirstDefault ["main" "moon" "dawn"] ''
|
||||
dark_variant =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"main"
|
||||
"moon"
|
||||
"dawn"
|
||||
]
|
||||
''
|
||||
Set the desired dark variant when `settings.variant` is set to "auto".
|
||||
'';
|
||||
|
||||
|
@ -135,7 +156,5 @@ with lib;
|
|||
before_highlight = "function(group, highlight, palette) end";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -19,12 +19,30 @@ with lib;
|
|||
"style"
|
||||
"transparent"
|
||||
"terminalColors"
|
||||
["styles" "comments"]
|
||||
["styles" "keywords"]
|
||||
["styles" "functions"]
|
||||
["styles" "variables"]
|
||||
["styles" "sidebars"]
|
||||
["styles" "floats"]
|
||||
[
|
||||
"styles"
|
||||
"comments"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"keywords"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"functions"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"variables"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"sidebars"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"floats"
|
||||
]
|
||||
"sidebars"
|
||||
"dayBrightness"
|
||||
"hideInactiveStatusline"
|
||||
|
@ -35,7 +53,14 @@ with lib;
|
|||
];
|
||||
|
||||
settingsOptions = {
|
||||
style = helpers.defaultNullOpts.mkEnumFirstDefault ["storm" "night" "day"] ''
|
||||
style =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"storm"
|
||||
"night"
|
||||
"day"
|
||||
]
|
||||
''
|
||||
The theme comes in three styles, `storm`, a darker variant `night` and `day`.
|
||||
'';
|
||||
|
||||
|
@ -51,11 +76,17 @@ with lib;
|
|||
Configure the colors used when opening a :terminal in Neovim
|
||||
'';
|
||||
|
||||
styles = let
|
||||
mkBackgroundStyle = name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
|
||||
"Background style for ${name}";
|
||||
in {
|
||||
styles =
|
||||
let
|
||||
mkBackgroundStyle =
|
||||
name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"dark"
|
||||
"transparent"
|
||||
"normal"
|
||||
] "Background style for ${name}";
|
||||
in
|
||||
{
|
||||
comments = helpers.defaultNullOpts.mkHighlight "{italic = true;}" "" ''
|
||||
Define comments highlight properties.
|
||||
'';
|
||||
|
@ -126,7 +157,12 @@ with lib;
|
|||
sidebars = "dark";
|
||||
floats = "dark";
|
||||
};
|
||||
sidebars = ["qf" "vista_kind" "terminal" "packer"];
|
||||
sidebars = [
|
||||
"qf"
|
||||
"vista_kind"
|
||||
"terminal"
|
||||
"packer"
|
||||
];
|
||||
day_brightness = 0.3;
|
||||
hide_inactive_statusline = false;
|
||||
dim_inactive = false;
|
||||
|
@ -135,7 +171,5 @@ with lib;
|
|||
on_highlights = "function(highlights, colors) end";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -21,17 +21,13 @@ with lib;
|
|||
italic_comments = helpers.defaultNullOpts.mkBool false "Whether to enable italic comments";
|
||||
underline_links = helpers.defaultNullOpts.mkBool false "Whether to underline links";
|
||||
disable_nvimtree_bg = helpers.defaultNullOpts.mkBool true "Whether to disable nvim-tree background";
|
||||
color_overrides =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
"{}"
|
||||
''
|
||||
color_overrides = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
A dictionary of color overrides.
|
||||
See https://github.com/Mofiqul/vscode.nvim/blob/main/lua/vscode/colors.lua for color names.
|
||||
'';
|
||||
group_overrides = with helpers;
|
||||
defaultNullOpts.mkAttrsOf nixvimTypes.highlight
|
||||
"{}"
|
||||
''
|
||||
group_overrides =
|
||||
with helpers;
|
||||
defaultNullOpts.mkAttrsOf nixvimTypes.highlight "{}" ''
|
||||
A dictionary of group names, each associated with a dictionary of parameters
|
||||
(`bg`, `fg`, `sp` and `style`) and colors in hex.
|
||||
'';
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
...
|
||||
}:
|
||||
with helpers.vim-plugin;
|
||||
with lib; rec {
|
||||
mkCmpSourcePlugin = {
|
||||
with lib;
|
||||
rec {
|
||||
mkCmpSourcePlugin =
|
||||
{
|
||||
name,
|
||||
extraPlugins ? [ ],
|
||||
useDefaultPackage ? true,
|
||||
|
@ -20,62 +22,40 @@ with lib; rec {
|
|||
maintainers = [ maintainers.GaetanLepage ];
|
||||
};
|
||||
|
||||
extractSourcesFromOptionValue = sources:
|
||||
if isList sources
|
||||
then sources
|
||||
else [];
|
||||
extractSourcesFromOptionValue = sources: if isList sources then sources else [ ];
|
||||
|
||||
autoInstallSourcePluginsModule = cfg: let
|
||||
autoInstallSourcePluginsModule =
|
||||
cfg:
|
||||
let
|
||||
# cfg.setup.sources
|
||||
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
|
||||
# cfg.filetype.<name>.sources
|
||||
filetypeSources =
|
||||
mapAttrsToList
|
||||
(_: filetypeConfig:
|
||||
extractSourcesFromOptionValue filetypeConfig.sources)
|
||||
cfg.filetype;
|
||||
filetypeSources = mapAttrsToList (
|
||||
_: filetypeConfig: extractSourcesFromOptionValue filetypeConfig.sources
|
||||
) cfg.filetype;
|
||||
# cfg.cmdline.<name>.sources
|
||||
cmdlineSources =
|
||||
mapAttrsToList
|
||||
(_: cmdlineConfig:
|
||||
extractSourcesFromOptionValue cmdlineConfig.sources)
|
||||
cfg.cmdline;
|
||||
cmdlineSources = mapAttrsToList (
|
||||
_: cmdlineConfig: extractSourcesFromOptionValue cmdlineConfig.sources
|
||||
) cfg.cmdline;
|
||||
|
||||
# [{name = "foo";} {name = "bar"; x = 42;} ...]
|
||||
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
|
||||
|
||||
# Take only the names from the sources provided by the user
|
||||
# ["foo" "bar"]
|
||||
foundSources =
|
||||
lists.unique
|
||||
(
|
||||
map
|
||||
(source: source.name)
|
||||
allSources
|
||||
);
|
||||
foundSources = lists.unique (map (source: source.name) allSources);
|
||||
|
||||
# If the user has enabled the `foo` and `bar` sources, this attrs will look like:
|
||||
# {
|
||||
# cmp-foo.enable = true;
|
||||
# cmp-bar.enable = true;
|
||||
# }
|
||||
attrsEnabled =
|
||||
mapAttrs'
|
||||
(
|
||||
sourceName: pluginName: {
|
||||
attrsEnabled = mapAttrs' (sourceName: pluginName: {
|
||||
name = pluginName;
|
||||
value.enable =
|
||||
mkIf
|
||||
(elem sourceName foundSources)
|
||||
true;
|
||||
}
|
||||
)
|
||||
(import ./sources.nix);
|
||||
value.enable = mkIf (elem sourceName foundSources) true;
|
||||
}) (import ./sources.nix);
|
||||
|
||||
lspCapabilities =
|
||||
mkIf
|
||||
(elem "nvim_lsp" foundSources)
|
||||
{
|
||||
lspCapabilities = mkIf (elem "nvim_lsp" foundSources) {
|
||||
lsp.capabilities = ''
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
'';
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ args: let
|
||||
}@args:
|
||||
let
|
||||
cmpOptions = import ./options { inherit lib helpers; };
|
||||
in
|
||||
with lib;
|
||||
|
@ -39,7 +40,9 @@ in
|
|||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
warnings = optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources)) ''
|
||||
warnings =
|
||||
optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources))
|
||||
''
|
||||
Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically
|
||||
enable the source plugins with respect to the list of sources provided in `settings.sources`.
|
||||
However, the latter is proveded as a raw lua string which is not parseable by Nixvim.
|
||||
|
@ -55,26 +58,16 @@ in
|
|||
cmp.setup(${helpers.toLuaObject cfg.settings})
|
||||
|
||||
''
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.filetype
|
||||
)
|
||||
)
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
) cfg.filetype
|
||||
))
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.cmdline
|
||||
)
|
||||
);
|
||||
) cfg.cmdline
|
||||
));
|
||||
|
||||
# If autoEnableSources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
|
|
|
@ -1,140 +1,335 @@
|
|||
{ lib, ... }:
|
||||
with lib; let
|
||||
oldPluginBasePath = ["plugins" "nvim-cmp"];
|
||||
newPluginBasePath = ["plugins" "cmp"];
|
||||
with lib;
|
||||
let
|
||||
oldPluginBasePath = [
|
||||
"plugins"
|
||||
"nvim-cmp"
|
||||
];
|
||||
newPluginBasePath = [
|
||||
"plugins"
|
||||
"cmp"
|
||||
];
|
||||
settingsPath = newPluginBasePath ++ [ "settings" ];
|
||||
|
||||
renamedOptions = [
|
||||
{old = ["performance" "debounce"];}
|
||||
{old = ["performance" "throttle"];}
|
||||
{
|
||||
old = ["performance" "fetchingTimeout"];
|
||||
new = ["performance" "fetching_timeout"];
|
||||
old = [
|
||||
"performance"
|
||||
"debounce"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["performance" "asyncBudget"];
|
||||
new = ["performance" "async_budget"];
|
||||
old = [
|
||||
"performance"
|
||||
"throttle"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["performance" "maxViewEntries"];
|
||||
new = ["performance" "max_view_entries"];
|
||||
old = [
|
||||
"performance"
|
||||
"fetchingTimeout"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"fetching_timeout"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"performance"
|
||||
"asyncBudget"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"async_budget"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"performance"
|
||||
"maxViewEntries"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"max_view_entries"
|
||||
];
|
||||
}
|
||||
{ old = [ "mapping" ]; }
|
||||
{
|
||||
old = ["completion" "keywordLength"];
|
||||
new = ["completion" "keyword_length"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordLength"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_length"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["completion" "keywordPattern"];
|
||||
new = ["completion" "keyword_pattern"];
|
||||
}
|
||||
{old = ["completion" "autocomplete"];}
|
||||
{old = ["completion" "completeopt"];}
|
||||
{
|
||||
old = ["confirmation" "getCommitCharacters"];
|
||||
new = ["confirmation" "get_commit_characters"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordPattern"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_pattern"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["formatting" "expandableIndicator"];
|
||||
new = ["formatting" "expandable_indicator"];
|
||||
}
|
||||
{old = ["formatting" "fields"];}
|
||||
{old = ["formatting" "format"];}
|
||||
{
|
||||
old = ["matching" "disallowFuzzyMatching"];
|
||||
new = ["matching" "disallow_fuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"autocomplete"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowFullfuzzyMatching"];
|
||||
new = ["matching" "disallow_fullfuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"completeopt"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialFuzzyMatching"];
|
||||
new = ["matching" "disallow_partial_fuzzy_matching"];
|
||||
old = [
|
||||
"confirmation"
|
||||
"getCommitCharacters"
|
||||
];
|
||||
new = [
|
||||
"confirmation"
|
||||
"get_commit_characters"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialMatching"];
|
||||
new = ["matching" "disallow_partial_matching"];
|
||||
old = [
|
||||
"formatting"
|
||||
"expandableIndicator"
|
||||
];
|
||||
new = [
|
||||
"formatting"
|
||||
"expandable_indicator"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPrefixUnmatching"];
|
||||
new = ["matching" "disallow_prefix_unmatching"];
|
||||
old = [
|
||||
"formatting"
|
||||
"fields"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["sorting" "priorityWeight"];
|
||||
new = ["sorting" "priority_weight"];
|
||||
}
|
||||
{old = ["view" "entries"];}
|
||||
{
|
||||
old = ["view" "docs" "autoOpen"];
|
||||
new = ["view" "docs" "auto_open"];
|
||||
}
|
||||
{old = ["window" "completion" "border"];}
|
||||
{old = ["window" "completion" "winhighlight"];}
|
||||
{old = ["window" "completion" "zindex"];}
|
||||
{old = ["window" "completion" "scrolloff"];}
|
||||
{
|
||||
old = ["window" "completion" "colOffset"];
|
||||
new = ["window" "completion" "col_offset"];
|
||||
old = [
|
||||
"formatting"
|
||||
"format"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["window" "completion" "sidePadding"];
|
||||
new = ["window" "completion" "side_padding"];
|
||||
}
|
||||
{old = ["window" "completion" "scrollbar"];}
|
||||
{old = ["window" "documentation" "border"];}
|
||||
{old = ["window" "documentation" "winhighlight"];}
|
||||
{old = ["window" "documentation" "zindex"];}
|
||||
{
|
||||
old = ["window" "documentation" "maxWidth"];
|
||||
new = ["window" "documentation" "max_width"];
|
||||
old = [
|
||||
"matching"
|
||||
"disallowFuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_fuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["window" "documentation" "maxHeight"];
|
||||
new = ["window" "documentation" "max_height"];
|
||||
old = [
|
||||
"matching"
|
||||
"disallowFullfuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_fullfuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPartialFuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_partial_fuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPartialMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_partial_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPrefixUnmatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_prefix_unmatching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"sorting"
|
||||
"priorityWeight"
|
||||
];
|
||||
new = [
|
||||
"sorting"
|
||||
"priority_weight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"view"
|
||||
"entries"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"view"
|
||||
"docs"
|
||||
"autoOpen"
|
||||
];
|
||||
new = [
|
||||
"view"
|
||||
"docs"
|
||||
"auto_open"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"border"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"winhighlight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"zindex"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"scrolloff"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"colOffset"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"completion"
|
||||
"col_offset"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"sidePadding"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"completion"
|
||||
"side_padding"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"scrollbar"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"border"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"winhighlight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"zindex"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"maxWidth"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"documentation"
|
||||
"max_width"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"maxHeight"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"documentation"
|
||||
"max_height"
|
||||
];
|
||||
}
|
||||
{ old = [ "experimental" ]; }
|
||||
];
|
||||
|
||||
renameWarnings =
|
||||
map
|
||||
(
|
||||
renameWarnings = map (
|
||||
rename:
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ rename.old)
|
||||
(settingsPath ++ (rename.new or rename.old))
|
||||
)
|
||||
renamedOptions;
|
||||
in {
|
||||
imports =
|
||||
renameWarnings
|
||||
++ [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["enable"])
|
||||
(newPluginBasePath ++ ["enable"])
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["autoEnableSources"])
|
||||
(newPluginBasePath ++ ["autoEnableSources"])
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["preselect"])
|
||||
''
|
||||
mkRenamedOptionModule (oldPluginBasePath ++ rename.old) (settingsPath ++ (rename.new or rename.old))
|
||||
) renamedOptions;
|
||||
in
|
||||
{
|
||||
imports = renameWarnings ++ [
|
||||
(mkRenamedOptionModule (oldPluginBasePath ++ [ "enable" ]) (newPluginBasePath ++ [ "enable" ]))
|
||||
(mkRenamedOptionModule (oldPluginBasePath ++ [ "autoEnableSources" ]) (
|
||||
newPluginBasePath ++ [ "autoEnableSources" ]
|
||||
))
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "preselect" ]) ''
|
||||
Use `plugins.cmp.settings.preselect` option. But watch out, you now have to explicitly write `cmp.PreselectMode.<mode>`.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["mappingPresets"])
|
||||
'')
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "mappingPresets" ])
|
||||
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
|
||||
)
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["snippet" "expand"])
|
||||
oldPluginBasePath
|
||||
++ [
|
||||
"snippet"
|
||||
"expand"
|
||||
]
|
||||
)
|
||||
''
|
||||
Use `plugins.cmp.settings.snippet.expand` option. But watch out, you can no longer put only the name of the snippet engine.
|
||||
If you use `luasnip` for instance, set:
|
||||
|
@ -143,22 +338,23 @@ in {
|
|||
```
|
||||
''
|
||||
)
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["sorting" "comparators"])
|
||||
oldPluginBasePath
|
||||
++ [
|
||||
"sorting"
|
||||
"comparators"
|
||||
]
|
||||
)
|
||||
''
|
||||
Use `plugins.cmp.settings.sorting.comparators` option. But watch out, you can no longer put only the name of the comparators.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["sources"])
|
||||
''
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "sources" ]) ''
|
||||
Use `plugins.cmp.settings.sources` option. But watch out, you can no longer provide a list of lists of sources.
|
||||
For this type of use, directly write lua.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
|
||||
|
||||
settingsExample = {
|
||||
|
@ -29,13 +27,12 @@ with lib; rec {
|
|||
'';
|
||||
};
|
||||
|
||||
attrsOfOptions = with types;
|
||||
attrsOf (
|
||||
submodule {
|
||||
attrsOfOptions =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = settingsOptions;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
filetype = mkOption {
|
||||
type = attrsOfOptions;
|
||||
|
@ -43,9 +40,7 @@ with lib; rec {
|
|||
description = "Options for `cmp.filetype()`.";
|
||||
example = {
|
||||
python = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
];
|
||||
sources = [ { name = "nvim_lsp"; } ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -57,9 +52,7 @@ with lib; rec {
|
|||
example = {
|
||||
"/" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "buffer";}
|
||||
];
|
||||
sources = [ { name = "buffer"; } ];
|
||||
};
|
||||
":" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
|
@ -68,7 +61,10 @@ with lib; rec {
|
|||
{
|
||||
name = "cmdline";
|
||||
option = {
|
||||
ignore_cmds = ["Man" "!"];
|
||||
ignore_cmds = [
|
||||
"Man"
|
||||
"!"
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; {
|
||||
performance = {
|
||||
debounce = helpers.defaultNullOpts.mkUnsignedInt 60 ''
|
||||
Sets debounce time.
|
||||
|
@ -40,15 +38,15 @@ with lib; {
|
|||
|
||||
mapping = mkOption {
|
||||
default = { };
|
||||
type = with helpers.nixvimTypes;
|
||||
maybeRaw
|
||||
(attrsOf strLua);
|
||||
apply = v:
|
||||
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua);
|
||||
apply =
|
||||
v:
|
||||
# Handle the raw case first
|
||||
if helpers.nixvimTypes.isRawType v
|
||||
then v
|
||||
if helpers.nixvimTypes.isRawType v then
|
||||
v
|
||||
# When v is an attrs **but not {__raw = ...}**
|
||||
else mapAttrs (_: helpers.mkRaw) v;
|
||||
else
|
||||
mapAttrs (_: helpers.mkRaw) v;
|
||||
example = {
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
|
@ -110,19 +108,11 @@ with lib; {
|
|||
The number of characters needed to trigger auto-completion.
|
||||
'';
|
||||
|
||||
keyword_pattern =
|
||||
helpers.defaultNullOpts.mkLua
|
||||
''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]''
|
||||
"The default keyword pattern.";
|
||||
keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern.";
|
||||
|
||||
autocomplete =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with helpers.nixvimTypes;
|
||||
either
|
||||
(enum [false])
|
||||
(listOf strLua)
|
||||
)
|
||||
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
|
||||
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
|
||||
''
|
||||
The event to trigger autocompletion.
|
||||
|
@ -210,12 +200,7 @@ with lib; {
|
|||
|
||||
comparators = mkOption {
|
||||
type = with helpers.nixvimTypes; nullOr (listOf strLuaFn);
|
||||
apply = v:
|
||||
helpers.ifNonNull' v (
|
||||
map
|
||||
helpers.mkRaw
|
||||
v
|
||||
);
|
||||
apply = v: helpers.ifNonNull' v (map helpers.mkRaw v);
|
||||
default = null;
|
||||
description = ''
|
||||
The function to customize the sorting behavior.
|
||||
|
@ -244,13 +229,7 @@ with lib; {
|
|||
|
||||
view = {
|
||||
entries =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
str
|
||||
(attrsOf anything)
|
||||
)
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
||||
''
|
||||
{
|
||||
name = "custom";
|
||||
|
@ -268,11 +247,11 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
window = let
|
||||
mkWinhighlightOption = default:
|
||||
helpers.defaultNullOpts.mkStr
|
||||
default
|
||||
''
|
||||
window =
|
||||
let
|
||||
mkWinhighlightOption =
|
||||
default:
|
||||
helpers.defaultNullOpts.mkStr default ''
|
||||
Specify the window's winhighlight option.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
|
@ -281,17 +260,14 @@ with lib; {
|
|||
The window's zindex.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
completion = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder
|
||||
''[ "" "" "" "" "" "" "" "" ]''
|
||||
"nvim-cmp completion popup menu"
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
|
||||
"";
|
||||
|
||||
winhighlight =
|
||||
mkWinhighlightOption
|
||||
"Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
||||
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
||||
|
||||
inherit zindex;
|
||||
|
||||
|
@ -315,8 +291,7 @@ with lib; {
|
|||
|
||||
documentation = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder
|
||||
''[ "" "" "" " " "" "" "" " " ]''
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
|
||||
"nvim-cmp documentation popup menu"
|
||||
"";
|
||||
|
||||
|
@ -324,17 +299,13 @@ with lib; {
|
|||
|
||||
inherit zindex;
|
||||
|
||||
max_width =
|
||||
helpers.mkNullOrStrLuaOr types.ints.unsigned
|
||||
''
|
||||
max_width = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
|
||||
The documentation window's max width.
|
||||
|
||||
Default: "math.floor((40 * 2) * (vim.o.columns / (40 * 2 * 16 / 9)))"
|
||||
'';
|
||||
|
||||
max_height =
|
||||
helpers.mkNullOrStrLuaOr types.ints.unsigned
|
||||
''
|
||||
max_height = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
|
||||
The documentation window's max height.
|
||||
|
||||
Default: "math.floor(40 * (40 / vim.o.lines))"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
let
|
||||
sourceType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
|
@ -83,8 +81,7 @@ with lib; let
|
|||
in
|
||||
mkOption {
|
||||
default = [ ];
|
||||
type = with helpers.nixvimTypes;
|
||||
maybeRaw (listOf sourceType);
|
||||
type = with helpers.nixvimTypes; maybeRaw (listOf sourceType);
|
||||
description = ''
|
||||
The sources to use.
|
||||
Can either be a list of `sourceConfigs` which will be made directly to a Lua object.
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-fish;
|
||||
in {
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-fish = {
|
||||
|
@ -21,7 +23,5 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPackages = [cfg.fishPackage];
|
||||
};
|
||||
config = mkIf cfg.enable { extraPackages = [ cfg.fishPackage ]; };
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-git;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.cmp-git.settings = helpers.neovim-plugin.mkSettingsOption {
|
||||
pluginName = "cmp_git";
|
||||
options = {
|
||||
|
@ -47,8 +49,7 @@ in {
|
|||
|
||||
issues = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for issues.";
|
||||
|
||||
filter = helpers.defaultNullOpts.mkStr "all" ''
|
||||
|
@ -92,8 +93,7 @@ in {
|
|||
|
||||
pull_requests = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for pull requests.";
|
||||
|
||||
limit = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
|
@ -275,7 +275,11 @@ in {
|
|||
};
|
||||
|
||||
example = {
|
||||
remotes = ["upstream" "origin" "foo"];
|
||||
remotes = [
|
||||
"upstream"
|
||||
"origin"
|
||||
"foo"
|
||||
];
|
||||
github.issues = {
|
||||
filter = "all";
|
||||
limit = 250;
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-tabby;
|
||||
in {
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-tabby =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||
The address of the tabby host server.
|
||||
'';
|
||||
|
@ -28,8 +28,10 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit host;
|
||||
max_lines = maxLines;
|
||||
|
@ -37,7 +39,8 @@ in {
|
|||
inherit stop;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
in
|
||||
''
|
||||
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-tabnine;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.cmp-tabnine = helpers.neovim-plugin.extraOptionsOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
@ -5,25 +5,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.codeium-nvim;
|
||||
in {
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.codeium-nvim =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
|
||||
|
||||
configPath =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}''
|
||||
"The path to the config file, used to store the API key.";
|
||||
configPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}'' "The path to the config file, used to store the API key.";
|
||||
|
||||
binPath =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}''
|
||||
"The path to the directory where the Codeium server will be downloaded to.";
|
||||
binPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}'' "The path to the directory where the Codeium server will be downloaded to.";
|
||||
|
||||
api = {
|
||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
||||
|
@ -58,17 +52,16 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
config_path = configPath;
|
||||
bin_path = binPath;
|
||||
api = with api; {
|
||||
inherit host;
|
||||
port =
|
||||
if isInt port
|
||||
then toString port
|
||||
else port;
|
||||
port = if isInt port then toString port else port;
|
||||
};
|
||||
tools = with tools; {
|
||||
inherit
|
||||
|
@ -82,7 +75,8 @@ in {
|
|||
inherit wrapper;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
in
|
||||
''
|
||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -4,17 +4,15 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
copilot-lua-cfg = config.plugins.copilot-lua;
|
||||
cfg = config.plugins.copilot-cmp;
|
||||
in {
|
||||
options.plugins.copilot-cmp =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
event =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; listOf str)
|
||||
''["InsertEnter" "LspAttach"]''
|
||||
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
|
||||
''
|
||||
Configures when the source is registered.
|
||||
Unless you have a unique problem for your particular configuration you probably don't want
|
||||
|
@ -35,31 +33,28 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
warnings =
|
||||
optional
|
||||
((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled)
|
||||
''
|
||||
optional ((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled) ''
|
||||
It is recommended to disable copilot's `suggestion` module, as it can interfere with
|
||||
completions properly appearing in copilot-cmp.
|
||||
''
|
||||
++ optional
|
||||
(
|
||||
(!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled
|
||||
)
|
||||
''
|
||||
++ optional ((!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled) ''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in copilot-cmp.
|
||||
'';
|
||||
|
||||
plugins.copilot-lua.enable = true;
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit event;
|
||||
fix_pairs = fixPairs;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
in
|
||||
''
|
||||
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.crates-nvim;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.crates-nvim = helpers.neovim-plugin.extraOptionsOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
@ -5,20 +5,22 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cmpLib = import ../cmp-helpers.nix {inherit lib config helpers pkgs;};
|
||||
with lib;
|
||||
let
|
||||
cmpLib = import ../cmp-helpers.nix {
|
||||
inherit
|
||||
lib
|
||||
config
|
||||
helpers
|
||||
pkgs
|
||||
;
|
||||
};
|
||||
cmpSourcesPluginNames = attrValues (import ../sources.nix);
|
||||
pluginModules =
|
||||
map
|
||||
(
|
||||
name:
|
||||
cmpLib.mkCmpSourcePlugin {inherit name;}
|
||||
)
|
||||
cmpSourcesPluginNames;
|
||||
in {
|
||||
pluginModules = map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
|
||||
in
|
||||
{
|
||||
# For extra cmp plugins
|
||||
imports =
|
||||
[
|
||||
imports = [
|
||||
./codeium-nvim.nix
|
||||
./copilot-cmp.nix
|
||||
./cmp-fish.nix
|
||||
|
@ -26,6 +28,5 @@ in {
|
|||
./cmp-tabby.nix
|
||||
./cmp-tabnine.nix
|
||||
./crates-nvim.nix
|
||||
]
|
||||
++ pluginModules;
|
||||
] ++ pluginModules;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
keymapsDefinitions = {
|
||||
clear = {
|
||||
default = "<C-]>";
|
||||
|
@ -106,36 +107,32 @@ in
|
|||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps =
|
||||
mapAttrs
|
||||
(
|
||||
keymaps = mapAttrs (
|
||||
optionName: v:
|
||||
helpers.defaultNullOpts.mkStr v.default ''
|
||||
${v.description}
|
||||
Command: `${v.command}`
|
||||
''
|
||||
)
|
||||
keymapsDefinitions;
|
||||
) keymapsDefinitions;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.codeium-vim.settings.enabled = true;
|
||||
|
||||
keymaps = let
|
||||
processKeymap = optionName: v:
|
||||
optional
|
||||
(v != null)
|
||||
{
|
||||
keymaps =
|
||||
let
|
||||
processKeymap =
|
||||
optionName: v:
|
||||
optional (v != null) {
|
||||
key = v;
|
||||
action = let
|
||||
action =
|
||||
let
|
||||
inherit (keymapsDefinitions.${optionName}) command;
|
||||
in
|
||||
helpers.mkRaw "function() ${command} end";
|
||||
};
|
||||
|
||||
keymapsList = flatten (
|
||||
mapAttrsToList processKeymap cfg.keymaps
|
||||
);
|
||||
keymapsList = flatten (mapAttrsToList processKeymap cfg.keymaps);
|
||||
|
||||
defaults = {
|
||||
mode = "i";
|
||||
|
@ -145,8 +142,6 @@ in
|
|||
};
|
||||
};
|
||||
in
|
||||
helpers.keymaps.mkKeymaps
|
||||
defaults
|
||||
keymapsList;
|
||||
helpers.keymaps.mkKeymaps defaults keymapsList;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.copilot-lua;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.copilot-lua = let
|
||||
plugins.copilot-lua =
|
||||
let
|
||||
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str);
|
||||
in
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
|
@ -36,7 +39,16 @@ in {
|
|||
};
|
||||
|
||||
layout = {
|
||||
position = helpers.defaultNullOpts.mkEnum ["bottom" "top" "left" "right"] "bottom" ''
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"bottom"
|
||||
"top"
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"bottom"
|
||||
''
|
||||
The panel position.
|
||||
'';
|
||||
|
||||
|
@ -69,8 +81,7 @@ in {
|
|||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
yaml = false;
|
||||
|
@ -166,8 +177,10 @@ in {
|
|||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
panel = with panel; {
|
||||
inherit enabled;
|
||||
|
@ -197,7 +210,8 @@ in {
|
|||
server_opts_overrides = serverOptsOverrides;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
in
|
||||
''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -5,16 +5,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.coq-thirdparty;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.coq-thirdparty = {
|
||||
enable = mkEnableOption "coq-thirdparty";
|
||||
|
||||
package = helpers.mkPackageOption "coq-thirdparty" pkgs.vimPlugins.coq-thirdparty;
|
||||
|
||||
sources = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
freeformType = types.attrs;
|
||||
|
||||
options = {
|
||||
|
@ -33,7 +36,8 @@ in {
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
List of sources.
|
||||
Each source is a free-form type, so additional settings like `accept_key` may be specified even if they are not declared by nixvim.
|
||||
|
|
|
@ -11,7 +11,10 @@ with lib;
|
|||
originalName = "coq_nvim";
|
||||
defaultPackage = pkgs.vimPlugins.coq_nvim;
|
||||
|
||||
maintainers = [maintainers.traxys helpers.maintainers.Kareem-Medhat];
|
||||
maintainers = [
|
||||
maintainers.traxys
|
||||
helpers.maintainers.Kareem-Medhat
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
installArtifacts = mkEnableOption "and install coq-artifacts";
|
||||
|
@ -27,29 +30,37 @@ with lib;
|
|||
"xdg"
|
||||
"autoStart"
|
||||
];
|
||||
imports = let
|
||||
basePath = ["plugins" "coq-nvim"];
|
||||
imports =
|
||||
let
|
||||
basePath = [
|
||||
"plugins"
|
||||
"coq-nvim"
|
||||
];
|
||||
settingsPath = basePath ++ [ "settings" ];
|
||||
in [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePath ++ ["recommendedKeymaps"])
|
||||
(settingsPath ++ ["keymap" "recommended"])
|
||||
)
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePath ++ [ "recommendedKeymaps" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"keymap"
|
||||
"recommended"
|
||||
]
|
||||
))
|
||||
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePath ++ ["alwaysComplete"])
|
||||
(settingsPath ++ ["completion" "always"])
|
||||
)
|
||||
(mkRenamedOptionModule (basePath ++ [ "alwaysComplete" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"completion"
|
||||
"always"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
callSetup = false;
|
||||
settingsOptions = {
|
||||
auto_start =
|
||||
helpers.mkNullOrOption
|
||||
(with helpers.nixvimTypes; maybeRaw (either bool (enum ["shut-up"])))
|
||||
"Auto-start or shut up";
|
||||
auto_start = helpers.mkNullOrOption (
|
||||
with helpers.nixvimTypes; maybeRaw (either bool (enum [ "shut-up" ]))
|
||||
) "Auto-start or shut up";
|
||||
|
||||
xdg = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -63,9 +74,7 @@ with lib;
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf cfg.installArtifacts [
|
||||
cfg.artifactsPackage
|
||||
];
|
||||
extraPlugins = mkIf cfg.installArtifacts [ cfg.artifactsPackage ];
|
||||
|
||||
globals = {
|
||||
coq_settings = cfg.settings;
|
||||
|
|
|
@ -5,23 +5,27 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lspkind;
|
||||
in {
|
||||
options.plugins.lspkind =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.lspkind = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["text" "text_symbol" "symbol_text" "symbol"]
|
||||
mode = helpers.defaultNullOpts.mkEnum [
|
||||
"text"
|
||||
"text_symbol"
|
||||
"symbol_text"
|
||||
"Defines how annotations are shown";
|
||||
"symbol"
|
||||
] "symbol_text" "Defines how annotations are shown";
|
||||
|
||||
preset = helpers.defaultNullOpts.mkEnum ["default" "codicons"] "codicons" "Default symbol map";
|
||||
preset = helpers.defaultNullOpts.mkEnum [
|
||||
"default"
|
||||
"codicons"
|
||||
] "codicons" "Default symbol map";
|
||||
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
|
||||
|
@ -32,23 +36,18 @@ in {
|
|||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
|
||||
maxWidth =
|
||||
helpers.mkNullOrOption types.int
|
||||
"Maximum number of characters to show in the popup";
|
||||
maxWidth = helpers.mkNullOrOption types.int "Maximum number of characters to show in the popup";
|
||||
|
||||
ellipsisChar =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Character to show when the popup exceeds maxwidth";
|
||||
ellipsisChar = helpers.mkNullOrOption types.str "Character to show when the popup exceeds maxwidth";
|
||||
|
||||
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
|
||||
|
||||
after =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
after = helpers.mkNullOrOption types.str "Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
|
@ -56,13 +55,14 @@ in {
|
|||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
if doCmp then
|
||||
{
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
}
|
||||
else {}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
|
@ -74,15 +74,16 @@ in {
|
|||
'';
|
||||
|
||||
plugins.cmp.settings.formatting.format =
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
if cfg.cmp.after != null then
|
||||
''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
else ''
|
||||
else
|
||||
''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-go;
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-go = {
|
||||
enable = mkEnableOption "dap-go";
|
||||
|
||||
|
@ -22,7 +24,9 @@ in {
|
|||
delve = {
|
||||
path = helpers.defaultNullOpts.mkStr "dlv" "The path to the executable dlv which will be used for debugging.";
|
||||
|
||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 20 "Time to wait for delve to initialize the debug session.";
|
||||
initializeTimeoutSec =
|
||||
helpers.defaultNullOpts.mkInt 20
|
||||
"Time to wait for delve to initialize the debug session.";
|
||||
|
||||
port = helpers.defaultNullOpts.mkStr "$\{port}" ''
|
||||
A string that defines the port to start delve debugger.
|
||||
|
@ -36,7 +40,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
dap_configurations = dapConfigurations;
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-python;
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-python = {
|
||||
enable = mkEnableOption "dap-python";
|
||||
|
||||
|
@ -20,7 +22,11 @@ in {
|
|||
type = types.str;
|
||||
};
|
||||
|
||||
console = helpers.defaultNullOpts.mkEnumFirstDefault ["integratedTerminal" "internalConsole" "externalTerminal"] "Debugpy console.";
|
||||
console = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"integratedTerminal"
|
||||
"internalConsole"
|
||||
"externalTerminal"
|
||||
] "Debugpy console.";
|
||||
|
||||
customConfigurations = helpers.mkNullOrOption (types.listOf dapHelpers.configurationOption) "Custom python configurations for dap.";
|
||||
|
||||
|
@ -46,7 +52,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit console;
|
||||
include_configs = includeConfigs;
|
||||
|
@ -58,18 +65,14 @@ in {
|
|||
plugins.dap = {
|
||||
enable = true;
|
||||
|
||||
extensionConfigLua = with helpers;
|
||||
extensionConfigLua =
|
||||
with helpers;
|
||||
''
|
||||
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject options})
|
||||
''
|
||||
+ (optionalString (cfg.testRunners != null) ''
|
||||
table.insert(require("dap-python").test_runners,
|
||||
${
|
||||
toLuaObject
|
||||
(
|
||||
builtins.mapAttrs (_: mkRaw) cfg.testRunners
|
||||
)
|
||||
})
|
||||
${toLuaObject (builtins.mapAttrs (_: mkRaw) cfg.testRunners)})
|
||||
'')
|
||||
+ (optionalString (cfg.customConfigurations != null) ''
|
||||
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
||||
|
|
|
@ -5,20 +5,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-ui;
|
||||
|
||||
mkSizeOption =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
either int (numbers.between 0.0 1.0)
|
||||
);
|
||||
mkSizeOption = helpers.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
|
||||
|
||||
mkKeymapOptions = name:
|
||||
mkKeymapOptions =
|
||||
name:
|
||||
mapAttrs (
|
||||
key: default:
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${default}" "Map `${key}` for ${name}"
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${
|
||||
default
|
||||
}" "Map `${key}` for ${name}"
|
||||
);
|
||||
|
||||
elementOption = types.submodule {
|
||||
|
@ -46,14 +45,18 @@ with lib; let
|
|||
position = mkOption {
|
||||
default = "left";
|
||||
description = "Which side of editor to open layout on.";
|
||||
type = types.enum ["left" "right" "top" "bottom"];
|
||||
type = types.enum [
|
||||
"left"
|
||||
"right"
|
||||
"top"
|
||||
"bottom"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.plugins.dap.extensions.dap-ui =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-ui = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "dap-ui";
|
||||
|
||||
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
|
||||
|
@ -61,9 +64,14 @@ in {
|
|||
controls = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
||||
|
||||
element =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["repl" "scopes" "stacks" "watches" "breakpoints" "console"]
|
||||
"Element to show the controls on.";
|
||||
element = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"repl"
|
||||
"scopes"
|
||||
"stacks"
|
||||
"watches"
|
||||
"breakpoints"
|
||||
"console"
|
||||
] "Element to show the controls on.";
|
||||
|
||||
icons = {
|
||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
||||
|
@ -78,8 +86,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
elementMappings = helpers.mkNullOrOption (
|
||||
types.attrsOf (
|
||||
elementMappings = helpers.mkNullOrOption (types.attrsOf (
|
||||
types.submodule {
|
||||
options = mkKeymapOptions "element mapping overrides" {
|
||||
edit = "e";
|
||||
|
@ -90,8 +97,7 @@ in {
|
|||
toggle = "t";
|
||||
};
|
||||
}
|
||||
)
|
||||
) "Per-element overrides of global mappings.";
|
||||
)) "Per-element overrides of global mappings.";
|
||||
|
||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||
|
||||
|
@ -102,13 +108,9 @@ in {
|
|||
|
||||
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
||||
|
||||
mappings =
|
||||
helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui floating" {
|
||||
close = ''["<ESC>" "q"]'';
|
||||
};
|
||||
})
|
||||
"Keys to trigger actions in elements.";
|
||||
mappings = helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui floating" { close = ''["<ESC>" "q"]''; };
|
||||
}) "Keys to trigger actions in elements.";
|
||||
};
|
||||
|
||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||
|
@ -119,9 +121,7 @@ in {
|
|||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
|
||||
layouts =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf layoutOption)
|
||||
''
|
||||
layouts = helpers.defaultNullOpts.mkNullable (types.listOf layoutOption) ''
|
||||
```nix
|
||||
[
|
||||
{
|
||||
|
@ -162,11 +162,9 @@ in {
|
|||
}
|
||||
];
|
||||
```
|
||||
''
|
||||
"List of layouts for dap-ui.";
|
||||
'' "List of layouts for dap-ui.";
|
||||
|
||||
mappings =
|
||||
helpers.mkNullOrOption (types.submodule {
|
||||
mappings = helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
|
@ -175,15 +173,16 @@ in {
|
|||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
})
|
||||
"Keys to trigger actions in elements.";
|
||||
}) "Keys to trigger actions in elements.";
|
||||
|
||||
render = {
|
||||
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
|
||||
|
||||
maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
|
||||
|
||||
maxValueLines = helpers.defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
||||
maxValueLines =
|
||||
helpers.defaultNullOpts.mkInt 100
|
||||
"Maximum number of lines to allow a value to fill before trimming.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
|
@ -191,10 +190,17 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
inherit controls icons layouts mappings;
|
||||
inherit
|
||||
controls
|
||||
icons
|
||||
layouts
|
||||
mappings
|
||||
;
|
||||
|
||||
element_mappings = elementMappings;
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-virtual-text;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-virtual-text = {
|
||||
enable = mkEnableOption "dap-virtual-text";
|
||||
|
||||
|
@ -61,7 +63,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit commented;
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
mkAdapterType = attrs:
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
mkAdapterType =
|
||||
attrs:
|
||||
types.submodule {
|
||||
options =
|
||||
{
|
||||
options = {
|
||||
id = helpers.mkNullOrOption types.str ''
|
||||
Identifier of the adapter. This is used for the
|
||||
`adapterId` property of the initialize request.
|
||||
|
@ -33,8 +31,7 @@ with lib; rec {
|
|||
The filetype to use for content retrieved via a source request.
|
||||
'';
|
||||
};
|
||||
}
|
||||
// attrs;
|
||||
} // attrs;
|
||||
};
|
||||
|
||||
executableAdapterOption = mkAdapterType {
|
||||
|
@ -76,7 +73,8 @@ with lib; rec {
|
|||
'';
|
||||
};
|
||||
|
||||
mkAdapterOption = name: type:
|
||||
mkAdapterOption =
|
||||
name: type:
|
||||
helpers.mkNullOrOption (with types; attrsOf (either str type)) ''
|
||||
Debug adapters of `${name}` type.
|
||||
The adapters can also be set to a function which takes three arguments:
|
||||
|
@ -100,7 +98,10 @@ with lib; rec {
|
|||
};
|
||||
|
||||
request = mkOption {
|
||||
type = types.enum ["attach" "launch"];
|
||||
type = types.enum [
|
||||
"attach"
|
||||
"launch"
|
||||
];
|
||||
description = ''
|
||||
Indicates whether the debug adapter should launch a debuggee or attach to one that is already running.
|
||||
'';
|
||||
|
@ -120,11 +121,13 @@ with lib; rec {
|
|||
numhl = helpers.mkNullOrOption types.str "`numhl` for sign.";
|
||||
};
|
||||
|
||||
processAdapters = type: adapters:
|
||||
processAdapters =
|
||||
type: adapters:
|
||||
with builtins;
|
||||
mapAttrs (_: adapter:
|
||||
if isString adapter
|
||||
then helpers.mkRaw adapter
|
||||
mapAttrs (
|
||||
_: adapter:
|
||||
if isString adapter then
|
||||
helpers.mkRaw adapter
|
||||
else
|
||||
filterAttrs (n: _: n != "enrichConfig") (
|
||||
adapter
|
||||
|
@ -132,6 +135,6 @@ with lib; rec {
|
|||
inherit type;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
))
|
||||
adapters;
|
||||
)
|
||||
) adapters;
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap;
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
with dapHelpers; {
|
||||
with dapHelpers;
|
||||
{
|
||||
imports = [
|
||||
./dap-go.nix
|
||||
./dap-python.nix
|
||||
|
@ -17,9 +19,7 @@ in
|
|||
./dap-virtual-text.nix
|
||||
];
|
||||
|
||||
options.plugins.dap =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
options.plugins.dap = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "dap";
|
||||
|
||||
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||||
|
@ -29,7 +29,9 @@ in
|
|||
servers = mkAdapterOption "server" serverAdapterOption;
|
||||
};
|
||||
|
||||
configurations = helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption)) ''
|
||||
configurations =
|
||||
helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
|
||||
''
|
||||
Debuggee configurations, see `:h dap-configuration` for more info.
|
||||
'';
|
||||
|
||||
|
@ -55,20 +57,18 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
inherit configurations;
|
||||
|
||||
adapters =
|
||||
(
|
||||
lib.optionalAttrs (adapters.executables != null)
|
||||
(processAdapters "executable" adapters.executables)
|
||||
)
|
||||
// (
|
||||
lib.optionalAttrs (adapters.servers != null)
|
||||
(processAdapters "server" adapters.servers)
|
||||
);
|
||||
(lib.optionalAttrs (adapters.executables != null) (
|
||||
processAdapters "executable" adapters.executables
|
||||
))
|
||||
// (lib.optionalAttrs (adapters.servers != null) (processAdapters "server" adapters.servers));
|
||||
|
||||
signs = with signs; {
|
||||
DapBreakpoint = dapBreakpoint;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.chadtree;
|
||||
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
|
||||
in {
|
||||
options.plugins.chadtree =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
in
|
||||
{
|
||||
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "chadtree";
|
||||
|
||||
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
|
||||
|
@ -74,7 +74,14 @@ in {
|
|||
};
|
||||
|
||||
view = {
|
||||
openDirection = helpers.defaultNullOpts.mkEnum ["left" "right"] "left" ''
|
||||
openDirection =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"left"
|
||||
''
|
||||
Which way does CHADTree open?
|
||||
'';
|
||||
|
||||
|
@ -90,7 +97,8 @@ in {
|
|||
'';
|
||||
|
||||
windowOptions =
|
||||
helpers.defaultNullOpts.mkAttributeSet ''
|
||||
helpers.defaultNullOpts.mkAttributeSet
|
||||
''
|
||||
{
|
||||
cursorline = true;
|
||||
number = false;
|
||||
|
@ -125,12 +133,22 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
iconGlyphSet = helpers.defaultNullOpts.mkEnum ["devicons" "emoji" "ascii" "ascii_hollow"] "devicons" ''
|
||||
iconGlyphSet =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"devicons"
|
||||
"emoji"
|
||||
"ascii"
|
||||
"ascii_hollow"
|
||||
]
|
||||
"devicons"
|
||||
''
|
||||
Icon glyph set to use.
|
||||
'';
|
||||
|
||||
textColourSet =
|
||||
helpers.defaultNullOpts.mkEnum [
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"env"
|
||||
"solarized_dark_256"
|
||||
"solarized_dark"
|
||||
|
@ -140,7 +158,9 @@ in {
|
|||
"trapdoor"
|
||||
"nerdtree_syntax_light"
|
||||
"nerdtree_syntax_dark"
|
||||
] "env" ''
|
||||
]
|
||||
"env"
|
||||
''
|
||||
On `unix`, the command `ls` can produce coloured results based on the `LS_COLORS` environmental variable.
|
||||
|
||||
CHADTree can pretend it's `ls` by setting `chadtree.theme.textColourSet` to `env`.
|
||||
|
@ -148,7 +168,14 @@ in {
|
|||
If you are not happy with that, you can choose one of the many others.
|
||||
'';
|
||||
|
||||
iconColourSet = helpers.defaultNullOpts.mkEnum ["github" "none"] "github" ''
|
||||
iconColourSet =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"github"
|
||||
"none"
|
||||
]
|
||||
"github"
|
||||
''
|
||||
Right now you all the file icons are coloured according to Github colours.
|
||||
|
||||
You may also disable colouring if you wish.
|
||||
|
@ -333,7 +360,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
xdg = true;
|
||||
options = with options; {
|
||||
|
@ -371,7 +399,8 @@ in {
|
|||
text_colour_set = textColourSet;
|
||||
icon_colour_set = iconColourSet;
|
||||
};
|
||||
keymap = with keymap;
|
||||
keymap =
|
||||
with keymap;
|
||||
with windowManagement;
|
||||
with rerooting;
|
||||
with openFileFolder;
|
||||
|
@ -380,7 +409,8 @@ in {
|
|||
with bookmarks;
|
||||
with selecting;
|
||||
with fileOperations;
|
||||
with toggles; {
|
||||
with toggles;
|
||||
{
|
||||
inherit quit;
|
||||
inherit bigger;
|
||||
inherit smaller;
|
||||
|
@ -423,7 +453,9 @@ in {
|
|||
mkIf cfg.enable {
|
||||
extraPlugins =
|
||||
[ cfg.package ]
|
||||
++ (optional (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") pkgs.vimPlugins.nvim-web-devicons);
|
||||
++ (optional (
|
||||
cfg.theme == null || cfg.theme.iconGlyphSet == "devicons"
|
||||
) pkgs.vimPlugins.nvim-web-devicons);
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})
|
||||
|
|
|
@ -5,36 +5,40 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.neo-tree;
|
||||
basePluginPath = ["plugins" "neo-tree"];
|
||||
in {
|
||||
imports = [
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["sourceSelector" "tabLabels"])
|
||||
"Use `plugins.neo-tree.sourceSelector.sources` to achieve the same functionality."
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["closeFloatsOnEscapeKey"])
|
||||
"This option has been removed from upstream."
|
||||
)
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"neo-tree"
|
||||
];
|
||||
options.plugins.neo-tree = let
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath
|
||||
++ [
|
||||
"sourceSelector"
|
||||
"tabLabels"
|
||||
]
|
||||
) "Use `plugins.neo-tree.sourceSelector.sources` to achieve the same functionality.")
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "closeFloatsOnEscapeKey" ]
|
||||
) "This option has been removed from upstream.")
|
||||
];
|
||||
options.plugins.neo-tree =
|
||||
let
|
||||
listOfRendererComponents = with types; listOf (either str attrs);
|
||||
|
||||
mkRendererComponentListOption = helpers.defaultNullOpts.mkNullable listOfRendererComponents;
|
||||
|
||||
mkMappingsOption = defaults:
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; attrsOf (either str attrs))
|
||||
defaults
|
||||
"Mapping options";
|
||||
mkMappingsOption =
|
||||
defaults:
|
||||
helpers.defaultNullOpts.mkNullable (
|
||||
with types; attrsOf (either str attrs)
|
||||
) defaults "Mapping options";
|
||||
|
||||
mkWindowMappingsOption = defaults: {
|
||||
mappings = mkMappingsOption defaults;
|
||||
};
|
||||
mkWindowMappingsOption = defaults: { mappings = mkMappingsOption defaults; };
|
||||
|
||||
mkFollowCurrentFileOption = default: {
|
||||
enabled = helpers.defaultNullOpts.mkBool default ''
|
||||
|
@ -67,17 +71,11 @@ in {
|
|||
Extra sources to be added to the sources. This is an internal nixvim option.
|
||||
'';
|
||||
|
||||
addBlankLineAtTop =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Add a blank line at the top of the tree.";
|
||||
addBlankLineAtTop = helpers.defaultNullOpts.mkBool false "Add a blank line at the top of the tree.";
|
||||
|
||||
autoCleanAfterSessionRestore =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Automatically clean up broken neo-tree buffers saved in sessions";
|
||||
autoCleanAfterSessionRestore = helpers.defaultNullOpts.mkBool false "Automatically clean up broken neo-tree buffers saved in sessions";
|
||||
|
||||
closeIfLastWindow =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Close Neo-tree if it is the last window left in the tab";
|
||||
closeIfLastWindow = helpers.defaultNullOpts.mkBool false "Close Neo-tree if it is the last window left in the tab";
|
||||
|
||||
defaultSource = helpers.defaultNullOpts.mkStr "filesystem" "";
|
||||
|
||||
|
@ -85,13 +83,9 @@ in {
|
|||
|
||||
enableGitStatus = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
enableModifiedMarkers =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Show markers for files with unsaved changes.";
|
||||
enableModifiedMarkers = helpers.defaultNullOpts.mkBool true "Show markers for files with unsaved changes.";
|
||||
|
||||
enableRefreshOnWrite =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false.";
|
||||
enableRefreshOnWrite = helpers.defaultNullOpts.mkBool true "Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false.";
|
||||
|
||||
gitStatusAsync = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
|
@ -104,9 +98,7 @@ in {
|
|||
helpers.defaultNullOpts.mkInt 10
|
||||
"delay in ms between batches. Spreads out the workload to let other processes run.";
|
||||
|
||||
maxLines =
|
||||
helpers.defaultNullOpts.mkInt 10000
|
||||
''
|
||||
maxLines = helpers.defaultNullOpts.mkInt 10000 ''
|
||||
How many lines of git status results to process. Anything after this will be dropped.
|
||||
Anything before this will be used.
|
||||
The last items to be processed are the untracked files.
|
||||
|
@ -115,74 +107,65 @@ in {
|
|||
|
||||
hideRootNode = helpers.defaultNullOpts.mkBool false "Hide the root node.";
|
||||
|
||||
retainHiddenRootIndent =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
''
|
||||
retainHiddenRootIndent = helpers.defaultNullOpts.mkBool false ''
|
||||
If the root node is hidden, keep the indentation anyhow.
|
||||
This is needed if you use expanders because they render in the indent.
|
||||
'';
|
||||
|
||||
logLevel =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["trace" "debug" "info" "warn" "error" "fatal"] "info" "";
|
||||
logLevel = helpers.defaultNullOpts.mkEnum [
|
||||
"trace"
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
"fatal"
|
||||
] "info" "";
|
||||
|
||||
logToFile =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.bool types.str)
|
||||
"false"
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.bool types.str) "false"
|
||||
"use :NeoTreeLogs to show the file";
|
||||
|
||||
openFilesInLastWindow =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"If `false`, open files in top left window";
|
||||
openFilesInLastWindow = helpers.defaultNullOpts.mkBool true "If `false`, open files in top left window";
|
||||
|
||||
popupBorderStyle =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["NC" "double" "none" "rounded" "shadow" "single" "solid"] "NC" "";
|
||||
popupBorderStyle = helpers.defaultNullOpts.mkEnum [
|
||||
"NC"
|
||||
"double"
|
||||
"none"
|
||||
"rounded"
|
||||
"shadow"
|
||||
"single"
|
||||
"solid"
|
||||
] "NC" "";
|
||||
|
||||
resizeTimerInterval =
|
||||
helpers.defaultNullOpts.mkInt 500
|
||||
''
|
||||
resizeTimerInterval = helpers.defaultNullOpts.mkInt 500 ''
|
||||
In ms, needed for containers to redraw right aligned and faded content.
|
||||
Set to -1 to disable the resize timer entirely.
|
||||
|
||||
NOTE: this will speed up to 50 ms for 1 second following a resize
|
||||
'';
|
||||
|
||||
sortCaseInsensitive =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Used when sorting files and directories in the tree";
|
||||
sortCaseInsensitive = helpers.defaultNullOpts.mkBool false "Used when sorting files and directories in the tree";
|
||||
|
||||
sortFunction =
|
||||
helpers.defaultNullOpts.mkLuaFn "nil"
|
||||
"Uses a custom function for sorting files and directories in the tree";
|
||||
sortFunction = helpers.defaultNullOpts.mkLuaFn "nil" "Uses a custom function for sorting files and directories in the tree";
|
||||
|
||||
usePopupsForInput =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"If false, inputs will use vim.ui.input() instead of custom floats.";
|
||||
usePopupsForInput = helpers.defaultNullOpts.mkBool true "If false, inputs will use vim.ui.input() instead of custom floats.";
|
||||
|
||||
useDefaultMappings = helpers.defaultNullOpts.mkBool true "";
|
||||
|
||||
# sourceSelector provides clickable tabs to switch between sources."
|
||||
sourceSelector = {
|
||||
winbar =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"toggle to show selector on winbar";
|
||||
winbar = helpers.defaultNullOpts.mkBool false "toggle to show selector on winbar";
|
||||
|
||||
statusline =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"toggle to show selector on statusline";
|
||||
statusline = helpers.defaultNullOpts.mkBool false "toggle to show selector on statusline";
|
||||
|
||||
showScrolledOffParentNode = helpers.defaultNullOpts.mkBool false ''
|
||||
If `true`, tabs are replaced with the parent path of the top visible node when
|
||||
scrolled down.
|
||||
'';
|
||||
|
||||
sources =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
sources = helpers.mkNullOrOption (
|
||||
with types;
|
||||
listOf
|
||||
(submodule {
|
||||
listOf (submodule {
|
||||
options = {
|
||||
source = mkOption {
|
||||
type = str;
|
||||
|
@ -192,11 +175,15 @@ in {
|
|||
displayName = helpers.mkNullOrOption str "How that source to appear in the bar.";
|
||||
};
|
||||
})
|
||||
)
|
||||
"Configure the characters shown on each tab.";
|
||||
) "Configure the characters shown on each tab.";
|
||||
|
||||
contentLayout =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["start" "end" "focus"]
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"start"
|
||||
"end"
|
||||
"focus"
|
||||
]
|
||||
''
|
||||
Defines how the labels are placed inside a tab.
|
||||
This only takes effect when the tab width is greater than the length of label i.e.
|
||||
|
@ -210,7 +197,13 @@ in {
|
|||
|
||||
tabsLayout =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["start" "end" "center" "equal" "focus"]
|
||||
[
|
||||
"start"
|
||||
"end"
|
||||
"center"
|
||||
"equal"
|
||||
"focus"
|
||||
]
|
||||
"equal"
|
||||
''
|
||||
Defines how the tabs are aligned inside the window when there is more than enough
|
||||
|
@ -225,9 +218,7 @@ in {
|
|||
"active" : expand the focused tab to fit the window width ┃/ focused tab \/ ~ \/ ~ \┃
|
||||
'';
|
||||
|
||||
truncationCharacter =
|
||||
helpers.defaultNullOpts.mkStr "…"
|
||||
"Character to use when truncating the tab label";
|
||||
truncationCharacter = helpers.defaultNullOpts.mkStr "…" "Character to use when truncating the tab label";
|
||||
|
||||
tabsMinWidth =
|
||||
helpers.defaultNullOpts.mkNullable types.int "null"
|
||||
|
@ -237,11 +228,7 @@ in {
|
|||
helpers.defaultNullOpts.mkNullable types.int "null"
|
||||
"This will truncate text even if `textTruncToFit = false`";
|
||||
|
||||
padding =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; either int (attrsOf int))
|
||||
"0"
|
||||
''
|
||||
padding = helpers.defaultNullOpts.mkNullable (with types; either int (attrsOf int)) "0" ''
|
||||
Defines the global padding of the source selector.
|
||||
It can be an integer or an attrs with keys `left` and `right`.
|
||||
Setting `padding = 2` is exactly the same as `{ left = 2; right = 2; }`.
|
||||
|
@ -249,9 +236,7 @@ in {
|
|||
Example: `{ left = 2; right = 0; }`
|
||||
'';
|
||||
|
||||
separator =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
separator = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
either str (submodule {
|
||||
options = {
|
||||
|
@ -260,9 +245,7 @@ in {
|
|||
override = helpers.defaultNullOpts.mkStr null "";
|
||||
};
|
||||
})
|
||||
)
|
||||
"Can be a string or a table"
|
||||
''{ left = "▏"; right= "▕"; }'';
|
||||
) "Can be a string or a table" ''{ left = "▏"; right= "▕"; }'';
|
||||
|
||||
separatorActive =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
|
@ -282,9 +265,7 @@ in {
|
|||
''
|
||||
"null";
|
||||
|
||||
showSeparatorOnEdge =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
''
|
||||
showSeparatorOnEdge = helpers.defaultNullOpts.mkBool false ''
|
||||
Takes a boolean value where `false` (default) hides the separators on the far
|
||||
left / right.
|
||||
Especially useful when left and right separator are the same.
|
||||
|
@ -303,10 +284,7 @@ in {
|
|||
|
||||
highlightSeparatorActive = helpers.defaultNullOpts.mkStr "NeoTreeTabSeparatorActive" "";
|
||||
};
|
||||
eventHandlers =
|
||||
helpers.mkNullOrOption
|
||||
(with types; attrsOf str)
|
||||
''
|
||||
eventHandlers = helpers.mkNullOrOption (with types; attrsOf str) ''
|
||||
Configuration of event handlers.
|
||||
Attrs:
|
||||
- keys are the events (e.g. `before_render`, `file_opened`)
|
||||
|
@ -421,13 +399,7 @@ in {
|
|||
};
|
||||
|
||||
gitStatus = {
|
||||
symbols =
|
||||
mapAttrs
|
||||
(
|
||||
optionName: default:
|
||||
helpers.defaultNullOpts.mkStr default optionName
|
||||
)
|
||||
{
|
||||
symbols = mapAttrs (optionName: default: helpers.defaultNullOpts.mkStr default optionName) {
|
||||
added = "✚";
|
||||
deleted = "✖";
|
||||
modified = "";
|
||||
|
@ -444,9 +416,7 @@ in {
|
|||
};
|
||||
|
||||
renderers = {
|
||||
directory =
|
||||
mkRendererComponentListOption
|
||||
''
|
||||
directory = mkRendererComponentListOption ''
|
||||
[
|
||||
"indent"
|
||||
"icon"
|
||||
|
@ -478,12 +448,9 @@ in {
|
|||
];
|
||||
}
|
||||
]
|
||||
''
|
||||
"directory renderers";
|
||||
'' "directory renderers";
|
||||
|
||||
file =
|
||||
mkRendererComponentListOption
|
||||
''
|
||||
file = mkRendererComponentListOption ''
|
||||
[
|
||||
"indent"
|
||||
"icon"
|
||||
|
@ -520,12 +487,9 @@ in {
|
|||
];
|
||||
}
|
||||
]
|
||||
''
|
||||
"file renderers";
|
||||
'' "file renderers";
|
||||
|
||||
message =
|
||||
mkRendererComponentListOption
|
||||
''
|
||||
message = mkRendererComponentListOption ''
|
||||
[
|
||||
{
|
||||
name = "indent";
|
||||
|
@ -536,38 +500,35 @@ in {
|
|||
highlight = "NeoTreeMessage";
|
||||
}
|
||||
]
|
||||
''
|
||||
"message renderers";
|
||||
'' "message renderers";
|
||||
|
||||
terminal =
|
||||
mkRendererComponentListOption
|
||||
''
|
||||
terminal = mkRendererComponentListOption ''
|
||||
[
|
||||
"indent"
|
||||
"icon"
|
||||
"name"
|
||||
"bufnr"
|
||||
]
|
||||
''
|
||||
"message renderers";
|
||||
'' "message renderers";
|
||||
};
|
||||
|
||||
nestingRules =
|
||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) "{}"
|
||||
"nesting rules";
|
||||
nestingRules = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) "{}" "nesting rules";
|
||||
|
||||
window = {
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["left" "right" "top" "bottom" "float" "current"] "left" "position";
|
||||
position = helpers.defaultNullOpts.mkEnum [
|
||||
"left"
|
||||
"right"
|
||||
"top"
|
||||
"bottom"
|
||||
"float"
|
||||
"current"
|
||||
] "left" "position";
|
||||
|
||||
width = helpers.defaultNullOpts.mkInt 40 "Applies to left and right positions";
|
||||
|
||||
height = helpers.defaultNullOpts.mkInt 15 "Applies to top and bottom positions";
|
||||
|
||||
autoExpandWidth =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
''
|
||||
autoExpandWidth = helpers.defaultNullOpts.mkBool false ''
|
||||
Expand the window when file exceeds the window width. does not work with
|
||||
position = "float"
|
||||
'';
|
||||
|
@ -591,7 +552,13 @@ in {
|
|||
(as opposed to within the directory under cursor).
|
||||
'';
|
||||
|
||||
insertAs = helpers.defaultNullOpts.mkEnumFirstDefault ["child" "sibling"] ''
|
||||
insertAs =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"child"
|
||||
"sibling"
|
||||
]
|
||||
''
|
||||
Affects how nodes get inserted into the tree during creation/pasting/moving of files if
|
||||
the node under the cursor is a directory:
|
||||
|
||||
|
@ -605,9 +572,7 @@ in {
|
|||
nowait = helpers.defaultNullOpts.mkBool true "nowait";
|
||||
};
|
||||
|
||||
mappings =
|
||||
mkMappingsOption
|
||||
''
|
||||
mappings = mkMappingsOption ''
|
||||
```nix
|
||||
{
|
||||
"<space>" = {
|
||||
|
@ -678,21 +643,32 @@ in {
|
|||
}
|
||||
```
|
||||
'';
|
||||
asyncDirectoryScan = helpers.defaultNullOpts.mkEnumFirstDefault ["auto" "always" "never"] ''
|
||||
asyncDirectoryScan =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"auto"
|
||||
"always"
|
||||
"never"
|
||||
]
|
||||
''
|
||||
- "auto" means refreshes are async, but it's synchronous when called from the Neotree
|
||||
commands.
|
||||
- "always" means directory scans are always async.
|
||||
- "never" means directory scans are never async.
|
||||
'';
|
||||
|
||||
scanMode = helpers.defaultNullOpts.mkEnumFirstDefault ["shallow" "deep"] ''
|
||||
scanMode =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"shallow"
|
||||
"deep"
|
||||
]
|
||||
''
|
||||
- "shallow": Don't scan into directories to detect possible empty directory a priori.
|
||||
- "deep": Scan into directories to detect empty or grouped empty directories a priori.
|
||||
'';
|
||||
|
||||
bindToCwd =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"true creates a 2-way binding between vim's cwd and neo-tree's root.";
|
||||
bindToCwd = helpers.defaultNullOpts.mkBool true "true creates a 2-way binding between vim's cwd and neo-tree's root.";
|
||||
|
||||
cwdTarget = {
|
||||
sidebar = helpers.defaultNullOpts.mkStr "tab" "sidebar is when position = left or right";
|
||||
|
@ -700,29 +676,20 @@ in {
|
|||
};
|
||||
|
||||
filteredItems = {
|
||||
visible =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"when true, they will just be displayed differently than normal items";
|
||||
visible = helpers.defaultNullOpts.mkBool false "when true, they will just be displayed differently than normal items";
|
||||
|
||||
forceVisibleInEmptyFolder =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"when true, hidden files will be shown if the root folder is otherwise empty";
|
||||
forceVisibleInEmptyFolder = helpers.defaultNullOpts.mkBool false "when true, hidden files will be shown if the root folder is otherwise empty";
|
||||
|
||||
showHiddenCount =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"when true, the number of hidden items in each folder will be shown as the last entry";
|
||||
showHiddenCount = helpers.defaultNullOpts.mkBool true "when true, the number of hidden items in each folder will be shown as the last entry";
|
||||
|
||||
hideDotfiles = helpers.defaultNullOpts.mkBool true "hide dotfiles";
|
||||
|
||||
hideGitignored = helpers.defaultNullOpts.mkBool true "hide gitignored files";
|
||||
|
||||
hideHidden =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"only works on Windows for hidden files/directories";
|
||||
hideHidden = helpers.defaultNullOpts.mkBool true "only works on Windows for hidden files/directories";
|
||||
|
||||
hideByName =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
''[".DS_Store" "thumbs.db"]''
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''[".DS_Store" "thumbs.db"]''
|
||||
"hide by name";
|
||||
|
||||
hideByPattern = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
|
@ -764,25 +731,20 @@ in {
|
|||
`./sources/filesystem/init.lua
|
||||
'';
|
||||
|
||||
findCommand =
|
||||
helpers.defaultNullOpts.mkStr "fd"
|
||||
"This is determined automatically, you probably don't need to set it";
|
||||
findCommand = helpers.defaultNullOpts.mkStr "fd" "This is determined automatically, you probably don't need to set it";
|
||||
|
||||
findArgs =
|
||||
helpers.mkNullOrStrLuaFnOr
|
||||
(types.submodule {
|
||||
options = {
|
||||
fd =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
''
|
||||
fd = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''
|
||||
[
|
||||
"--exclude"
|
||||
".git"
|
||||
"--exclude"
|
||||
"node_modules"
|
||||
]
|
||||
''
|
||||
"You can specify extra args to pass to the find command.";
|
||||
'' "You can specify extra args to pass to the find command.";
|
||||
};
|
||||
})
|
||||
''
|
||||
|
@ -828,19 +790,19 @@ in {
|
|||
```
|
||||
'';
|
||||
|
||||
groupEmptyDirs =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"when true, empty folders will be grouped together";
|
||||
groupEmptyDirs = helpers.defaultNullOpts.mkBool false "when true, empty folders will be grouped together";
|
||||
|
||||
searchLimit =
|
||||
helpers.defaultNullOpts.mkInt 50
|
||||
"max number of search results when using filters";
|
||||
searchLimit = helpers.defaultNullOpts.mkInt 50 "max number of search results when using filters";
|
||||
|
||||
followCurrentFile = mkFollowCurrentFileOption false;
|
||||
|
||||
hijackNetrwBehavior =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
["open_default" "open_current" "disabled"]
|
||||
[
|
||||
"open_default"
|
||||
"open_current"
|
||||
"disabled"
|
||||
]
|
||||
''
|
||||
- "open_default": netrw disabled, opening a directory opens neo-tree in whatever
|
||||
position is specified in window.position
|
||||
|
@ -860,9 +822,7 @@ in {
|
|||
|
||||
followCurrentFile = mkFollowCurrentFileOption true;
|
||||
|
||||
groupEmptyDirs =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"When true, empty directories will be grouped together.";
|
||||
groupEmptyDirs = helpers.defaultNullOpts.mkBool true "When true, empty directories will be grouped together.";
|
||||
|
||||
window = mkWindowMappingsOption ''
|
||||
{
|
||||
|
@ -889,9 +849,7 @@ in {
|
|||
|
||||
example = {
|
||||
renderers = {
|
||||
custom =
|
||||
mkRendererComponentListOption
|
||||
''
|
||||
custom = mkRendererComponentListOption ''
|
||||
[
|
||||
"indent"
|
||||
{
|
||||
|
@ -901,8 +859,7 @@ in {
|
|||
"custom"
|
||||
"name"
|
||||
]
|
||||
''
|
||||
"custom renderers";
|
||||
'' "custom renderers";
|
||||
};
|
||||
|
||||
window = mkWindowMappingsOption ''
|
||||
|
@ -915,9 +872,7 @@ in {
|
|||
};
|
||||
|
||||
documentSymbols = {
|
||||
followCursor =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"If set to `true`, will automatically focus on the symbol under the cursor.";
|
||||
followCursor = helpers.defaultNullOpts.mkBool false "If set to `true`, will automatically focus on the symbol under the cursor.";
|
||||
|
||||
kinds =
|
||||
helpers.mkNullOrOption
|
||||
|
@ -962,63 +917,55 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
inherit (helpers) ifNonNull' mkRaw;
|
||||
|
||||
processRendererComponent = component:
|
||||
if isString component
|
||||
then [component]
|
||||
processRendererComponent =
|
||||
component:
|
||||
if isString component then
|
||||
[ component ]
|
||||
else
|
||||
(mapAttrs' (
|
||||
name: value: {
|
||||
name =
|
||||
if name == "name"
|
||||
then "__unkeyed"
|
||||
else name;
|
||||
value =
|
||||
if isList value
|
||||
then processRendererComponentList value
|
||||
else value;
|
||||
}
|
||||
)
|
||||
component);
|
||||
(mapAttrs' (name: value: {
|
||||
name = if name == "name" then "__unkeyed" else name;
|
||||
value = if isList value then processRendererComponentList value else value;
|
||||
}) component);
|
||||
|
||||
processRendererComponentList = componentList:
|
||||
ifNonNull' componentList
|
||||
(map processRendererComponent componentList);
|
||||
processRendererComponentList =
|
||||
componentList: ifNonNull' componentList (map processRendererComponent componentList);
|
||||
|
||||
processMapping = key: action:
|
||||
if isString action
|
||||
then action
|
||||
processMapping =
|
||||
key: action:
|
||||
if isString action then
|
||||
action
|
||||
else
|
||||
mapAttrs' (k: v: {
|
||||
name =
|
||||
if k == "command"
|
||||
then "__unkeyed"
|
||||
else k;
|
||||
name = if k == "command" then "__unkeyed" else k;
|
||||
value = v;
|
||||
})
|
||||
action;
|
||||
}) action;
|
||||
|
||||
processMappings = mappings:
|
||||
ifNonNull' mappings
|
||||
(mapAttrs processMapping mappings);
|
||||
processMappings = mappings: ifNonNull' mappings (mapAttrs processMapping mappings);
|
||||
|
||||
processWindowMappings = window: {
|
||||
mappings = processMappings window.mappings;
|
||||
};
|
||||
processWindowMappings = window: { mappings = processMappings window.mappings; };
|
||||
|
||||
setupOptions = with cfg;
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
# Concatenate sources and extraSources, setting sources to it's default value if it is null
|
||||
# and extraSources is not null
|
||||
sources =
|
||||
if (extraSources != null)
|
||||
then
|
||||
if (sources == null)
|
||||
then ["filesystem" "git_status" "buffers"] ++ extraSources
|
||||
else sources ++ extraSources
|
||||
else sources;
|
||||
if (extraSources != null) then
|
||||
if (sources == null) then
|
||||
[
|
||||
"filesystem"
|
||||
"git_status"
|
||||
"buffers"
|
||||
]
|
||||
++ extraSources
|
||||
else
|
||||
sources ++ extraSources
|
||||
else
|
||||
sources;
|
||||
add_blank_line_at_top = addBlankLineAtTop;
|
||||
auto_clean_after_session_restore = autoCleanAfterSessionRestore;
|
||||
close_if_last_window = closeIfLastWindow;
|
||||
|
@ -1047,17 +994,11 @@ in {
|
|||
source_selector = with sourceSelector; {
|
||||
inherit winbar statusline;
|
||||
show_scrolled_off_parent_node = showScrolledOffParentNode;
|
||||
sources =
|
||||
ifNonNull' sources
|
||||
(
|
||||
map
|
||||
(
|
||||
source: {
|
||||
sources = ifNonNull' sources (
|
||||
map (source: {
|
||||
inherit (source) source;
|
||||
display_name = source.displayName;
|
||||
}
|
||||
)
|
||||
sources
|
||||
}) sources
|
||||
);
|
||||
content_layout = contentLayout;
|
||||
tabs_layout = tabsLayout;
|
||||
|
@ -1073,15 +1014,11 @@ in {
|
|||
highlight_separator = highlightSeparator;
|
||||
highlight_separator_active = highlightSeparatorActive;
|
||||
};
|
||||
event_handlers =
|
||||
ifNonNull' eventHandlers
|
||||
(
|
||||
mapAttrsToList
|
||||
(event: handler: {
|
||||
event_handlers = ifNonNull' eventHandlers (
|
||||
mapAttrsToList (event: handler: {
|
||||
inherit event;
|
||||
handler = helpers.mkRaw handler;
|
||||
})
|
||||
eventHandlers
|
||||
}) eventHandlers
|
||||
);
|
||||
default_component_configs = with defaultComponentConfigs; {
|
||||
container = with container; {
|
||||
|
@ -1107,10 +1044,7 @@ in {
|
|||
folder_open = folderOpen;
|
||||
folder_empty = folderEmpty;
|
||||
folder_empty_open = folderEmptyOpen;
|
||||
inherit
|
||||
default
|
||||
highlight
|
||||
;
|
||||
inherit default highlight;
|
||||
};
|
||||
inherit modified;
|
||||
name = with name; {
|
||||
|
@ -1120,9 +1054,7 @@ in {
|
|||
};
|
||||
git_status = gitStatus;
|
||||
};
|
||||
renderers = ifNonNull' cfg.renderers (
|
||||
mapAttrs (name: processRendererComponentList) cfg.renderers
|
||||
);
|
||||
renderers = ifNonNull' cfg.renderers (mapAttrs (name: processRendererComponentList) cfg.renderers);
|
||||
nesting_rules = cfg.nestingRules;
|
||||
window = with window; {
|
||||
inherit position width height;
|
||||
|
@ -1179,14 +1111,7 @@ in {
|
|||
follow_cursor = followCursor;
|
||||
inherit kinds;
|
||||
custom_kinds.__raw =
|
||||
"{"
|
||||
+ (concatStringsSep ","
|
||||
(
|
||||
mapAttrsToList
|
||||
(id: name: ''[${id}] = "${name}"'')
|
||||
customKinds
|
||||
))
|
||||
+ "}";
|
||||
"{" + (concatStringsSep "," (mapAttrsToList (id: name: ''[${id}] = "${name}"'') customKinds)) + "}";
|
||||
window = processWindowMappings window;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nvim-tree;
|
||||
inherit (helpers) ifNonNull';
|
||||
|
||||
|
@ -29,16 +30,17 @@ with lib; let
|
|||
You shouldn't define `"width"` and `"height"` values here.
|
||||
They will be overridden to fit the file_popup content.
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(
|
||||
mkRemovedOptionModule ["plugins" "nvim-tree" "view" "hideRootFolder"]
|
||||
"Set `plugins.nvim-tree.renderer.rootFolderLabel` to `false` to hide the root folder."
|
||||
)
|
||||
(mkRemovedOptionModule [
|
||||
"plugins"
|
||||
"nvim-tree"
|
||||
"view"
|
||||
"hideRootFolder"
|
||||
] "Set `plugins.nvim-tree.renderer.rootFolderLabel` to `false` to hide the root folder.")
|
||||
];
|
||||
options.plugins.nvim-tree =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
options.plugins.nvim-tree = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-tree";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-tree" pkgs.vimPlugins.nvim-tree-lua;
|
||||
|
@ -96,11 +98,12 @@ in {
|
|||
|
||||
sortBy =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
types.either
|
||||
(types.enum ["name" "case_sensitive" "modification_time" "extension"])
|
||||
helpers.nixvimTypes.rawLua
|
||||
)
|
||||
(types.either (types.enum [
|
||||
"name"
|
||||
"case_sensitive"
|
||||
"modification_time"
|
||||
"extension"
|
||||
]) helpers.nixvimTypes.rawLua)
|
||||
"name"
|
||||
''
|
||||
Changes how files within the same directory are sorted.
|
||||
|
@ -361,14 +364,17 @@ in {
|
|||
|
||||
width =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types;
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
int
|
||||
(submodule {
|
||||
options = let
|
||||
options =
|
||||
let
|
||||
strOrInt = either str int;
|
||||
in {
|
||||
in
|
||||
{
|
||||
# TODO check type
|
||||
min = helpers.defaultNullOpts.mkNullable strOrInt "30" "Minimum dynamic width.";
|
||||
|
||||
|
@ -377,20 +383,25 @@ in {
|
|||
'';
|
||||
|
||||
padding =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(either ints.unsigned helpers.nixvimTypes.rawLua)
|
||||
"1"
|
||||
helpers.defaultNullOpts.mkNullable (either ints.unsigned helpers.nixvimTypes.rawLua) "1"
|
||||
"Extra padding to the right.";
|
||||
};
|
||||
})
|
||||
])
|
||||
]
|
||||
)
|
||||
"30"
|
||||
''
|
||||
Width of the window: can be a `%` string, a number representing columns or a table.
|
||||
A table indicates that the view should be dynamically sized based on the longest line.
|
||||
'';
|
||||
|
||||
side = helpers.defaultNullOpts.mkEnumFirstDefault ["left" "right"] ''
|
||||
side =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
''
|
||||
Side of the tree, can be `"left"`, `"right"`.
|
||||
'';
|
||||
|
||||
|
@ -409,7 +420,15 @@ in {
|
|||
will be the line number instead of `0`.
|
||||
'';
|
||||
|
||||
signcolumn = helpers.defaultNullOpts.mkEnum ["yes" "auto" "no"] "yes" ''
|
||||
signcolumn =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"yes"
|
||||
"auto"
|
||||
"no"
|
||||
]
|
||||
"yes"
|
||||
''
|
||||
Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`.
|
||||
'';
|
||||
|
||||
|
@ -447,7 +466,12 @@ in {
|
|||
|
||||
highlightOpenedFiles =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
["none" "icon" "name" "all"]
|
||||
[
|
||||
"none"
|
||||
"icon"
|
||||
"name"
|
||||
"all"
|
||||
]
|
||||
''
|
||||
Highlight icons and/or names for opened files using the `NvimTreeOpenedFile` highlight
|
||||
group.
|
||||
|
@ -455,7 +479,12 @@ in {
|
|||
|
||||
highlightModified =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
["none" "icon" "name" "all"]
|
||||
[
|
||||
"none"
|
||||
"icon"
|
||||
"name"
|
||||
"all"
|
||||
]
|
||||
''
|
||||
Highlight icons and/or names for modified files using the `NvimTreeModified` highlight
|
||||
group.
|
||||
|
@ -466,7 +495,14 @@ in {
|
|||
rootFolderLabel =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
# Type
|
||||
(with types; oneOf [str bool helpers.nixvimTypes.rawLua])
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
bool
|
||||
helpers.nixvimTypes.rawLua
|
||||
]
|
||||
)
|
||||
# Default
|
||||
":~:s?$?/..?"
|
||||
# Description
|
||||
|
@ -519,7 +555,11 @@ in {
|
|||
|
||||
gitPlacement =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["after" "before" "signcolumn"]
|
||||
[
|
||||
"after"
|
||||
"before"
|
||||
"signcolumn"
|
||||
]
|
||||
"before"
|
||||
''
|
||||
Place where the git icons will be rendered.
|
||||
|
@ -531,7 +571,11 @@ in {
|
|||
|
||||
modifiedPlacement =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["after" "before" "signcolumn"]
|
||||
[
|
||||
"after"
|
||||
"before"
|
||||
"signcolumn"
|
||||
]
|
||||
"after"
|
||||
''
|
||||
Place where the modified icon will be rendered.
|
||||
|
@ -639,8 +683,7 @@ in {
|
|||
};
|
||||
|
||||
specialFiles =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.listOf types.str)
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
"[ \"Cargo.toml\" \"Makefile\" \"README.md\" \"readme.md\" ]"
|
||||
"A list of filenames that gets highlighted with `NvimTreeSpecialFile`.";
|
||||
|
||||
|
@ -739,9 +782,7 @@ in {
|
|||
'';
|
||||
|
||||
picker =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.either types.str helpers.nixvimTypes.rawLua)
|
||||
"default"
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "default"
|
||||
''
|
||||
Change the default window picker, can be a string `"default"` or a function.
|
||||
The function should return the window id that will open the node, or `nil` if an
|
||||
|
@ -867,8 +908,10 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
disable_netrw = disableNetrw;
|
||||
hijack_netrw = hijackNetrw;
|
||||
|
@ -898,10 +941,7 @@ in {
|
|||
show_on_open_dirs = showOnOpenDirs;
|
||||
inherit icons;
|
||||
severity = with severity; {
|
||||
inherit
|
||||
min
|
||||
max
|
||||
;
|
||||
inherit min max;
|
||||
};
|
||||
};
|
||||
git = with git; {
|
||||
|
@ -959,15 +999,30 @@ in {
|
|||
inherit padding;
|
||||
symlink_arrow = symlinkArrow;
|
||||
show = with show; {
|
||||
inherit file folder git modified;
|
||||
inherit
|
||||
file
|
||||
folder
|
||||
git
|
||||
modified
|
||||
;
|
||||
folder_arrow = folderArrow;
|
||||
};
|
||||
glyphs = with glyphs; {
|
||||
inherit default symlink modified git;
|
||||
inherit
|
||||
default
|
||||
symlink
|
||||
modified
|
||||
git
|
||||
;
|
||||
folder = with folder; {
|
||||
arrow_closed = arrowClosed;
|
||||
arrow_open = arrowOpen;
|
||||
inherit default open empty symlink;
|
||||
inherit
|
||||
default
|
||||
open
|
||||
empty
|
||||
symlink
|
||||
;
|
||||
empty_open = emptyOpen;
|
||||
symlink_open = symlinkOpen;
|
||||
};
|
||||
|
@ -1016,7 +1071,14 @@ in {
|
|||
log = with log; {
|
||||
inherit enable truncate;
|
||||
types = with log.types; {
|
||||
inherit all profile dev diagnostics git watcher;
|
||||
inherit
|
||||
all
|
||||
profile
|
||||
dev
|
||||
diagnostics
|
||||
git
|
||||
watcher
|
||||
;
|
||||
inherit (log.types) config;
|
||||
copy_paste = copyPaste;
|
||||
};
|
||||
|
|
|
@ -5,11 +5,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.diffview;
|
||||
mkWinConfig = type: width: height: position:
|
||||
with helpers.defaultNullOpts; {
|
||||
type = mkEnum ["split" "float"] type ''
|
||||
mkWinConfig =
|
||||
type: width: height: position: with helpers.defaultNullOpts; {
|
||||
type =
|
||||
mkEnum
|
||||
[
|
||||
"split"
|
||||
"float"
|
||||
]
|
||||
type
|
||||
''
|
||||
Determines whether the window should be a float or a normal
|
||||
split.
|
||||
'';
|
||||
|
@ -26,12 +34,28 @@ with lib; let
|
|||
`"top"|"bottom"`.
|
||||
'';
|
||||
|
||||
position = mkEnum ["left" "top" "right" "bottom"] position ''
|
||||
position =
|
||||
mkEnum
|
||||
[
|
||||
"left"
|
||||
"top"
|
||||
"right"
|
||||
"bottom"
|
||||
]
|
||||
position
|
||||
''
|
||||
Determines where the panel is positioned (only when
|
||||
`type="split"`).
|
||||
'';
|
||||
|
||||
relative = mkEnum ["editor" "win"] "editor" ''
|
||||
relative =
|
||||
mkEnum
|
||||
[
|
||||
"editor"
|
||||
"win"
|
||||
]
|
||||
"editor"
|
||||
''
|
||||
Determines what the `position` is relative to (when
|
||||
`type="split"`).
|
||||
'';
|
||||
|
@ -47,8 +71,10 @@ with lib; let
|
|||
These options are applied whenever the window is opened.
|
||||
'';
|
||||
};
|
||||
in {
|
||||
options.plugins.diffview = with helpers.defaultNullOpts;
|
||||
in
|
||||
{
|
||||
options.plugins.diffview =
|
||||
with helpers.defaultNullOpts;
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "diffview";
|
||||
|
@ -103,7 +129,8 @@ in {
|
|||
done = mkStr "✓" "";
|
||||
};
|
||||
|
||||
view = let
|
||||
view =
|
||||
let
|
||||
layoutsDescription = ''
|
||||
Configure the layout and behavior of different types of views.
|
||||
For more info, see ':h diffview-config-view.x.layout'.
|
||||
|
@ -123,9 +150,17 @@ in {
|
|||
|
||||
B
|
||||
'';
|
||||
in {
|
||||
in
|
||||
{
|
||||
default = {
|
||||
layout = mkEnum ["diff2_horizontal" "diff2_vertical"] "diff2_horizontal" ''
|
||||
layout =
|
||||
mkEnum
|
||||
[
|
||||
"diff2_horizontal"
|
||||
"diff2_vertical"
|
||||
]
|
||||
"diff2_horizontal"
|
||||
''
|
||||
Config for changed files, and staged files in diff views.
|
||||
${layoutsDescription}
|
||||
- A: Old state
|
||||
|
@ -142,7 +177,17 @@ in {
|
|||
};
|
||||
|
||||
mergeTool = {
|
||||
layout = mkEnum ["diff1_plain" "diff3_horizontal" "diff3_vertical" "diff3_mixed" "diff4_mixed"] "diff3_horizontal" ''
|
||||
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)
|
||||
|
@ -190,7 +235,14 @@ in {
|
|||
};
|
||||
|
||||
fileHistory = {
|
||||
layout = mkEnum ["diff2_horizontal" "diff2_vertical"] "diff2_horizontal" ''
|
||||
layout =
|
||||
mkEnum
|
||||
[
|
||||
"diff2_horizontal"
|
||||
"diff2_vertical"
|
||||
]
|
||||
"diff2_horizontal"
|
||||
''
|
||||
Config for changed files in file history views.
|
||||
${layoutsDescription}
|
||||
- A: Old state
|
||||
|
@ -208,19 +260,36 @@ in {
|
|||
};
|
||||
|
||||
filePanel = {
|
||||
listingStyle = mkEnum ["list" "tree"] "tree" ''
|
||||
listingStyle =
|
||||
mkEnum
|
||||
[
|
||||
"list"
|
||||
"tree"
|
||||
]
|
||||
"tree"
|
||||
''
|
||||
One of 'list' or 'tree'
|
||||
'';
|
||||
|
||||
treeOptions = let
|
||||
treeOptions =
|
||||
let
|
||||
commonDesc = "Only applies when listing_style is 'tree'";
|
||||
in {
|
||||
in
|
||||
{
|
||||
flattenDirs = mkBool true ''
|
||||
Flatten dirs that only contain one single dir
|
||||
${commonDesc}
|
||||
'';
|
||||
|
||||
folderStatuses = mkEnum ["never" "only_folded" "always"] "only_folded" ''
|
||||
folderStatuses =
|
||||
mkEnum
|
||||
[
|
||||
"never"
|
||||
"only_folded"
|
||||
"always"
|
||||
]
|
||||
"only_folded"
|
||||
''
|
||||
One of 'never', 'only_folded' or 'always'.
|
||||
${commonDesc}
|
||||
'';
|
||||
|
@ -228,7 +297,8 @@ in {
|
|||
winConfig = mkWinConfig "split" 35 "" "left";
|
||||
};
|
||||
fileHistoryPanel = {
|
||||
logOptions = let
|
||||
logOptions =
|
||||
let
|
||||
mkNullStr = helpers.mkNullOrOption types.str;
|
||||
mkNullBool = helpers.mkNullOrOption types.bool;
|
||||
logOptions = {
|
||||
|
@ -307,7 +377,18 @@ in {
|
|||
or by the function name regex <funcname>, within the <file>.
|
||||
'';
|
||||
|
||||
diffMerges = helpers.mkNullOrOption (types.enum ["off" "on" "first-parent" "separate" "combined" "dense-combined" "remerge"]) ''
|
||||
diffMerges =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"off"
|
||||
"on"
|
||||
"first-parent"
|
||||
"separate"
|
||||
"combined"
|
||||
"dense-combined"
|
||||
"remerge"
|
||||
])
|
||||
''
|
||||
Determines how merge commits are treated.
|
||||
'';
|
||||
|
||||
|
@ -333,7 +414,8 @@ in {
|
|||
file.
|
||||
'';
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
git = {
|
||||
singleFile = logOptions;
|
||||
|
||||
|
@ -352,17 +434,21 @@ in {
|
|||
winConfig = mkWinConfig "float" "" "" "";
|
||||
};
|
||||
|
||||
defaultArgs = let
|
||||
defaultArgs =
|
||||
let
|
||||
commonDesc = "Default args prepended to the arg-list for the listed commands";
|
||||
in {
|
||||
in
|
||||
{
|
||||
diffviewOpen = mkNullable (types.listOf types.str) "[ ]" commonDesc;
|
||||
|
||||
diffviewFileHistory = mkNullable (types.listOf types.str) "[ ]" commonDesc;
|
||||
};
|
||||
|
||||
hooks = let
|
||||
hooks =
|
||||
let
|
||||
mkNullStr = helpers.mkNullOrOption types.str;
|
||||
in {
|
||||
in
|
||||
{
|
||||
viewOpened = mkNullStr ''
|
||||
{view_opened} (`fun(view: View)`)
|
||||
|
||||
|
@ -466,10 +552,13 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
keymaps = let
|
||||
keymapList = desc:
|
||||
keymaps =
|
||||
let
|
||||
keymapList =
|
||||
desc:
|
||||
mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
|
@ -492,7 +581,8 @@ in {
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
List of keybindings.
|
||||
${desc}
|
||||
|
@ -507,7 +597,8 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
disableDefaults = mkBool false ''
|
||||
Disable the default keymaps.
|
||||
'';
|
||||
|
@ -549,7 +640,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
diff_binaries = diffBinaries;
|
||||
enhanced_diff_hl = enhancedDiffHl;
|
||||
|
@ -608,9 +700,11 @@ in {
|
|||
};
|
||||
|
||||
file_history_panel = with fileHistoryPanel; {
|
||||
log_options = with logOptions; let
|
||||
setupLogOptions = opts:
|
||||
with opts; {
|
||||
log_options =
|
||||
with logOptions;
|
||||
let
|
||||
setupLogOptions =
|
||||
opts: with opts; {
|
||||
inherit base;
|
||||
rev_range = revRange;
|
||||
path_args = pathArgs;
|
||||
|
@ -633,7 +727,8 @@ in {
|
|||
G = g;
|
||||
S = s;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
git = with git; {
|
||||
single_file = setupLogOptions singleFile;
|
||||
multi_file = setupLogOptions multiFile;
|
||||
|
@ -683,9 +778,17 @@ in {
|
|||
diff_buf_win_enter = diffBufWinEnter;
|
||||
};
|
||||
|
||||
keymaps = with keymaps; let
|
||||
convertToKeybinding = attr: [attr.mode attr.key attr.action {"desc" = attr.description;}];
|
||||
in {
|
||||
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;
|
||||
|
@ -698,12 +801,8 @@ in {
|
|||
};
|
||||
};
|
||||
in
|
||||
mkIf
|
||||
cfg.enable
|
||||
{
|
||||
extraPlugins =
|
||||
[cfg.package]
|
||||
++ (optional cfg.useIcons pkgs.vimPlugins.nvim-web-devicons);
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ] ++ (optional cfg.useIcons pkgs.vimPlugins.nvim-web-devicons);
|
||||
extraConfigLua = ''
|
||||
require("diffview").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.git-worktree;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.git-worktree = {
|
||||
enable = mkEnableOption "git-worktree";
|
||||
|
@ -43,7 +45,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
enabled = cfg.enable;
|
||||
change_directory_command = cfg.changeDirectoryCommand;
|
||||
|
@ -68,15 +71,13 @@ in {
|
|||
|
||||
extraPackages = [ pkgs.git ];
|
||||
|
||||
extraConfigLua = let
|
||||
extraConfigLua =
|
||||
let
|
||||
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
|
||||
in ''
|
||||
in
|
||||
''
|
||||
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
|
||||
${
|
||||
if cfg.enableTelescope
|
||||
then telescopeCfg
|
||||
else ""
|
||||
}
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.gitblame;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.gitblame = {
|
||||
enable = mkEnableOption "gitblame";
|
||||
|
@ -22,19 +24,28 @@ in {
|
|||
|
||||
highlightGroup = helpers.defaultNullOpts.mkStr "Comment" "The highlight group for virtual text.";
|
||||
|
||||
displayVirtualText = helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true) "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
|
||||
displayVirtualText =
|
||||
helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true)
|
||||
"If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
|
||||
|
||||
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString []) "A list of filetypes for which gitblame information will not be displayed.";
|
||||
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString
|
||||
[ ]
|
||||
) "A list of filetypes for which gitblame information will not be displayed.";
|
||||
|
||||
delay = helpers.defaultNullOpts.mkUnsignedInt 0 "The delay in milliseconds after which the blame info will be displayed.";
|
||||
delay =
|
||||
helpers.defaultNullOpts.mkUnsignedInt 0
|
||||
"The delay in milliseconds after which the blame info will be displayed.";
|
||||
|
||||
virtualTextColumn = helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null) "Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
|
||||
virtualTextColumn =
|
||||
helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null)
|
||||
"Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
|
||||
|
||||
extmarkOptions = helpers.defaultNullOpts.mkAttributeSet (toString null) "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
enabled = cfg.enable;
|
||||
message_template = cfg.messageTemplate;
|
||||
|
@ -42,9 +53,7 @@ in {
|
|||
message_when_not_committed = cfg.messageWhenNotCommitted;
|
||||
highlight_group = cfg.highlightGroup;
|
||||
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
|
||||
if cfg.displayVirtualText
|
||||
then 1
|
||||
else 0
|
||||
if cfg.displayVirtualText then 1 else 0
|
||||
);
|
||||
ignored_filetypes = cfg.ignoredFiletypes;
|
||||
inherit (cfg) delay;
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.gitgutter;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.gitgutter = {
|
||||
enable = mkEnableOption "gitgutter";
|
||||
|
@ -57,8 +59,10 @@ in {
|
|||
};
|
||||
|
||||
signs = mkOption {
|
||||
type = let
|
||||
signOption = desc:
|
||||
type =
|
||||
let
|
||||
signOption =
|
||||
desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
@ -99,7 +103,8 @@ in {
|
|||
};
|
||||
|
||||
grep = mkOption {
|
||||
type = types.nullOr (types.oneOf [
|
||||
type = types.nullOr (
|
||||
types.oneOf [
|
||||
(types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
|
@ -114,7 +119,8 @@ in {
|
|||
};
|
||||
})
|
||||
types.str
|
||||
]);
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "A non-standard grep to use instead of the default";
|
||||
};
|
||||
|
@ -169,15 +175,10 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
grepPackage =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then [cfg.grep.package]
|
||||
else [];
|
||||
grepCommand =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then cfg.grep.command
|
||||
else cfg.grep;
|
||||
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 ];
|
||||
|
@ -200,8 +201,12 @@ in {
|
|||
gitgutter_sign_added = mkIf (cfg.signs.added != null) cfg.signs.added;
|
||||
gitgutter_sign_modified = mkIf (cfg.signs.modified != null) cfg.signs.modified;
|
||||
gitgutter_sign_removed = mkIf (cfg.signs.removed != null) cfg.signs.removed;
|
||||
gitgutter_sign_removed_first_line = mkIf (cfg.signs.removedFirstLine != null) cfg.signs.removedFirstLine;
|
||||
gitgutter_sign_removed_above_and_bellow = mkIf (cfg.signs.removedAboveAndBelow != null) cfg.signs.removedAboveAndBelow;
|
||||
gitgutter_sign_removed_first_line = mkIf (
|
||||
cfg.signs.removedFirstLine != null
|
||||
) cfg.signs.removedFirstLine;
|
||||
gitgutter_sign_removed_above_and_bellow = mkIf (
|
||||
cfg.signs.removedAboveAndBelow != null
|
||||
) cfg.signs.removedAboveAndBelow;
|
||||
gitgutter_sign_modified_above = mkIf (cfg.signs.modifiedAbove != null) cfg.signs.modifiedAbove;
|
||||
|
||||
gitgutter_diff_relative_to = mkIf cfg.diffRelativeToWorkingTree "working_tree";
|
||||
|
|
|
@ -17,12 +17,10 @@ with lib;
|
|||
|
||||
extraOptions = {
|
||||
keymap = mkOption {
|
||||
type = with types;
|
||||
nullOr
|
||||
(
|
||||
either
|
||||
str
|
||||
(submodule {
|
||||
type =
|
||||
with types;
|
||||
nullOr (
|
||||
either str (submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = str;
|
||||
|
@ -49,16 +47,15 @@ with lib;
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
keymaps =
|
||||
optional (cfg.keymap != null)
|
||||
keymaps = optional (cfg.keymap != null) (
|
||||
(
|
||||
(
|
||||
if isString cfg.keymap
|
||||
then {
|
||||
if isString cfg.keymap then
|
||||
{
|
||||
mode = "n";
|
||||
key = cfg.keymap;
|
||||
}
|
||||
else cfg.keymap
|
||||
else
|
||||
cfg.keymap
|
||||
)
|
||||
// {
|
||||
action.__raw = "require('gitignore').generate";
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.gitlinker =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
with lib;
|
||||
{
|
||||
options.plugins.gitlinker = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "gitlinker.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "gitlinker.nvim" pkgs.vimPlugins.gitlinker-nvim;
|
||||
|
@ -40,16 +39,7 @@ with lib; {
|
|||
mappings = helpers.defaultNullOpts.mkStr "<leader>gy" "Mapping to call url generation.";
|
||||
|
||||
callbacks =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
attrsOf
|
||||
(
|
||||
either
|
||||
str
|
||||
helpers.nixvimTypes.rawLua
|
||||
)
|
||||
)
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
"github.com" = "get_github_type_url";
|
||||
|
@ -79,40 +69,39 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitlinker;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
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;
|
||||
if isString actionCallback then
|
||||
helpers.mkRaw "require('gitlinker.actions').${actionCallback}"
|
||||
else
|
||||
actionCallback;
|
||||
print_url = printUrl;
|
||||
inherit mappings;
|
||||
};
|
||||
callbacks =
|
||||
helpers.ifNonNull' callbacks
|
||||
(
|
||||
mapAttrs
|
||||
(
|
||||
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 ''
|
||||
in
|
||||
''
|
||||
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
meta.maintainers = [ maintainers.traxys ];
|
||||
|
||||
options.plugins.gitmessenger = {
|
||||
|
@ -17,7 +18,14 @@ with lib; {
|
|||
A popup window is no longer closed automatically when moving a cursor after the window is
|
||||
shown up.
|
||||
'';
|
||||
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "current" "all"] ''
|
||||
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.
|
||||
|
@ -25,12 +33,8 @@ with lib; {
|
|||
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";
|
||||
gitCommand = helpers.defaultNullOpts.mkStr "git" "git command to retrieve commit messages.";
|
||||
noDefaultMappings = helpers.defaultNullOpts.mkBool false "When this value is set, it does not define any key mappings";
|
||||
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
|
||||
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
|
||||
showing a popup does not move the cursor in the window.
|
||||
|
@ -92,7 +96,8 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitmessenger;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -16,42 +16,157 @@ with lib;
|
|||
# TODO: introduced 2024-03-12, remove on 2024-05-12
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
["signs" "add" "hl"]
|
||||
["signs" "add" "text"]
|
||||
["signs" "add" "numhl"]
|
||||
["signs" "add" "linehl"]
|
||||
["signs" "add" "showCount"]
|
||||
["signs" "change" "hl"]
|
||||
["signs" "change" "text"]
|
||||
["signs" "change" "numhl"]
|
||||
["signs" "change" "linehl"]
|
||||
["signs" "change" "showCount"]
|
||||
["signs" "topdelete" "hl"]
|
||||
["signs" "topdelete" "text"]
|
||||
["signs" "topdelete" "numhl"]
|
||||
["signs" "topdelete" "linehl"]
|
||||
["signs" "topdelete" "showCount"]
|
||||
["signs" "changedelete" "hl"]
|
||||
["signs" "changedelete" "text"]
|
||||
["signs" "changedelete" "numhl"]
|
||||
["signs" "changedelete" "linehl"]
|
||||
["signs" "changedelete" "showCount"]
|
||||
["signs" "untracked" "hl"]
|
||||
["signs" "untracked" "text"]
|
||||
["signs" "untracked" "numhl"]
|
||||
["signs" "untracked" "linehl"]
|
||||
["signs" "untracked" "showCount"]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"hl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"numhl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"linehl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"add"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"hl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"numhl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"linehl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"change"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"hl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"numhl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"linehl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"topdelete"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"hl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"numhl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"linehl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"changedelete"
|
||||
"showCount"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"hl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"text"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"numhl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"linehl"
|
||||
]
|
||||
[
|
||||
"signs"
|
||||
"untracked"
|
||||
"showCount"
|
||||
]
|
||||
"worktrees"
|
||||
"signPriority"
|
||||
"signcolumn"
|
||||
"numhl"
|
||||
"linehl"
|
||||
"showDeleted"
|
||||
["diffOpts" "algorithm"]
|
||||
["diffOpts" "internal"]
|
||||
["diffOpts" "indentHeuristic"]
|
||||
["diffOpts" "vertical"]
|
||||
["diffOpts" "linematch"]
|
||||
[
|
||||
"diffOpts"
|
||||
"algorithm"
|
||||
]
|
||||
[
|
||||
"diffOpts"
|
||||
"internal"
|
||||
]
|
||||
[
|
||||
"diffOpts"
|
||||
"indentHeuristic"
|
||||
]
|
||||
[
|
||||
"diffOpts"
|
||||
"vertical"
|
||||
]
|
||||
[
|
||||
"diffOpts"
|
||||
"linematch"
|
||||
]
|
||||
"base"
|
||||
"countChars"
|
||||
"maxFileLength"
|
||||
|
@ -59,55 +174,110 @@ with lib;
|
|||
"attachToUntracked"
|
||||
"updateDebounce"
|
||||
"currentLineBlame"
|
||||
["currentLineBlameOpts" "virtText"]
|
||||
["currentLineBlameOpts" "virtTextPos"]
|
||||
["currentLineBlameOpts" "delay"]
|
||||
["currentLineBlameOpts" "ignoreWhitespace"]
|
||||
["currentLineBlameOpts" "virtTextPriority"]
|
||||
[
|
||||
"currentLineBlameOpts"
|
||||
"virtText"
|
||||
]
|
||||
[
|
||||
"currentLineBlameOpts"
|
||||
"virtTextPos"
|
||||
]
|
||||
[
|
||||
"currentLineBlameOpts"
|
||||
"delay"
|
||||
]
|
||||
[
|
||||
"currentLineBlameOpts"
|
||||
"ignoreWhitespace"
|
||||
]
|
||||
[
|
||||
"currentLineBlameOpts"
|
||||
"virtTextPriority"
|
||||
]
|
||||
"trouble"
|
||||
["yadm" "enable"]
|
||||
[
|
||||
"yadm"
|
||||
"enable"
|
||||
]
|
||||
"wordDiff"
|
||||
"debugMode"
|
||||
];
|
||||
imports = let
|
||||
basePluginPaths = ["plugins" "gitsigns"];
|
||||
imports =
|
||||
let
|
||||
basePluginPaths = [
|
||||
"plugins"
|
||||
"gitsigns"
|
||||
];
|
||||
settingsPath = basePluginPaths ++ [ "settings" ];
|
||||
in [
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"onAttach"
|
||||
"function"
|
||||
]
|
||||
) (settingsPath ++ [ "on_attach" ]))
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPaths ++ ["onAttach" "function"])
|
||||
(settingsPath ++ ["on_attach"])
|
||||
basePluginPaths
|
||||
++ [
|
||||
"watchGitDir"
|
||||
"enable"
|
||||
]
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePluginPaths ++ ["watchGitDir" "enable"])
|
||||
(settingsPath ++ ["watch_gitdir" "enable"])
|
||||
settingsPath
|
||||
++ [
|
||||
"watch_gitdir"
|
||||
"enable"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"watchGitDir"
|
||||
"interval"
|
||||
]
|
||||
) "The option has been removed from upstream.")
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPaths
|
||||
++ [
|
||||
"watchGitDir"
|
||||
"followFiles"
|
||||
]
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPaths ++ ["watchGitDir" "interval"])
|
||||
"The option has been removed from upstream."
|
||||
settingsPath
|
||||
++ [
|
||||
"watch_gitdir"
|
||||
"follow_files"
|
||||
]
|
||||
)
|
||||
(
|
||||
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"])
|
||||
)
|
||||
(mkRenamedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"statusFormatter"
|
||||
"function"
|
||||
]
|
||||
) (settingsPath ++ [ "status_formatter" ]))
|
||||
(mkRenamedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"currentLineBlameFormatter"
|
||||
"normal"
|
||||
]
|
||||
) (settingsPath ++ [ "current_line_blame_formatter" ]))
|
||||
(mkRenamedOptionModule (
|
||||
basePluginPaths
|
||||
++ [
|
||||
"currentLineBlameFormatter"
|
||||
"nonCommitted"
|
||||
]
|
||||
) (settingsPath ++ [ "current_line_blame_formatter_nc" ]))
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
|
@ -143,8 +313,7 @@ with lib;
|
|||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
optional
|
||||
((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
|
||||
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`.
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; {
|
||||
signs = let
|
||||
signs =
|
||||
let
|
||||
signOptions = defaults: {
|
||||
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
|
||||
Specifies the highlight group to use for the sign.
|
||||
|
@ -25,7 +24,8 @@ with lib; {
|
|||
Showing count of hunk, e.g. number of deleted lines.
|
||||
'';
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
add = signOptions {
|
||||
hl = "GitSignsAdd";
|
||||
text = "┃";
|
||||
|
@ -64,17 +64,14 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
worktrees = let
|
||||
worktrees =
|
||||
let
|
||||
worktreeType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
toplevel = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
};
|
||||
toplevel = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
|
||||
|
||||
gitdir = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
};
|
||||
gitdir = mkOption { type = with helpers.nixvimTypes; maybeRaw str; };
|
||||
};
|
||||
};
|
||||
in
|
||||
|
@ -149,13 +146,19 @@ with lib; {
|
|||
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||
'';
|
||||
|
||||
diff_opts = let
|
||||
diff_opts =
|
||||
let
|
||||
diffOptType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
algorithm =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
["myers" "minimal" "patience" "histogram"]
|
||||
[
|
||||
"myers"
|
||||
"minimal"
|
||||
"patience"
|
||||
"histogram"
|
||||
]
|
||||
''
|
||||
Diff algorithm to use. Values:
|
||||
- "myers" the default algorithm
|
||||
|
@ -236,9 +239,7 @@ with lib; {
|
|||
- to define characters to be used for counts greater than 9.
|
||||
'';
|
||||
|
||||
status_formatter =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
status_formatter = helpers.defaultNullOpts.mkLuaFn ''
|
||||
function(status)
|
||||
local added, changed, removed = status.added, status.changed, status.removed
|
||||
local status_txt = {}
|
||||
|
@ -253,8 +254,7 @@ with lib; {
|
|||
end
|
||||
return table.concat(status_txt, ' ')
|
||||
end
|
||||
''
|
||||
"Function used to format `b:gitsigns_status`.";
|
||||
'' "Function used to format `b:gitsigns_status`.";
|
||||
|
||||
max_file_length = helpers.defaultNullOpts.mkUnsignedInt 40000 ''
|
||||
Max file length (in lines) to attach to.
|
||||
|
@ -298,7 +298,14 @@ with lib; {
|
|||
Whether to show a virtual text blame annotation
|
||||
'';
|
||||
|
||||
virt_text_pos = helpers.defaultNullOpts.mkEnumFirstDefault ["eol" "overlay" "right_align"] ''
|
||||
virt_text_pos =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"eol"
|
||||
"overlay"
|
||||
"right_align"
|
||||
]
|
||||
''
|
||||
Blame annotation position.
|
||||
|
||||
Available values:
|
||||
|
@ -320,10 +327,7 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
|
||||
current_line_blame_formatter =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
" <author>, <author_time> - <summary> "
|
||||
''
|
||||
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:
|
||||
|
@ -395,10 +399,7 @@ with lib; {
|
|||
`|nvim_buf_set_extmark|` and thus must be a list of `[text, highlight]` tuples.
|
||||
'';
|
||||
|
||||
current_line_blame_formatter_nc =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
" <author>"
|
||||
''
|
||||
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.
|
||||
|
||||
|
|
|
@ -20,12 +20,11 @@ with lib;
|
|||
'';
|
||||
|
||||
floating_window_scaling_factor =
|
||||
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative
|
||||
"0.9" "Set the scaling factor for floating window.";
|
||||
helpers.defaultNullOpts.mkNullable types.numbers.nonnegative "0.9"
|
||||
"Set the scaling factor for floating window.";
|
||||
|
||||
floating_window_border_chars =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["╭" "─" "╮" "│" "╯" "─" "╰" "│"]''
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["╭" "─" "╮" "│" "╯" "─" "╰" "│"]''
|
||||
"Customize lazygit popup window border characters.";
|
||||
|
||||
floating_window_use_plenary = helpers.defaultNullOpts.mkBool false ''
|
||||
|
@ -40,21 +39,24 @@ with lib;
|
|||
Config file path is evaluated if this value is `true`.
|
||||
'';
|
||||
|
||||
config_file_path =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
str (listOf str)
|
||||
)
|
||||
"[]"
|
||||
"Custom config file path or list of custom config file paths.";
|
||||
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_border_chars = [
|
||||
"╭"
|
||||
"─"
|
||||
"╮"
|
||||
"│"
|
||||
"╯"
|
||||
"─"
|
||||
"╰"
|
||||
"│"
|
||||
];
|
||||
floating_window_use_plenary = false;
|
||||
use_neovim_remote = true;
|
||||
use_custom_config_file_path = false;
|
||||
|
|
|
@ -16,10 +16,17 @@ with lib;
|
|||
# TODO introduced 2024-02-29: remove 2024-04-29
|
||||
deprecateExtraOptions = true;
|
||||
imports =
|
||||
map (
|
||||
map
|
||||
(
|
||||
optionPath:
|
||||
mkRemovedOptionModule
|
||||
(["plugins" "neogit"] ++ optionPath)
|
||||
(
|
||||
[
|
||||
"plugins"
|
||||
"neogit"
|
||||
]
|
||||
++ optionPath
|
||||
)
|
||||
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
|
||||
)
|
||||
[
|
||||
|
@ -27,8 +34,14 @@ with lib;
|
|||
[ "disableBuiltinNotifications" ]
|
||||
[ "useMagitKeybindings " ]
|
||||
[ "commitPopup" ]
|
||||
["sections" "unmerged"]
|
||||
["sections" "unpulled"]
|
||||
[
|
||||
"sections"
|
||||
"unmerged"
|
||||
]
|
||||
[
|
||||
"sections"
|
||||
"unpulled"
|
||||
]
|
||||
];
|
||||
optionsRenamedToSettings = [
|
||||
"disableSigns"
|
||||
|
@ -39,11 +52,26 @@ with lib;
|
|||
"kind"
|
||||
"signs"
|
||||
"integrations"
|
||||
["sections" "untracked"]
|
||||
["sections" "unstaged"]
|
||||
["sections" "staged"]
|
||||
["sections" "stashes"]
|
||||
["sections" "recent"]
|
||||
[
|
||||
"sections"
|
||||
"untracked"
|
||||
]
|
||||
[
|
||||
"sections"
|
||||
"unstaged"
|
||||
]
|
||||
[
|
||||
"sections"
|
||||
"staged"
|
||||
]
|
||||
[
|
||||
"sections"
|
||||
"stashes"
|
||||
]
|
||||
[
|
||||
"sections"
|
||||
"recent"
|
||||
]
|
||||
"mappings"
|
||||
];
|
||||
|
||||
|
@ -77,28 +105,25 @@ with lib;
|
|||
extraConfig = cfg: {
|
||||
assertions =
|
||||
map
|
||||
(
|
||||
name: {
|
||||
assertion = let
|
||||
(name: {
|
||||
assertion =
|
||||
let
|
||||
enabled = cfg.settings.integrations.${name};
|
||||
isEnabled = (isBool enabled) && enabled;
|
||||
in
|
||||
isEnabled
|
||||
-> config.plugins.${name}.enable;
|
||||
isEnabled -> config.plugins.${name}.enable;
|
||||
message = ''
|
||||
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
|
||||
'';
|
||||
}
|
||||
)
|
||||
})
|
||||
[
|
||||
"telescope"
|
||||
"diffview"
|
||||
"fzf-lua"
|
||||
];
|
||||
|
||||
extraPackages =
|
||||
optional
|
||||
(hasInfix "which" (cfg.settings.commit_view.verify_commit.__raw or ""))
|
||||
pkgs.which;
|
||||
extraPackages = optional (hasInfix "which" (
|
||||
cfg.settings.commit_view.verify_commit.__raw or ""
|
||||
)) pkgs.which;
|
||||
};
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue