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
25
default.nix
25
default.nix
|
@ -1,14 +1,11 @@
|
|||
(
|
||||
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";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{src = ./.;}
|
||||
)
|
||||
.defaultNix
|
||||
(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";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
) { src = ./.; }).defaultNix
|
||||
|
|
141
docs/default.nix
141
docs/default.nix
|
@ -2,18 +2,19 @@
|
|||
rawModules,
|
||||
helpers,
|
||||
pkgs,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
pkgsDoc =
|
||||
import (pkgs.applyPatches {
|
||||
name = "nixpkgs-nixvim-doc";
|
||||
src = pkgs.path;
|
||||
patches = [
|
||||
./either_recursive.patch
|
||||
];
|
||||
}) {
|
||||
inherit (pkgs) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
import
|
||||
(pkgs.applyPatches {
|
||||
name = "nixpkgs-nixvim-doc";
|
||||
src = pkgs.path;
|
||||
patches = [ ./either_recursive.patch ];
|
||||
})
|
||||
{
|
||||
inherit (pkgs) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
inherit (pkgsDoc) lib;
|
||||
|
||||
|
@ -24,21 +25,21 @@
|
|||
name = "<${repo}/${subpath}>";
|
||||
};
|
||||
|
||||
transformOptions = opt:
|
||||
transformOptions =
|
||||
opt:
|
||||
opt
|
||||
// {
|
||||
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
|
||||
)
|
||||
opt.declarations;
|
||||
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
|
||||
) opt.declarations;
|
||||
};
|
||||
|
||||
nixvmConfigType = lib.mkOptionType {
|
||||
|
@ -48,61 +49,51 @@
|
|||
# Evaluation is irrelevant, only used for documentation.
|
||||
};
|
||||
|
||||
topLevelModules =
|
||||
[
|
||||
../wrappers/modules/output.nix
|
||||
# Fake module to avoid a duplicated documentation
|
||||
(lib.setDefaultModuleLocation "${nixvimPath}/wrappers/modules/files.nix" {
|
||||
options.files = lib.mkOption {
|
||||
type = lib.types.attrsOf nixvmConfigType;
|
||||
description = "Extra files to add to the runtimepath";
|
||||
example = {
|
||||
"ftplugin/nix.lua" = {
|
||||
options = {
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
};
|
||||
topLevelModules = [
|
||||
../wrappers/modules/output.nix
|
||||
# Fake module to avoid a duplicated documentation
|
||||
(lib.setDefaultModuleLocation "${nixvimPath}/wrappers/modules/files.nix" {
|
||||
options.files = lib.mkOption {
|
||||
type = lib.types.attrsOf nixvmConfigType;
|
||||
description = "Extra files to add to the runtimepath";
|
||||
example = {
|
||||
"ftplugin/nix.lua" = {
|
||||
options = {
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
++ (rawModules pkgsDoc);
|
||||
|
||||
hmOptions =
|
||||
builtins.removeAttrs
|
||||
(lib.evalModules {
|
||||
modules = [
|
||||
(import ../wrappers/modules/hm.nix {inherit lib;})
|
||||
];
|
||||
};
|
||||
})
|
||||
.options
|
||||
["_module"];
|
||||
] ++ (rawModules pkgsDoc);
|
||||
|
||||
hmOptions = builtins.removeAttrs (lib.evalModules {
|
||||
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
||||
}).options [ "_module" ];
|
||||
in
|
||||
rec {
|
||||
options-json =
|
||||
(pkgsDoc.nixosOptionsDoc
|
||||
{
|
||||
inherit
|
||||
(lib.evalModules {
|
||||
modules = topLevelModules;
|
||||
specialArgs.helpers = helpers;
|
||||
})
|
||||
options
|
||||
;
|
||||
inherit transformOptions;
|
||||
warningsAreErrors = false;
|
||||
rec {
|
||||
options-json =
|
||||
(pkgsDoc.nixosOptionsDoc {
|
||||
inherit
|
||||
(lib.evalModules {
|
||||
modules = topLevelModules;
|
||||
specialArgs.helpers = helpers;
|
||||
})
|
||||
.optionsJSON;
|
||||
man-docs = pkgsDoc.callPackage ./man {inherit options-json;};
|
||||
}
|
||||
# Do not check if documentation builds fine on darwin as it fails:
|
||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) {
|
||||
docs = pkgsDoc.callPackage ./mdbook {
|
||||
options
|
||||
;
|
||||
inherit transformOptions;
|
||||
modules = topLevelModules;
|
||||
inherit helpers hmOptions;
|
||||
};
|
||||
}
|
||||
warningsAreErrors = false;
|
||||
}).optionsJSON;
|
||||
man-docs = pkgsDoc.callPackage ./man { inherit options-json; };
|
||||
}
|
||||
# Do not check if documentation builds fine on darwin as it fails:
|
||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) {
|
||||
docs = pkgsDoc.callPackage ./mdbook {
|
||||
inherit transformOptions;
|
||||
modules = topLevelModules;
|
||||
inherit helpers hmOptions;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
installShellFiles,
|
||||
nixos-render-docs,
|
||||
pandoc,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
manualFilter = ''
|
||||
local text = pandoc.text
|
||||
|
||||
|
@ -23,26 +24,34 @@
|
|||
end
|
||||
'';
|
||||
|
||||
manHeader = let
|
||||
mkMDSection = file: "<(pandoc --lua-filter <(echo \"$manualFilter\") -f gfm -t man ${file})";
|
||||
in
|
||||
runCommand "nixvim-general-doc-manpage" {
|
||||
nativeBuildInputs = [pandoc];
|
||||
inherit manualFilter;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
cat \
|
||||
${./nixvim-header-start.5} \
|
||||
${mkMDSection ../user-guide/helpers.md} \
|
||||
${mkMDSection ../user-guide/faq.md} \
|
||||
${./nixvim-header-end.5} \
|
||||
>$out/nixvim-header.5
|
||||
'';
|
||||
# FIXME add platform specific docs to manpage
|
||||
manHeader =
|
||||
let
|
||||
mkMDSection = file: "<(pandoc --lua-filter <(echo \"$manualFilter\") -f gfm -t man ${file})";
|
||||
in
|
||||
runCommand "nixvim-general-doc-manpage"
|
||||
{
|
||||
nativeBuildInputs = [ pandoc ];
|
||||
inherit manualFilter;
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
cat \
|
||||
${./nixvim-header-start.5} \
|
||||
${mkMDSection ../user-guide/helpers.md} \
|
||||
${mkMDSection ../user-guide/faq.md} \
|
||||
${./nixvim-header-end.5} \
|
||||
>$out/nixvim-header.5
|
||||
'';
|
||||
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"
|
||||
|
@ -31,215 +35,199 @@ with lib; let
|
|||
"content"
|
||||
];
|
||||
|
||||
removeWhitespace = builtins.replaceStrings [" "] [""];
|
||||
removeWhitespace = builtins.replaceStrings [ " " ] [ "" ];
|
||||
|
||||
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) == {};
|
||||
in
|
||||
hasEmptyIndex = (filterFunc opts.index.options) == { };
|
||||
hasEmptyComponents = (filterFunc opts.components) == { };
|
||||
in
|
||||
!hasEmptyIndex || !hasEmptyComponents;
|
||||
|
||||
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
|
||||
info = lib.getAttrFromPath path nixvimInfo;
|
||||
maintainers = lib.unique (options.config.meta.maintainers.${info.file} or []);
|
||||
maintainersNames = builtins.map (m: m.name) maintainers;
|
||||
in
|
||||
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;
|
||||
in
|
||||
"# ${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 != {};
|
||||
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
|
||||
subOpts = getSubOptions opts (path ++ [name]);
|
||||
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 ]) (
|
||||
(recurse (path ++ [ name ]) subOpts)
|
||||
// {
|
||||
# This is necessary to include the submodule option's definition in the docs (description, type, etc.)
|
||||
# For instance, this helps submodules like "autoCmd" to include their base definitions and examples in the docs
|
||||
# Though there might be a better, less "hacky" solution than this.
|
||||
${name} = recursiveUpdate opts {
|
||||
isOption = true;
|
||||
type.getSubOptions = _: _: { }; # Used to exclude suboptions from the submodule definition itself
|
||||
};
|
||||
}
|
||||
) false
|
||||
else
|
||||
wrapModule (path ++ [ name ]) opts true;
|
||||
in
|
||||
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.)
|
||||
# For instance, this helps submodules like "autoCmd" to include their base definitions and examples in the docs
|
||||
# Though there might be a better, less "hacky" solution than this.
|
||||
${name} = recursiveUpdate opts {
|
||||
isOption = true;
|
||||
type.getSubOptions = _: _: {}; # Used to exclude suboptions from the submodule definition itself
|
||||
};
|
||||
}
|
||||
)
|
||||
false
|
||||
else wrapModule (path ++ [name]) opts true;
|
||||
mapAttrs g mods;
|
||||
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 = {};
|
||||
options = { };
|
||||
path = removeWhitespace "${group}";
|
||||
moduleDoc = null;
|
||||
};
|
||||
components = {};
|
||||
components = { };
|
||||
isGroup = true;
|
||||
hasComponents = false;
|
||||
};
|
||||
|
||||
isOpt = !opts.hasComponents && (isOption opts.index.options);
|
||||
in
|
||||
acc
|
||||
// {
|
||||
${group} = recursiveUpdate last {
|
||||
index.options = optionalAttrs isOpt {
|
||||
${name} = opts.index.options;
|
||||
};
|
||||
acc
|
||||
// {
|
||||
${group} = recursiveUpdate last {
|
||||
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]
|
||||
)
|
||||
);
|
||||
hasComponents = true;
|
||||
};
|
||||
components = optionalAttrs (!isOpt) {
|
||||
${name} = recursiveUpdate opts {
|
||||
index.path = removeWhitespace (
|
||||
concatStringsSep "/" ((optional (group != "none") group) ++ [ opts.index.path ])
|
||||
);
|
||||
hasComponents = true;
|
||||
};
|
||||
|
||||
hasComponents = last.components != {};
|
||||
};
|
||||
}
|
||||
)
|
||||
{}
|
||||
(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;
|
||||
hasComponents = last.components != { };
|
||||
};
|
||||
}
|
||||
) { } (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;
|
||||
in
|
||||
concatStringsSep "\n" (mapAttrsToList g mods);
|
||||
in
|
||||
concatStringsSep "\n" (mapAttrsToList g mods);
|
||||
in
|
||||
recurse modules;
|
||||
|
||||
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";
|
||||
in
|
||||
(optionalString isBranch
|
||||
"mkdir -p ${opts.index.path}\n")
|
||||
+ (
|
||||
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.
|
||||
''
|
||||
{
|
||||
cat ${pkgs.writeText "module-doc" opts.index.moduleDoc}
|
||||
cat ${mkMDDoc opts.index.options}
|
||||
} > ${path}
|
||||
''
|
||||
)
|
||||
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")
|
||||
+ (
|
||||
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.
|
||||
''
|
||||
{
|
||||
cat ${pkgs.writeText "module-doc" opts.index.moduleDoc}
|
||||
cat ${mkMDDoc opts.index.options}
|
||||
} > ${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 "";
|
||||
path =
|
||||
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;
|
||||
indentLevel = with builtins; length (filter isString (split "/" opts.index.path)) - 1;
|
||||
|
||||
padding = concatStrings (builtins.genList (_: "\t") indentLevel);
|
||||
in "${padding}- [${name}](${path})"
|
||||
)
|
||||
docs.modules;
|
||||
padding = concatStrings (builtins.genList (_: "\t") indentLevel);
|
||||
in
|
||||
"${padding}- [${name}](${path})"
|
||||
) docs.modules;
|
||||
};
|
||||
|
||||
prepareMD = ''
|
||||
|
@ -262,19 +250,23 @@ with lib; let
|
|||
--replace-fail "@HM_OPTIONS@" "$(cat ${mkMDDoc hmOptions})"
|
||||
'';
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "nixvim-docs";
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "nixvim-docs";
|
||||
|
||||
phases = ["buildPhase"];
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
buildInputs = [pkgs.mdbook];
|
||||
inputs = sourceFilesBySuffices ./. [".md" ".toml" ".js"];
|
||||
buildInputs = [ pkgs.mdbook ];
|
||||
inputs = sourceFilesBySuffices ./. [
|
||||
".md"
|
||||
".toml"
|
||||
".js"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
dest=$out/share/doc
|
||||
mkdir -p $dest
|
||||
${prepareMD}
|
||||
mdbook build
|
||||
cp -r ./book/* $dest
|
||||
'';
|
||||
}
|
||||
buildPhase = ''
|
||||
dest=$out/share/doc
|
||||
mkdir -p $dest
|
||||
${prepareMD}
|
||||
mdbook build
|
||||
cp -r ./book/* $dest
|
||||
'';
|
||||
}
|
||||
|
|
17
example.nix
17
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"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -80,6 +89,6 @@
|
|||
|
||||
# What about plugins not available as a module?
|
||||
# Use extraPlugins:
|
||||
extraPlugins = with pkgs.vimPlugins; [vim-toml];
|
||||
extraPlugins = with pkgs.vimPlugins; [ vim-toml ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{inputs, ...}: {
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./dev
|
||||
./helpers.nix
|
||||
|
@ -12,16 +13,14 @@
|
|||
./wrappers.nix
|
||||
];
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
_module.args = {
|
||||
pkgsUnfree = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
perSystem =
|
||||
{ pkgs, system, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
pkgsUnfree = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
{ inputs, ... }: {
|
||||
imports = [ inputs.pre-commit-hooks.flakeModule ./devshell.nix ];
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
./devshell.nix
|
||||
];
|
||||
|
||||
perSystem = { pkgs, ... }: {
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
|
||||
pre-commit = {
|
||||
settings.hooks = {
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
enable = true;
|
||||
pre-commit = {
|
||||
settings.hooks = {
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
enable = true;
|
||||
};
|
||||
statix = {
|
||||
enable = true;
|
||||
excludes = [ "plugins/lsp/language-servers/rust-analyzer-config.nix" ];
|
||||
};
|
||||
typos.enable = true;
|
||||
};
|
||||
statix = {
|
||||
enable = true;
|
||||
excludes =
|
||||
[ "plugins/lsp/language-servers/rust-analyzer-config.nix" ];
|
||||
};
|
||||
typos.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,66 +1,69 @@
|
|||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
];
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.devshell.flakeModule ];
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
devshells.default = {
|
||||
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
{
|
||||
devshells.default = {
|
||||
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
|
||||
|
||||
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 [
|
||||
{
|
||||
name = "checks";
|
||||
help = "Run all nixvim checks";
|
||||
command = "nix flake check";
|
||||
}
|
||||
{
|
||||
name = "tests";
|
||||
help = "Run nixvim tests";
|
||||
command = ''
|
||||
echo "=> Running nixvim tests for the '${system}' architecture..."
|
||||
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
|
||||
[
|
||||
{
|
||||
name = "checks";
|
||||
help = "Run all nixvim checks";
|
||||
command = "nix flake check";
|
||||
}
|
||||
{
|
||||
name = "tests";
|
||||
help = "Run nixvim tests";
|
||||
command = ''
|
||||
echo "=> Running nixvim tests for the '${system}' architecture..."
|
||||
|
||||
${nix} build .#checks.${system}.tests "$@"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "format";
|
||||
help = "Format the entire codebase";
|
||||
command = "nix fmt";
|
||||
}
|
||||
{
|
||||
name = "docs";
|
||||
help = "Build nixvim documentation";
|
||||
command = ''
|
||||
echo "=> Building nixvim documentation..."
|
||||
${nix} build .#checks.${system}.tests "$@"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "format";
|
||||
help = "Format the entire codebase";
|
||||
command = "nix fmt";
|
||||
}
|
||||
{
|
||||
name = "docs";
|
||||
help = "Build nixvim documentation";
|
||||
command = ''
|
||||
echo "=> Building nixvim documentation..."
|
||||
|
||||
${nix} build .#docs "$@"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "serve-docs";
|
||||
help = "Build and serve documentation locally";
|
||||
command = ''
|
||||
echo -e "=> Building nixvim documentation...\n"
|
||||
${nix} build .#docs "$@"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "serve-docs";
|
||||
help = "Build and serve documentation locally";
|
||||
command = ''
|
||||
echo -e "=> Building nixvim documentation...\n"
|
||||
|
||||
doc_derivation=$(${nix} build .#docs --no-link --print-out-paths)
|
||||
doc_derivation=$(${nix} build .#docs --no-link --print-out-paths)
|
||||
|
||||
echo -e "\n=> Documentation successfully built ('$doc_derivation')"
|
||||
echo -e "\n=> Documentation successfully built ('$doc_derivation')"
|
||||
|
||||
port=8000
|
||||
echo -e "\n=> Now open your browser and navigate to 'localhost:$port'\n"
|
||||
port=8000
|
||||
echo -e "\n=> Now open your browser and navigate to 'localhost:$port'\n"
|
||||
|
||||
${pkgs.lib.getExe pkgs.python3} -m http.server -d "$doc_derivation"/share/doc
|
||||
'';
|
||||
}
|
||||
];
|
||||
${pkgs.lib.getExe pkgs.python3} -m http.server -d "$doc_derivation"/share/doc
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
...
|
||||
}: {
|
||||
_module.args.helpers = getHelpers pkgs false;
|
||||
};
|
||||
perSystem =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
_module.args.helpers = getHelpers pkgs false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
{
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}: {
|
||||
legacyPackages = rec {
|
||||
inherit makeNixvimWithModule;
|
||||
makeNixvim = configuration:
|
||||
makeNixvimWithModule {
|
||||
module = {
|
||||
config = configuration;
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}:
|
||||
{
|
||||
legacyPackages = rec {
|
||||
inherit makeNixvimWithModule;
|
||||
makeNixvim =
|
||||
configuration:
|
||||
makeNixvimWithModule {
|
||||
module = {
|
||||
config = configuration;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,18 +3,15 @@
|
|||
lib,
|
||||
withSystem,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
flake.lib = lib.genAttrs config.systems (
|
||||
lib.flip withSystem (
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
import ../lib {
|
||||
inherit pkgs lib;
|
||||
inherit (config.legacyPackages) makeNixvim makeNixvimWithModule;
|
||||
}
|
||||
{ pkgs, config, ... }:
|
||||
import ../lib {
|
||||
inherit pkgs lib;
|
||||
inherit (config.legacyPackages) makeNixvim makeNixvimWithModule;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,37 +1,41 @@
|
|||
{modules, ...}: {
|
||||
{ modules, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
modules = pkgs: let
|
||||
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix";
|
||||
modules =
|
||||
pkgs:
|
||||
let
|
||||
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix";
|
||||
|
||||
nixvimExtraArgsModule = rec {
|
||||
_file = ./flake.nix;
|
||||
key = _file;
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs = pkgs.lib.mkForce pkgs;
|
||||
inherit (pkgs) lib;
|
||||
nixvimExtraArgsModule = rec {
|
||||
_file = ./flake.nix;
|
||||
key = _file;
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs = pkgs.lib.mkForce pkgs;
|
||||
inherit (pkgs) lib;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in [
|
||||
../modules
|
||||
nixpkgsMaintainersList
|
||||
nixvimExtraArgsModule
|
||||
({lib, ...}:
|
||||
with lib; {
|
||||
# Attribute may contain the following fields:
|
||||
# - name: Name of the module
|
||||
# - kind: Either colorschemes or plugins
|
||||
# - description: A short description of the plugin
|
||||
# - url: Url for the plugin
|
||||
#
|
||||
# [kind name] will identify the plugin
|
||||
#
|
||||
# We need to use an attrs instead of a submodule to handle the merge.
|
||||
options.meta.nixvimInfo = mkOption {
|
||||
type =
|
||||
(types.nullOr types.attrs)
|
||||
// {
|
||||
in
|
||||
[
|
||||
../modules
|
||||
nixpkgsMaintainersList
|
||||
nixvimExtraArgsModule
|
||||
(
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
# Attribute may contain the following fields:
|
||||
# - name: Name of the module
|
||||
# - kind: Either colorschemes or plugins
|
||||
# - description: A short description of the plugin
|
||||
# - url: Url for the plugin
|
||||
#
|
||||
# [kind name] will identify the plugin
|
||||
#
|
||||
# We need to use an attrs instead of a submodule to handle the merge.
|
||||
options.meta.nixvimInfo = mkOption {
|
||||
type = (types.nullOr types.attrs) // {
|
||||
# This will create an attrset of the form:
|
||||
# {
|
||||
# "path"."to"."plugin" = { "<name>" = <info>; };
|
||||
|
@ -43,37 +47,41 @@
|
|||
# description = null or "<DESCRIPTION>";
|
||||
# url = null or "<URL>";
|
||||
# }
|
||||
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 = {};
|
||||
}
|
||||
defs;
|
||||
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 = { };
|
||||
}
|
||||
defs;
|
||||
};
|
||||
internal = true;
|
||||
default = null;
|
||||
description = ''
|
||||
Nixvim related information on the module
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
internal = true;
|
||||
default = null;
|
||||
description = ''
|
||||
Nixvim related information on the module
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
_module.args = {
|
||||
modules = modules pkgs;
|
||||
rawModules = modules;
|
||||
perSystem =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
modules = modules pkgs;
|
||||
rawModules = modules;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.easyOverlay
|
||||
];
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
final,
|
||||
...
|
||||
}: {
|
||||
overlayAttrs = {
|
||||
nixvim = {
|
||||
inherit
|
||||
(config.legacyPackages)
|
||||
makeNixvim
|
||||
makeNixvimWithModule
|
||||
;
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
|
||||
perSystem =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
final,
|
||||
...
|
||||
}:
|
||||
{
|
||||
overlayAttrs = {
|
||||
nixvim = {
|
||||
inherit (config.legacyPackages) makeNixvim makeNixvimWithModule;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
rawModules,
|
||||
helpers,
|
||||
...
|
||||
}: {
|
||||
packages = import ../docs {
|
||||
inherit rawModules pkgs helpers;
|
||||
};
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
rawModules,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
{
|
||||
packages = import ../docs { inherit rawModules pkgs helpers; };
|
||||
|
||||
# Test that all packages build fine when running `nix flake check`.
|
||||
checks = config.packages;
|
||||
};
|
||||
# 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,49 +9,48 @@
|
|||
|
||||
# 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 = {
|
||||
pkgs,
|
||||
system,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
checks = let
|
||||
# Approximates https://github.com/NixOS/nix/blob/7cd08ae379746749506f2e33c3baeb49b58299b8/src/libexpr/flake/call-flake.nix#L46
|
||||
# s/flake.outputs/args.outputs/
|
||||
callFlake = args @ {
|
||||
inputs,
|
||||
outputs,
|
||||
sourceInfo,
|
||||
}: let
|
||||
outputs = args.outputs (inputs // {self = result;});
|
||||
result =
|
||||
outputs
|
||||
// sourceInfo
|
||||
// {
|
||||
inherit inputs outputs sourceInfo;
|
||||
_type = "flake";
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
# Approximates https://github.com/NixOS/nix/blob/7cd08ae379746749506f2e33c3baeb49b58299b8/src/libexpr/flake/call-flake.nix#L46
|
||||
# s/flake.outputs/args.outputs/
|
||||
callFlake =
|
||||
args@{
|
||||
inputs,
|
||||
outputs,
|
||||
sourceInfo,
|
||||
}:
|
||||
let
|
||||
outputs = args.outputs (inputs // { self = result; });
|
||||
result =
|
||||
outputs
|
||||
// sourceInfo
|
||||
// {
|
||||
inherit inputs outputs sourceInfo;
|
||||
_type = "flake";
|
||||
};
|
||||
in
|
||||
result;
|
||||
|
||||
templateFlakeOutputs = callFlake {
|
||||
inputs = {
|
||||
inherit (inputs) flake-parts nixpkgs;
|
||||
nixvim = self;
|
||||
};
|
||||
# Import and read the `outputs` field of the template flake.
|
||||
inherit (import ../templates/simple/flake.nix) outputs;
|
||||
sourceInfo = { };
|
||||
};
|
||||
in
|
||||
result;
|
||||
|
||||
templateFlakeOutputs = callFlake {
|
||||
inputs = {
|
||||
inherit (inputs) flake-parts nixpkgs;
|
||||
nixvim = self;
|
||||
};
|
||||
# Import and read the `outputs` field of the template flake.
|
||||
inherit (import ../templates/simple/flake.nix) outputs;
|
||||
sourceInfo = {};
|
||||
};
|
||||
|
||||
templateChecks = templateFlakeOutputs.checks.${system};
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(
|
||||
checkName: check: {
|
||||
"template-${checkName}" = check;
|
||||
}
|
||||
)
|
||||
templateChecks;
|
||||
};
|
||||
templateChecks = templateFlakeOutputs.checks.${system};
|
||||
in
|
||||
lib.concatMapAttrs (checkName: check: { "template-${checkName}" = check; }) templateChecks;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,49 +1,51 @@
|
|||
{self, ...}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
helpers,
|
||||
makeNixvimWithModuleUnfree,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}: {
|
||||
checks = {
|
||||
tests = import ../tests {
|
||||
inherit pkgs helpers makeNixvimWithModule;
|
||||
inherit (pkgs) lib;
|
||||
makeNixvim = configuration:
|
||||
makeNixvimWithModuleUnfree {
|
||||
module = {
|
||||
config = configuration;
|
||||
{ self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
helpers,
|
||||
makeNixvimWithModuleUnfree,
|
||||
makeNixvimWithModule,
|
||||
...
|
||||
}:
|
||||
{
|
||||
checks = {
|
||||
tests = import ../tests {
|
||||
inherit pkgs helpers makeNixvimWithModule;
|
||||
inherit (pkgs) lib;
|
||||
makeNixvim =
|
||||
configuration:
|
||||
makeNixvimWithModuleUnfree {
|
||||
module = {
|
||||
config = configuration;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extra-args-tests = import ../tests/extra-args.nix {
|
||||
inherit pkgs;
|
||||
inherit makeNixvimWithModule;
|
||||
};
|
||||
extra-args-tests = import ../tests/extra-args.nix {
|
||||
inherit pkgs;
|
||||
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;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
||||
};
|
||||
enable-except-in-tests = import ../tests/enable-except-in-tests.nix {
|
||||
inherit pkgs makeNixvimWithModule;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
||||
};
|
||||
|
||||
no-flake = import ../tests/no-flake.nix {
|
||||
inherit system;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNvim;
|
||||
nixvim = "${self}";
|
||||
};
|
||||
no-flake = import ../tests/no-flake.nix {
|
||||
inherit system;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNvim;
|
||||
nixvim = "${self}";
|
||||
};
|
||||
|
||||
lib-tests = import ../tests/lib-tests.nix {
|
||||
inherit pkgs helpers;
|
||||
inherit (pkgs) lib;
|
||||
lib-tests = import ../tests/lib-tests.nix {
|
||||
inherit pkgs helpers;
|
||||
inherit (pkgs) lib;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,64 +4,56 @@
|
|||
getHelpers,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
wrapperArgs = {
|
||||
inherit modules;
|
||||
inherit self;
|
||||
inherit getHelpers;
|
||||
};
|
||||
in {
|
||||
perSystem = {
|
||||
system,
|
||||
pkgs,
|
||||
pkgsUnfree,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
_module.args = {
|
||||
makeNixvimWithModule =
|
||||
import ../wrappers/standalone.nix
|
||||
pkgs
|
||||
wrapperArgs;
|
||||
in
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
system,
|
||||
pkgs,
|
||||
pkgsUnfree,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
_module.args = {
|
||||
makeNixvimWithModule = import ../wrappers/standalone.nix pkgs wrapperArgs;
|
||||
|
||||
makeNixvimWithModuleUnfree =
|
||||
import ../wrappers/standalone.nix
|
||||
pkgsUnfree
|
||||
wrapperArgs;
|
||||
};
|
||||
|
||||
checks =
|
||||
{
|
||||
home-manager-module =
|
||||
(import ../tests/modules/hm.nix {
|
||||
inherit pkgs;
|
||||
inherit (inputs) home-manager;
|
||||
nixvim = self;
|
||||
})
|
||||
.activationPackage;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
|
||||
nixos-module =
|
||||
(import ../tests/modules/nixos.nix {
|
||||
inherit system;
|
||||
inherit (inputs) nixpkgs;
|
||||
nixvim = self;
|
||||
})
|
||||
.config
|
||||
.system
|
||||
.build
|
||||
.toplevel;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
darwin-module =
|
||||
(import ../tests/modules/darwin.nix {
|
||||
inherit system;
|
||||
inherit (inputs) nix-darwin;
|
||||
nixvim = self;
|
||||
})
|
||||
.system;
|
||||
makeNixvimWithModuleUnfree = import ../wrappers/standalone.nix pkgsUnfree wrapperArgs;
|
||||
};
|
||||
};
|
||||
|
||||
checks =
|
||||
{
|
||||
home-manager-module =
|
||||
(import ../tests/modules/hm.nix {
|
||||
inherit pkgs;
|
||||
inherit (inputs) home-manager;
|
||||
nixvim = self;
|
||||
}).activationPackage;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
|
||||
nixos-module =
|
||||
(import ../tests/modules/nixos.nix {
|
||||
inherit system;
|
||||
inherit (inputs) nixpkgs;
|
||||
nixvim = self;
|
||||
}).config.system.build.toplevel;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
darwin-module =
|
||||
(import ../tests/modules/darwin.nix {
|
||||
inherit system;
|
||||
inherit (inputs) nix-darwin;
|
||||
nixvim = self;
|
||||
}).system;
|
||||
};
|
||||
};
|
||||
|
||||
flake = {
|
||||
nixosModules.nixvim = import ../wrappers/nixos.nix wrapperArgs;
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
|
@ -39,6 +40,6 @@
|
|||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
imports = [./flake-modules];
|
||||
imports = [ ./flake-modules ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,23 +1,22 @@
|
|||
{ lib, pkgs }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
}: {
|
||||
/*
|
||||
Write a lua file to the nix store, formatted using stylua.
|
||||
Write a lua file to the nix store, formatted using stylua.
|
||||
|
||||
# Type
|
||||
# Type
|
||||
|
||||
```
|
||||
writeLua :: String -> String -> Derivation
|
||||
```
|
||||
```
|
||||
writeLua :: String -> String -> Derivation
|
||||
```
|
||||
|
||||
# Arguments
|
||||
# Arguments
|
||||
|
||||
- [name] The name of the derivation
|
||||
- [text] The content of the lua file
|
||||
- [name] The name of the derivation
|
||||
- [text] The content of the lua file
|
||||
*/
|
||||
writeLua = name: text:
|
||||
pkgs.runCommand name {inherit text;} ''
|
||||
writeLua =
|
||||
name: text:
|
||||
pkgs.runCommand name { inherit text; } ''
|
||||
echo -n "$text" > "$out"
|
||||
|
||||
${lib.getExe pkgs.stylua} \
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
pkgs,
|
||||
_nixvimTests ? false,
|
||||
...
|
||||
} @ args: {
|
||||
}@args:
|
||||
{
|
||||
# Add all exported modules here
|
||||
check = import ../tests/test-derivation.nix {
|
||||
inherit makeNixvim makeNixvimWithModule pkgs;
|
||||
};
|
||||
helpers = import ./helpers.nix (args // {inherit _nixvimTests;});
|
||||
check = import ../tests/test-derivation.nix { inherit makeNixvim makeNixvimWithModule pkgs; };
|
||||
helpers = import ./helpers.nix (args // { inherit _nixvimTests; });
|
||||
}
|
||||
|
|
|
@ -3,22 +3,30 @@
|
|||
pkgs,
|
||||
_nixvimTests,
|
||||
...
|
||||
}: let
|
||||
nixvimBuilders = import ./builders.nix {inherit lib pkgs;};
|
||||
nixvimTypes = import ./types.nix {inherit lib nixvimOptions;};
|
||||
nixvimUtils = import ./utils.nix {inherit lib _nixvimTests;};
|
||||
nixvimOptions = import ./options.nix {inherit lib nixvimTypes nixvimUtils;};
|
||||
inherit (import ./to-lua.nix {inherit lib;}) toLuaObject;
|
||||
}:
|
||||
let
|
||||
nixvimBuilders = import ./builders.nix { inherit lib pkgs; };
|
||||
nixvimTypes = import ./types.nix { inherit lib nixvimOptions; };
|
||||
nixvimUtils = import ./utils.nix { inherit lib _nixvimTests; };
|
||||
nixvimOptions = import ./options.nix { inherit lib nixvimTypes nixvimUtils; };
|
||||
inherit (import ./to-lua.nix { inherit lib; }) toLuaObject;
|
||||
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;};
|
||||
vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions nixvimUtils;};
|
||||
inherit nixvimTypes;
|
||||
inherit toLuaObject;
|
||||
}
|
||||
// nixvimUtils
|
||||
// nixvimOptions
|
||||
// nixvimBuilders
|
||||
{
|
||||
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
|
||||
;
|
||||
};
|
||||
vim-plugin = import ./vim-plugin.nix { inherit lib nixvimOptions nixvimUtils; };
|
||||
inherit nixvimTypes;
|
||||
inherit toLuaObject;
|
||||
}
|
||||
// nixvimUtils
|
||||
// nixvimOptions
|
||||
// nixvimBuilders
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -70,80 +55,75 @@ with lib; rec {
|
|||
|
||||
modeEnum =
|
||||
types.enum
|
||||
# ["" "n" "v" ...]
|
||||
(
|
||||
map
|
||||
(
|
||||
{short, ...}: short
|
||||
)
|
||||
(attrValues modes)
|
||||
);
|
||||
# ["" "n" "v" ...]
|
||||
(map ({ short, ... }: short) (attrValues modes));
|
||||
|
||||
mapOptionSubmodule = mkMapOptionSubmodule {};
|
||||
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;
|
||||
submodule {
|
||||
options = {
|
||||
key = mkOption ({
|
||||
type = str;
|
||||
description = "The key to map.";
|
||||
example = "<C-m>";
|
||||
}
|
||||
// (
|
||||
optionalAttrs
|
||||
(defaults ? key)
|
||||
{default = defaults.key;}
|
||||
));
|
||||
mkMapOptionSubmodule =
|
||||
defaults:
|
||||
(
|
||||
with types;
|
||||
submodule {
|
||||
options = {
|
||||
key = mkOption (
|
||||
{
|
||||
type = str;
|
||||
description = "The key to map.";
|
||||
example = "<C-m>";
|
||||
}
|
||||
// (optionalAttrs (defaults ? key) { default = defaults.key; })
|
||||
);
|
||||
|
||||
mode = mkModeOption defaults.mode or "";
|
||||
mode = mkModeOption defaults.mode or "";
|
||||
|
||||
action = mkOption ({
|
||||
type = nixvimTypes.maybeRaw str;
|
||||
description = "The action to execute.";
|
||||
}
|
||||
// (
|
||||
optionalAttrs
|
||||
(defaults ? action)
|
||||
{default = defaults.action;}
|
||||
));
|
||||
action = mkOption (
|
||||
{
|
||||
type = nixvimTypes.maybeRaw str;
|
||||
description = "The action to execute.";
|
||||
}
|
||||
// (optionalAttrs (defaults ? action) { default = defaults.action; })
|
||||
);
|
||||
|
||||
lua = mkOption {
|
||||
type = bool;
|
||||
description = ''
|
||||
If true, `action` is considered to be lua code.
|
||||
Thus, it will not be wrapped in `""`.
|
||||
'';
|
||||
default = defaults.lua or false;
|
||||
lua = mkOption {
|
||||
type = bool;
|
||||
description = ''
|
||||
If true, `action` is considered to be lua code.
|
||||
Thus, it will not be wrapped in `""`.
|
||||
'';
|
||||
default = defaults.lua or false;
|
||||
};
|
||||
|
||||
options = mapConfigOptions;
|
||||
};
|
||||
|
||||
options = mapConfigOptions;
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
# Correctly merge two attrs (partially) representing a mapping.
|
||||
mergeKeymap = defaults: keymap: let
|
||||
# First, merge the `options` attrs of both options.
|
||||
mergedOpts = (defaults.options or {}) // (keymap.options or {});
|
||||
in
|
||||
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;};
|
||||
(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,24 +4,25 @@
|
|||
toLuaObject,
|
||||
nixvimUtils,
|
||||
}:
|
||||
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`.",
|
||||
example ? null,
|
||||
}:
|
||||
nixvimOptions.mkSettingsOption {
|
||||
inherit options description example;
|
||||
};
|
||||
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`.",
|
||||
example ? null,
|
||||
}:
|
||||
nixvimOptions.mkSettingsOption { inherit options description example; };
|
||||
|
||||
# TODO: DEPRECATED: use the `settings` option instead
|
||||
extraOptionsOptions = {
|
||||
extraOptions = mkOption {
|
||||
default = {};
|
||||
default = { };
|
||||
type = with types; attrsOf anything;
|
||||
description = ''
|
||||
These attributes will be added to the table parameter for the setup function.
|
||||
|
@ -30,82 +31,68 @@ with lib; rec {
|
|||
};
|
||||
};
|
||||
|
||||
mkNeovimPlugin = config: {
|
||||
name,
|
||||
maintainers,
|
||||
url ? defaultPackage.meta.homepage,
|
||||
imports ? [],
|
||||
description ? null,
|
||||
# deprecations
|
||||
deprecateExtraOptions ? false,
|
||||
optionsRenamedToSettings ? [],
|
||||
# colorscheme
|
||||
isColorscheme ? false,
|
||||
colorscheme ? name,
|
||||
# options
|
||||
originalName ? name,
|
||||
defaultPackage,
|
||||
settingsOptions ? {},
|
||||
settingsExample ? null,
|
||||
extraOptions ? {},
|
||||
# config
|
||||
luaName ? name,
|
||||
extraConfig ? cfg: {},
|
||||
extraPlugins ? [],
|
||||
extraPackages ? [],
|
||||
callSetup ? true,
|
||||
}: let
|
||||
namespace =
|
||||
if isColorscheme
|
||||
then "colorschemes"
|
||||
else "plugins";
|
||||
in {
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit
|
||||
description
|
||||
name
|
||||
url
|
||||
;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
|
||||
imports = let
|
||||
basePluginPath = [namespace name];
|
||||
settingsPath = basePluginPath ++ ["settings"];
|
||||
mkNeovimPlugin =
|
||||
config:
|
||||
{
|
||||
name,
|
||||
maintainers,
|
||||
url ? defaultPackage.meta.homepage,
|
||||
imports ? [ ],
|
||||
description ? null,
|
||||
# deprecations
|
||||
deprecateExtraOptions ? false,
|
||||
optionsRenamedToSettings ? [ ],
|
||||
# colorscheme
|
||||
isColorscheme ? false,
|
||||
colorscheme ? name,
|
||||
# options
|
||||
originalName ? name,
|
||||
defaultPackage,
|
||||
settingsOptions ? { },
|
||||
settingsExample ? null,
|
||||
extraOptions ? { },
|
||||
# config
|
||||
luaName ? name,
|
||||
extraConfig ? cfg: { },
|
||||
extraPlugins ? [ ],
|
||||
extraPackages ? [ ],
|
||||
callSetup ? true,
|
||||
}:
|
||||
let
|
||||
namespace = if isColorscheme then "colorschemes" else "plugins";
|
||||
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)
|
||||
{
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit description name url;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
|
||||
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)
|
||||
|
||||
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,31 +102,24 @@ with lib; rec {
|
|||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
};
|
||||
}
|
||||
// extraOptions;
|
||||
} // extraOptions;
|
||||
|
||||
config = let
|
||||
cfg = config.${namespace}.${name};
|
||||
extraConfigNamespace =
|
||||
if isColorscheme
|
||||
then "extraConfigLuaPre"
|
||||
else "extraConfigLua";
|
||||
in
|
||||
mkIf cfg.enable (
|
||||
mkMerge [
|
||||
config =
|
||||
let
|
||||
cfg = config.${namespace}.${name};
|
||||
extraConfigNamespace = if isColorscheme then "extraConfigLuaPre" else "extraConfigLua";
|
||||
in
|
||||
mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
extraPlugins = [cfg.package] ++ extraPlugins;
|
||||
extraPlugins = [ cfg.package ] ++ extraPlugins;
|
||||
inherit extraPackages;
|
||||
|
||||
${extraConfigNamespace} = optionalString callSetup ''
|
||||
require('${luaName}').setup(${toLuaObject cfg.settings})
|
||||
'';
|
||||
}
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) {
|
||||
inherit colorscheme;
|
||||
})
|
||||
(optionalAttrs (isColorscheme && (colorscheme != null)) { inherit colorscheme; })
|
||||
(extraConfig cfg)
|
||||
]
|
||||
);
|
||||
};
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
320
lib/options.nix
320
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
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
mkStrLuaOr =
|
||||
type: default: desc:
|
||||
mkNullOrStrLuaOr type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'');
|
||||
${defaultDesc}
|
||||
''
|
||||
);
|
||||
|
||||
mkStrLuaFnOr = type: default: desc:
|
||||
mkNullOrStrLuaFnOr type (let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
mkStrLuaFnOr =
|
||||
type: default: desc:
|
||||
mkNullOrStrLuaFnOr type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'');
|
||||
${defaultDesc}
|
||||
''
|
||||
);
|
||||
|
||||
mkLua = default: desc:
|
||||
mkNullOrLua
|
||||
(
|
||||
mkLua =
|
||||
default: desc:
|
||||
mkNullOrLua (
|
||||
(optionalString (desc != "") ''
|
||||
${desc}
|
||||
|
||||
|
@ -109,18 +118,20 @@ with nixvimUtils; rec {
|
|||
''
|
||||
);
|
||||
|
||||
mkLuaFn = default: desc: let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
mkNullOrLuaFn
|
||||
(
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
mkLuaFn =
|
||||
default: desc:
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
mkNullOrLuaFn (
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
''
|
||||
${defaultDesc}
|
||||
''
|
||||
);
|
||||
|
||||
mkNum = default: mkNullable (with nixvimTypes; maybeRaw number) (toString default);
|
||||
|
@ -129,137 +140,124 @@ 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
|
||||
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 ''
|
||||
${desc}
|
||||
${defaultDesc}
|
||||
'');
|
||||
mkSeverity = default: desc:
|
||||
mkOption {
|
||||
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}"
|
||||
);
|
||||
description = let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
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.
|
||||
'';
|
||||
};
|
||||
mkLogLevel = default: desc:
|
||||
mkOption {
|
||||
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}"
|
||||
);
|
||||
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
|
||||
''
|
||||
);
|
||||
mkSeverity =
|
||||
default: desc:
|
||||
mkOption {
|
||||
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}"
|
||||
);
|
||||
description =
|
||||
let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
mkLogLevel =
|
||||
default: desc:
|
||||
mkOption {
|
||||
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}"
|
||||
);
|
||||
description =
|
||||
let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == "" then
|
||||
defaultDesc
|
||||
else
|
||||
''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
|
||||
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 = {
|
||||
options ? {},
|
||||
description,
|
||||
example ? null,
|
||||
}:
|
||||
mkSettingsOption =
|
||||
{
|
||||
options ? { },
|
||||
description,
|
||||
example ? null,
|
||||
}:
|
||||
mkOption {
|
||||
type = with types;
|
||||
type =
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
inherit options;
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
inherit description;
|
||||
example =
|
||||
if example == null
|
||||
then {
|
||||
foo_bar = 42;
|
||||
hostname = "localhost:8080";
|
||||
callback.__raw = ''
|
||||
function()
|
||||
print('nixvim')
|
||||
end
|
||||
'';
|
||||
}
|
||||
else example;
|
||||
if example == null then
|
||||
{
|
||||
foo_bar = 42;
|
||||
hostname = "localhost:8080";
|
||||
callback.__raw = ''
|
||||
function()
|
||||
print('nixvim')
|
||||
end
|
||||
'';
|
||||
}
|
||||
else
|
||||
example;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,46 +1,44 @@
|
|||
{lib}:
|
||||
with lib; rec {
|
||||
{ lib }:
|
||||
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
|
||||
(
|
||||
n: v:
|
||||
v != null && (toLuaObject v != "{}")
|
||||
)
|
||||
args)))
|
||||
+ (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 (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
|
||||
"";
|
||||
}
|
||||
|
|
139
lib/types.nix
139
lib/types.nix
|
@ -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;
|
||||
|
@ -15,68 +13,73 @@ with lib.types; let
|
|||
merge = lib.options.mergeEqualOption;
|
||||
};
|
||||
in
|
||||
rec {
|
||||
isRawType = v: lib.isAttrs v && lib.hasAttr "__raw" v && lib.isString v.__raw;
|
||||
rec {
|
||||
isRawType = v: lib.isAttrs v && lib.hasAttr "__raw" v && lib.isString v.__raw;
|
||||
|
||||
rawLua = mkOptionType {
|
||||
name = "rawLua";
|
||||
description = "raw lua code";
|
||||
descriptionClass = "noun";
|
||||
merge = mergeEqualOption;
|
||||
check = isRawType;
|
||||
rawLua = mkOptionType {
|
||||
name = "rawLua";
|
||||
description = "raw lua code";
|
||||
descriptionClass = "noun";
|
||||
merge = mergeEqualOption;
|
||||
check = isRawType;
|
||||
};
|
||||
|
||||
maybeRaw = type: types.either type rawLua;
|
||||
|
||||
border =
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
(listOf str)
|
||||
(listOf (listOf str))
|
||||
];
|
||||
|
||||
logLevel = types.enum [
|
||||
"off"
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"debug"
|
||||
"trace"
|
||||
];
|
||||
|
||||
highlight = types.submodule {
|
||||
# Adds flexibility for other keys
|
||||
freeformType = types.attrs;
|
||||
|
||||
# :help nvim_set_hl()
|
||||
options = with types; {
|
||||
fg = mkNullOrStr "Color for the foreground (color name or '#RRGGBB').";
|
||||
bg = mkNullOrStr "Color for the background (color name or '#RRGGBB').";
|
||||
sp = mkNullOrStr "Special color (color name or '#RRGGBB').";
|
||||
blend = mkNullOrOption (numbers.between 0 100) "Integer between 0 and 100.";
|
||||
bold = mkNullOrOption bool "";
|
||||
standout = mkNullOrOption bool "";
|
||||
underline = mkNullOrOption bool "";
|
||||
undercurl = mkNullOrOption bool "";
|
||||
underdouble = mkNullOrOption bool "";
|
||||
underdotted = mkNullOrOption bool "";
|
||||
underdashed = mkNullOrOption bool "";
|
||||
strikethrough = mkNullOrOption bool "";
|
||||
italic = mkNullOrOption bool "";
|
||||
reverse = mkNullOrOption bool "";
|
||||
nocombine = mkNullOrOption bool "";
|
||||
link = mkNullOrStr "Name of another highlight group to link to.";
|
||||
default = mkNullOrOption bool "Don't override existing definition.";
|
||||
ctermfg = mkNullOrStr "Sets foreground of cterm color.";
|
||||
ctermbg = mkNullOrStr "Sets background of cterm color.";
|
||||
cterm = mkNullOrOption (either str attrs) ''
|
||||
cterm attribute map, like |highlight-args|.
|
||||
If not set, cterm attributes will match those from the attribute map documented above.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
maybeRaw = type:
|
||||
types.either
|
||||
type
|
||||
rawLua;
|
||||
strLua = strLikeType "lua code string";
|
||||
strLuaFn = strLikeType "lua function string";
|
||||
|
||||
border = with types;
|
||||
oneOf [
|
||||
str
|
||||
(listOf str)
|
||||
(listOf (listOf str))
|
||||
];
|
||||
|
||||
logLevel = types.enum ["off" "error" "warn" "info" "debug" "trace"];
|
||||
|
||||
highlight = types.submodule {
|
||||
# Adds flexibility for other keys
|
||||
freeformType = types.attrs;
|
||||
|
||||
# :help nvim_set_hl()
|
||||
options = with types; {
|
||||
fg = mkNullOrStr "Color for the foreground (color name or '#RRGGBB').";
|
||||
bg = mkNullOrStr "Color for the background (color name or '#RRGGBB').";
|
||||
sp = mkNullOrStr "Special color (color name or '#RRGGBB').";
|
||||
blend = mkNullOrOption (numbers.between 0 100) "Integer between 0 and 100.";
|
||||
bold = mkNullOrOption bool "";
|
||||
standout = mkNullOrOption bool "";
|
||||
underline = mkNullOrOption bool "";
|
||||
undercurl = mkNullOrOption bool "";
|
||||
underdouble = mkNullOrOption bool "";
|
||||
underdotted = mkNullOrOption bool "";
|
||||
underdashed = mkNullOrOption bool "";
|
||||
strikethrough = mkNullOrOption bool "";
|
||||
italic = mkNullOrOption bool "";
|
||||
reverse = mkNullOrOption bool "";
|
||||
nocombine = mkNullOrOption bool "";
|
||||
link = mkNullOrStr "Name of another highlight group to link to.";
|
||||
default = mkNullOrOption bool "Don't override existing definition.";
|
||||
ctermfg = mkNullOrStr "Sets foreground of cterm color.";
|
||||
ctermbg = mkNullOrStr "Sets background of cterm color.";
|
||||
cterm = mkNullOrOption (either str attrs) ''
|
||||
cterm attribute map, like |highlight-args|.
|
||||
If not set, cterm attributes will match those from the attribute map documented above.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
strLua = strLikeType "lua code string";
|
||||
strLuaFn = strLikeType "lua function string";
|
||||
|
||||
# Overridden when building the documentation
|
||||
eitherRecursive = either;
|
||||
}
|
||||
# Allow to do `with nixvimTypes;` instead of `with types;`
|
||||
// lib.types
|
||||
# Overridden when building the documentation
|
||||
eitherRecursive = either;
|
||||
}
|
||||
# Allow to do `with nixvimTypes;` instead of `with types;`
|
||||
// lib.types
|
||||
|
|
|
@ -1,45 +1,38 @@
|
|||
{ 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
|
||||
Convert a string from camelCase to snake_case
|
||||
Type: string -> string
|
||||
*/
|
||||
toSnakeCase = let
|
||||
splitByWords = builtins.split "([A-Z])";
|
||||
processWord = s:
|
||||
if isString s
|
||||
then s
|
||||
else "_" + toLower (elemAt s 0);
|
||||
in
|
||||
string: let
|
||||
toSnakeCase =
|
||||
let
|
||||
splitByWords = builtins.split "([A-Z])";
|
||||
processWord = s: if isString s then s else "_" + toLower (elemAt s 0);
|
||||
in
|
||||
string:
|
||||
let
|
||||
words = splitByWords string;
|
||||
in
|
||||
concatStrings (map processWord words);
|
||||
concatStrings (map processWord words);
|
||||
|
||||
mkIfNonNull' = x: y: (mkIf (x != null) y);
|
||||
|
||||
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,56 +3,51 @@
|
|||
nixvimOptions,
|
||||
nixvimUtils,
|
||||
}:
|
||||
with lib; {
|
||||
mkVimPlugin = config: {
|
||||
name,
|
||||
url ?
|
||||
if defaultPackage != null
|
||||
then defaultPackage.meta.homepage
|
||||
else null,
|
||||
maintainers,
|
||||
imports ? [],
|
||||
description ? null,
|
||||
# deprecations
|
||||
deprecateExtraConfig ? false,
|
||||
optionsRenamedToSettings ? [],
|
||||
# colorscheme
|
||||
isColorscheme ? false,
|
||||
colorscheme ? name,
|
||||
# options
|
||||
originalName ? name,
|
||||
defaultPackage ? null,
|
||||
settingsOptions ? {},
|
||||
settingsExample ? null,
|
||||
globalPrefix ? "",
|
||||
extraOptions ? {},
|
||||
# config
|
||||
extraConfig ? cfg: {},
|
||||
extraPlugins ? [],
|
||||
extraPackages ? [],
|
||||
}: let
|
||||
namespace =
|
||||
if isColorscheme
|
||||
then "colorschemes"
|
||||
else "plugins";
|
||||
with lib;
|
||||
{
|
||||
mkVimPlugin =
|
||||
config:
|
||||
{
|
||||
name,
|
||||
url ? if defaultPackage != null then defaultPackage.meta.homepage else null,
|
||||
maintainers,
|
||||
imports ? [ ],
|
||||
description ? null,
|
||||
# deprecations
|
||||
deprecateExtraConfig ? false,
|
||||
optionsRenamedToSettings ? [ ],
|
||||
# colorscheme
|
||||
isColorscheme ? false,
|
||||
colorscheme ? name,
|
||||
# options
|
||||
originalName ? name,
|
||||
defaultPackage ? null,
|
||||
settingsOptions ? { },
|
||||
settingsExample ? null,
|
||||
globalPrefix ? "",
|
||||
extraOptions ? { },
|
||||
# config
|
||||
extraConfig ? cfg: { },
|
||||
extraPlugins ? [ ],
|
||||
extraPackages ? [ ],
|
||||
}:
|
||||
let
|
||||
namespace = if isColorscheme then "colorschemes" else "plugins";
|
||||
|
||||
cfg = config.${namespace}.${name};
|
||||
cfg = config.${namespace}.${name};
|
||||
|
||||
globals = cfg.settings or {};
|
||||
globals = cfg.settings or { };
|
||||
|
||||
# does this evaluate package?
|
||||
packageOption =
|
||||
if defaultPackage == null
|
||||
then {}
|
||||
else {
|
||||
package = nixvimOptions.mkPackageOption name defaultPackage;
|
||||
};
|
||||
# does this evaluate package?
|
||||
packageOption =
|
||||
if defaultPackage == null then
|
||||
{ }
|
||||
else
|
||||
{ package = nixvimOptions.mkPackageOption name defaultPackage; };
|
||||
|
||||
createSettingsOption = (isString globalPrefix) && (globalPrefix != "");
|
||||
createSettingsOption = (isString globalPrefix) && (globalPrefix != "");
|
||||
|
||||
settingsOption =
|
||||
optionalAttrs createSettingsOption
|
||||
{
|
||||
settingsOption = optionalAttrs createSettingsOption {
|
||||
settings = nixvimOptions.mkSettingsOption {
|
||||
options = settingsOptions;
|
||||
example = settingsExample;
|
||||
|
@ -68,73 +63,50 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit
|
||||
description
|
||||
name
|
||||
url
|
||||
;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
options.${namespace}.${name} =
|
||||
{
|
||||
enable = mkEnableOption originalName;
|
||||
}
|
||||
// settingsOption
|
||||
// packageOption
|
||||
// extraOptions;
|
||||
|
||||
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)
|
||||
{
|
||||
meta = {
|
||||
inherit maintainers;
|
||||
nixvimInfo = {
|
||||
inherit description name url;
|
||||
kind = namespace;
|
||||
};
|
||||
};
|
||||
options.${namespace}.${name} = {
|
||||
enable = mkEnableOption originalName;
|
||||
} // settingsOption // packageOption // extraOptions;
|
||||
|
||||
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)
|
||||
|
||||
optionPathSnakeCase = map nixvimUtils.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(settingsPath ++ optionPathSnakeCase)
|
||||
)
|
||||
optionsRenamedToSettings
|
||||
);
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
|
||||
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;
|
||||
})
|
||||
(extraConfig cfg)
|
||||
]
|
||||
);
|
||||
};
|
||||
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; })
|
||||
(extraConfig cfg)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
autoGroups = mkOption {
|
||||
type = types.attrsOf helpers.autocmd.autoGroupOption;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "augroup definitions";
|
||||
example = ''
|
||||
autoGroups = {
|
||||
|
@ -21,7 +22,7 @@ with lib; {
|
|||
|
||||
autoCmd = mkOption {
|
||||
type = types.listOf helpers.autocmd.autoCmdOption;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "autocmd definitions";
|
||||
example = ''
|
||||
autoCmd = [
|
||||
|
@ -35,18 +36,16 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
inherit (config) autoGroups autoCmd;
|
||||
in
|
||||
mkIf (autoGroups != {} || autoCmd != {}) {
|
||||
config =
|
||||
let
|
||||
inherit (config) autoGroups autoCmd;
|
||||
in
|
||||
mkIf (autoGroups != { } || autoCmd != { }) {
|
||||
# Introduced early October 2023.
|
||||
# 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.
|
||||
|
@ -55,7 +54,7 @@ with lib; {
|
|||
];
|
||||
|
||||
extraConfigLuaPost =
|
||||
(optionalString (autoGroups != {}) ''
|
||||
(optionalString (autoGroups != { }) ''
|
||||
-- Set up autogroups {{
|
||||
do
|
||||
local __nixvim_autogroups = ${helpers.toLuaObject autoGroups}
|
||||
|
@ -66,7 +65,7 @@ with lib; {
|
|||
end
|
||||
-- }}
|
||||
'')
|
||||
+ (optionalString (autoCmd != []) ''
|
||||
+ (optionalString (autoCmd != [ ]) ''
|
||||
-- Set up autocommands {{
|
||||
do
|
||||
local __nixvim_autocommands = ${helpers.toLuaObject autoCmd}
|
||||
|
|
|
@ -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,19 +25,17 @@ in {
|
|||
type = types.submodule {
|
||||
options =
|
||||
mapAttrs
|
||||
(
|
||||
name: packageName: {
|
||||
(name: packageName: {
|
||||
enable = mkEnableOption name;
|
||||
package = mkPackageOption pkgs packageName {};
|
||||
}
|
||||
)
|
||||
{
|
||||
wl-copy = "wl-clipboard";
|
||||
xclip = "xclip";
|
||||
xsel = "xsel";
|
||||
};
|
||||
package = mkPackageOption pkgs packageName { };
|
||||
})
|
||||
{
|
||||
wl-copy = "wl-clipboard";
|
||||
xclip = "xclip";
|
||||
xsel = "xsel";
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
description = ''
|
||||
Package(s) to use as the clipboard provider.
|
||||
Learn more at `:h clipboard`.
|
||||
|
@ -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,15 +13,34 @@ with lib; let
|
|||
description = "The command to run.";
|
||||
};
|
||||
|
||||
nargs = helpers.mkNullOrOption (types.enum ["0" "1" "*" "?" "+"]) ''
|
||||
The number of arguments to expect, see :h command-nargs.
|
||||
'';
|
||||
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 ["%"])]) ''
|
||||
Whether the command accepts a range, see :h command-range.
|
||||
'';
|
||||
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) ''
|
||||
Whether the command accepts a count, see :h command-range.
|
||||
'';
|
||||
|
@ -37,20 +57,22 @@ with lib; let
|
|||
# TODO: command-preview, need to grab a function here.
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.userCommands = mkOption {
|
||||
type = types.attrsOf commandAttributes;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "A list of user commands to add to the configuration.";
|
||||
};
|
||||
|
||||
config = let
|
||||
cleanupCommand = _: cmd: {
|
||||
inherit (cmd) command;
|
||||
options = filterAttrs (name: _: name != "command") cmd;
|
||||
};
|
||||
in
|
||||
mkIf (config.userCommands != {}) {
|
||||
config =
|
||||
let
|
||||
cleanupCommand = _: cmd: {
|
||||
inherit (cmd) command;
|
||||
options = filterAttrs (name: _: name != "command") cmd;
|
||||
};
|
||||
in
|
||||
mkIf (config.userCommands != { }) {
|
||||
extraConfigLua = helpers.wrapDo ''
|
||||
local cmds = ${helpers.toLuaObject (mapAttrs cleanupCommand config.userCommands)};
|
||||
for name,cmd in pairs(cmds) do
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -18,7 +29,7 @@ with lib; {
|
|||
|
||||
properties = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
default = { };
|
||||
description = ''
|
||||
The table key is a property name and the value is a callback function which accepts the
|
||||
number of the buffer to be modified, the value of the property in the .editorconfig file,
|
||||
|
@ -39,23 +50,26 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.editorconfig;
|
||||
in {
|
||||
globals.editorconfig = mkIf (!cfg.enable) false;
|
||||
|
||||
extraConfigLua = let
|
||||
mkProperty = name: function: ''
|
||||
__editorconfig.properties.${name} = ${function}
|
||||
'';
|
||||
propertiesString = lib.concatLines (lib.mapAttrsToList mkProperty cfg.properties);
|
||||
config =
|
||||
let
|
||||
cfg = config.editorconfig;
|
||||
in
|
||||
mkIf (propertiesString != "" && cfg.enable) ''
|
||||
do
|
||||
local __editorconfig = require('editorconfig')
|
||||
{
|
||||
globals.editorconfig = mkIf (!cfg.enable) false;
|
||||
|
||||
${propertiesString}
|
||||
end
|
||||
'';
|
||||
};
|
||||
extraConfigLua =
|
||||
let
|
||||
mkProperty = name: function: ''
|
||||
__editorconfig.properties.${name} = ${function}
|
||||
'';
|
||||
propertiesString = lib.concatLines (lib.mapAttrsToList mkProperty cfg.properties);
|
||||
in
|
||||
mkIf (propertiesString != "" && cfg.enable) ''
|
||||
do
|
||||
local __editorconfig = require('editorconfig')
|
||||
|
||||
${propertiesString}
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,38 +4,40 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
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 {
|
||||
options = {
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
};
|
||||
};
|
||||
})))
|
||||
]
|
||||
));
|
||||
in {
|
||||
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 {
|
||||
options = {
|
||||
priority = mkOption { type = int; };
|
||||
};
|
||||
})
|
||||
))
|
||||
])
|
||||
);
|
||||
in
|
||||
{
|
||||
options.filetype =
|
||||
helpers.mkCompositeOption ''
|
||||
Define additional filetypes. The values can either be a literal filetype or a function
|
||||
taking the filepath and the buffer number.
|
||||
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";
|
||||
};
|
||||
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";
|
||||
};
|
||||
|
||||
config.extraConfigLua = helpers.mkIfNonNull' config.filetype ''
|
||||
vim.filetype.add(${helpers.toLuaObject config.filetype})
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf helpers.nixvimTypes.highlight;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Define new highlight groups";
|
||||
example = ''
|
||||
highlight = {
|
||||
|
@ -19,7 +20,7 @@ with lib; {
|
|||
|
||||
highlightOverride = mkOption {
|
||||
type = types.attrsOf helpers.nixvimTypes.highlight;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Define highlight groups to override existing highlight";
|
||||
example = ''
|
||||
highlight = {
|
||||
|
@ -30,7 +31,7 @@ with lib; {
|
|||
|
||||
match = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Define match groups";
|
||||
example = ''
|
||||
match = {
|
||||
|
@ -42,10 +43,8 @@ with lib; {
|
|||
|
||||
config = {
|
||||
extraConfigLuaPre =
|
||||
(optionalString (config.highlight != {})
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
(optionalString (config.highlight != { })
|
||||
# lua
|
||||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
|
@ -56,11 +55,10 @@ with lib; {
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'')
|
||||
+ (optionalString (config.match != {})
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
)
|
||||
+ (optionalString (config.match != { })
|
||||
# lua
|
||||
''
|
||||
-- Match groups {{
|
||||
do
|
||||
|
@ -71,23 +69,22 @@ with lib; {
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'');
|
||||
''
|
||||
);
|
||||
|
||||
extraConfigLuaPost =
|
||||
optionalString (config.highlightOverride != {})
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlightOverride}
|
||||
optionalString (config.highlightOverride != { })
|
||||
# lua
|
||||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlightOverride}
|
||||
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- }}
|
||||
'';
|
||||
-- }}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
keymaps = mkOption {
|
||||
type =
|
||||
types.listOf
|
||||
helpers.keymaps.mapOptionSubmodule;
|
||||
default = [];
|
||||
type = types.listOf helpers.keymaps.mapOptionSubmodule;
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
key = "<C-m>";
|
||||
|
@ -22,7 +21,7 @@ with lib; {
|
|||
|
||||
keymapsOnEvents = mkOption {
|
||||
type = types.attrsOf (types.listOf helpers.keymaps.mapOptionSubmodule);
|
||||
default = {};
|
||||
default = { };
|
||||
example = {
|
||||
"InsertEnter" = [
|
||||
{
|
||||
|
@ -44,24 +43,16 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
normalizeMapping = keyMapping: {
|
||||
inherit
|
||||
(keyMapping)
|
||||
mode
|
||||
key
|
||||
options
|
||||
;
|
||||
config =
|
||||
let
|
||||
normalizeMapping = keyMapping: {
|
||||
inherit (keyMapping) mode key options;
|
||||
|
||||
action =
|
||||
if keyMapping.lua
|
||||
then helpers.mkRaw keyMapping.action
|
||||
else keyMapping.action;
|
||||
};
|
||||
in {
|
||||
extraConfigLua =
|
||||
optionalString (config.keymaps != [])
|
||||
''
|
||||
action = if keyMapping.lua then helpers.mkRaw keyMapping.action else keyMapping.action;
|
||||
};
|
||||
in
|
||||
{
|
||||
extraConfigLua = optionalString (config.keymaps != [ ]) ''
|
||||
-- Set up keybinds {{{
|
||||
do
|
||||
local __nixvim_binds = ${helpers.toLuaObject (map normalizeMapping config.keymaps)}
|
||||
|
@ -72,27 +63,24 @@ 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: {
|
||||
inherit event;
|
||||
group = "nixvim_binds_${event}";
|
||||
callback = helpers.mkRaw ''
|
||||
function()
|
||||
do
|
||||
local __nixvim_binds = ${helpers.toLuaObject (map normalizeMapping mappings)}
|
||||
for i, map in ipairs(__nixvim_binds) do
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
end
|
||||
autoCmd = mapAttrsToList (event: mappings: {
|
||||
inherit event;
|
||||
group = "nixvim_binds_${event}";
|
||||
callback = helpers.mkRaw ''
|
||||
function()
|
||||
do
|
||||
local __nixvim_binds = ${helpers.toLuaObject (map normalizeMapping mappings)}
|
||||
for i, map in ipairs(__nixvim_binds) do
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
end
|
||||
end
|
||||
'';
|
||||
desc = "Load keymaps for ${event}";
|
||||
}
|
||||
)
|
||||
config.keymapsOnEvents;
|
||||
};
|
||||
end
|
||||
'';
|
||||
desc = "Load keymaps for ${event}";
|
||||
}) 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,59 +35,51 @@ with lib; let
|
|||
description = "Global variables (`vim.g.*`)";
|
||||
};
|
||||
};
|
||||
in {
|
||||
options =
|
||||
mapAttrs
|
||||
(
|
||||
_: {description, ...}:
|
||||
mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
default = {};
|
||||
inherit description;
|
||||
}
|
||||
)
|
||||
optionsAttrs;
|
||||
in
|
||||
{
|
||||
options = mapAttrs (
|
||||
_:
|
||||
{ description, ... }:
|
||||
mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
default = { };
|
||||
inherit description;
|
||||
}
|
||||
) optionsAttrs;
|
||||
|
||||
# Added 2024-03-29 (do not remove)
|
||||
imports =
|
||||
mapAttrsToList
|
||||
(old: new: mkRenamedOptionModule [old] [new])
|
||||
{
|
||||
options = "opts";
|
||||
globalOptions = "globalOpts";
|
||||
localOptions = "localOpts";
|
||||
};
|
||||
imports = mapAttrsToList (old: new: mkRenamedOptionModule [ old ] [ new ]) {
|
||||
options = "opts";
|
||||
globalOptions = "globalOpts";
|
||||
localOptions = "localOpts";
|
||||
};
|
||||
|
||||
config = {
|
||||
extraConfigLuaPre =
|
||||
concatLines
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
optionName: {
|
||||
prettyName,
|
||||
luaVariableName,
|
||||
luaApi,
|
||||
...
|
||||
}: let
|
||||
varName = "nixvim_${luaVariableName}";
|
||||
optionDefinitions = config.${optionName};
|
||||
in
|
||||
optionalString
|
||||
(optionDefinitions != {})
|
||||
''
|
||||
-- Set up ${prettyName} {{{
|
||||
do
|
||||
local ${varName} = ${helpers.toLuaObject optionDefinitions}
|
||||
extraConfigLuaPre = concatLines (
|
||||
mapAttrsToList (
|
||||
optionName:
|
||||
{
|
||||
prettyName,
|
||||
luaVariableName,
|
||||
luaApi,
|
||||
...
|
||||
}:
|
||||
let
|
||||
varName = "nixvim_${luaVariableName}";
|
||||
optionDefinitions = config.${optionName};
|
||||
in
|
||||
optionalString (optionDefinitions != { }) ''
|
||||
-- Set up ${prettyName} {{{
|
||||
do
|
||||
local ${varName} = ${helpers.toLuaObject optionDefinitions}
|
||||
|
||||
for k,v in pairs(${varName}) do
|
||||
vim.${luaApi}[k] = v
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
''
|
||||
)
|
||||
optionsAttrs
|
||||
);
|
||||
for k,v in pairs(${varName}) do
|
||||
vim.${luaApi}[k] = v
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
''
|
||||
) optionsAttrs
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
config = mkOption {
|
||||
|
@ -12,11 +9,9 @@ with lib; let
|
|||
default = "";
|
||||
};
|
||||
|
||||
optional =
|
||||
mkEnableOption "optional"
|
||||
// {
|
||||
description = "Don't load by default (load with :packadd)";
|
||||
};
|
||||
optional = mkEnableOption "optional" // {
|
||||
description = "Don't load by default (load with :packadd)";
|
||||
};
|
||||
|
||||
plugin = mkOption {
|
||||
type = types.package;
|
||||
|
@ -24,24 +19,25 @@ with lib; let
|
|||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
extraPlugins = mkOption {
|
||||
type = with types; listOf (either package pluginWithConfigType);
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "List of vim plugins to install";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = with types; listOf (nullOr package);
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Extra packages to be made available to neovim";
|
||||
apply = builtins.filter (p: p != null);
|
||||
};
|
||||
|
||||
extraPython3Packages = mkOption {
|
||||
type = with types; functionTo (listOf package);
|
||||
default = p: [];
|
||||
default = p: [ ];
|
||||
defaultText = literalExpression "p: with p; [ ]";
|
||||
description = "Python packages to add to the `PYTHONPATH` of neovim.";
|
||||
example = lib.literalExpression ''
|
||||
|
@ -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";
|
||||
};
|
||||
|
@ -94,40 +93,39 @@ in {
|
|||
extraLuaPackages = mkOption {
|
||||
type = types.functionTo (types.listOf types.package);
|
||||
description = "Extra lua packages to include with neovim";
|
||||
default = _: [];
|
||||
default = _: [ ];
|
||||
};
|
||||
|
||||
extraFiles = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = "Extra files to add to the runtime path";
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
contentLua = ''
|
||||
${config.extraConfigLuaPre}
|
||||
vim.cmd([[
|
||||
${config.extraConfigVim}
|
||||
]])
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
'';
|
||||
|
||||
contentVim = ''
|
||||
lua << EOF
|
||||
config =
|
||||
let
|
||||
contentLua = ''
|
||||
${config.extraConfigLuaPre}
|
||||
EOF
|
||||
${config.extraConfigVim}
|
||||
lua << EOF
|
||||
vim.cmd([[
|
||||
${config.extraConfigVim}
|
||||
]])
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
EOF
|
||||
'';
|
||||
in {
|
||||
content =
|
||||
if config.type == "lua"
|
||||
then contentLua
|
||||
else contentVim;
|
||||
};
|
||||
'';
|
||||
|
||||
contentVim = ''
|
||||
lua << EOF
|
||||
${config.extraConfigLuaPre}
|
||||
EOF
|
||||
${config.extraConfigVim}
|
||||
lua << EOF
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
EOF
|
||||
'';
|
||||
in
|
||||
{
|
||||
content = if config.type == "lua" then contentLua else contentVim;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../plugins/default.nix
|
||||
];
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ../plugins/default.nix ];
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
{lib, ...}:
|
||||
with lib; {
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
warnings = mkOption {
|
||||
type = types.listOf types.str;
|
||||
visible = false;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
assertions = mkOption {
|
||||
type = types.listOf types.attrs; # Not sure what the correct type is here
|
||||
visible = false;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
|||
originalName = "my-plugin.nvim"; # TODO replace (or remove entirely if it is the same as `name`)
|
||||
defaultPackage = pkgs.vimPlugins.my-plugin-nvim; # TODO replace
|
||||
|
||||
maintainers = [lib.maintainers.MyName]; # TODO replace with your name
|
||||
maintainers = [ lib.maintainers.MyName ]; # TODO replace with your name
|
||||
|
||||
# Optionally, explicitly declare some options. You don't have to.
|
||||
settingsOptions = {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.barbar;
|
||||
|
||||
bufferOptions = {
|
||||
|
@ -14,30 +15,31 @@ 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"]
|
||||
(
|
||||
name:
|
||||
[
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"hint"
|
||||
]
|
||||
(
|
||||
name:
|
||||
helpers.mkCompositeOption "${name} diagnostic icon." {
|
||||
enable = helpers.defaultNullOpts.mkBool false "Enable the ${name} diagnostic symbol";
|
||||
|
||||
icon = helpers.mkNullOrOption types.str "${name} diagnostic symbol";
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
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 =
|
||||
{
|
||||
modified = bufferOptions;
|
||||
pinned = bufferOptions;
|
||||
}
|
||||
// bufferOptions;
|
||||
stateOptions = {
|
||||
modified = bufferOptions;
|
||||
pinned = bufferOptions;
|
||||
} // bufferOptions;
|
||||
|
||||
keymapsActions = {
|
||||
previous = "Previous";
|
||||
|
@ -78,160 +78,141 @@ with lib; let
|
|||
orderByLanguage = "OrderByLanguage";
|
||||
orderByWindowNumber = "OrderByWindowNumber";
|
||||
};
|
||||
in {
|
||||
options.plugins.barbar =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
in
|
||||
{
|
||||
options.plugins.barbar = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
|
||||
package = helpers.mkPackageOption "barbar" pkgs.vimPlugins.barbar-nvim;
|
||||
|
||||
animation = helpers.defaultNullOpts.mkBool true "Enable/disable animations";
|
||||
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
|
||||
- left-click: go to buffer
|
||||
- middle-click: delete buffer
|
||||
'';
|
||||
clickable = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable clickable tabs
|
||||
- left-click: go to buffer
|
||||
- middle-click: delete buffer
|
||||
'';
|
||||
|
||||
excludeFileTypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
Excludes buffers of certain filetypes from the tabline
|
||||
'';
|
||||
excludeFileTypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
Excludes buffers of certain filetypes from the tabline
|
||||
'';
|
||||
|
||||
excludeFileNames = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
Excludes buffers with certain filenames from the tabline
|
||||
'';
|
||||
excludeFileNames = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
Excludes buffers with certain filenames from the tabline
|
||||
'';
|
||||
|
||||
focusOnClose =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["left" "right"]
|
||||
focusOnClose =
|
||||
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";
|
||||
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";
|
||||
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
||||
|
||||
icons =
|
||||
stateOptions
|
||||
// (
|
||||
mapAttrs
|
||||
(name: description:
|
||||
mkOption {
|
||||
type = types.submodule {
|
||||
options = stateOptions;
|
||||
};
|
||||
default = {};
|
||||
inherit description;
|
||||
})
|
||||
{
|
||||
alternate = "The icons used for an alternate buffer.";
|
||||
current = "The icons for the current buffer.";
|
||||
inactive = "The icons for inactive buffers.";
|
||||
visible = "The icons for visible buffers.";
|
||||
}
|
||||
);
|
||||
|
||||
hide = {
|
||||
alternate = helpers.mkNullOrOption types.bool "Hide alternate buffers";
|
||||
current = helpers.mkNullOrOption types.bool "Hide current buffer";
|
||||
extensions = helpers.mkNullOrOption types.bool "Hide file extensions";
|
||||
inactive = helpers.mkNullOrOption types.bool "Hide inactive buffers";
|
||||
visible = helpers.mkNullOrOption types.bool "Hide visible buffers";
|
||||
};
|
||||
|
||||
insertAtEnd = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, new buffers will be inserted at the end of the list.
|
||||
Default is to insert after current buffer.
|
||||
'';
|
||||
|
||||
insertAtStart = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, new buffers will be inserted at the start of the list.
|
||||
Default is to insert after current buffer.
|
||||
'';
|
||||
|
||||
maximumPadding =
|
||||
helpers.defaultNullOpts.mkInt 4
|
||||
"Sets the maximum padding width with which to surround each tab";
|
||||
|
||||
minimumPadding =
|
||||
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.";
|
||||
|
||||
semanticLetters = helpers.defaultNullOpts.mkBool true ''
|
||||
If set, the letters for each buffer in buffer-pick mode will be assigned based on their
|
||||
name.
|
||||
Otherwise or in case all letters are already assigned, the behavior is to assign letters in
|
||||
order of usability (see `letters` option)
|
||||
'';
|
||||
|
||||
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
|
||||
icons =
|
||||
stateOptions
|
||||
// (mapAttrs
|
||||
(
|
||||
with types;
|
||||
attrsOf (
|
||||
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.";
|
||||
};
|
||||
})
|
||||
)
|
||||
name: description:
|
||||
mkOption {
|
||||
type = types.submodule { options = stateOptions; };
|
||||
default = { };
|
||||
inherit description;
|
||||
}
|
||||
)
|
||||
"Set the filetypes which barbar will offset itself for";
|
||||
|
||||
noNameTitle = helpers.mkNullOrOption types.str ''
|
||||
Sets the name of unnamed buffers.
|
||||
By default format is "[Buffer X]" where X is the buffer number.
|
||||
But only a static string is accepted here.
|
||||
'';
|
||||
|
||||
keymaps =
|
||||
{
|
||||
silent = mkEnableOption "silent keymaps for barbar";
|
||||
alternate = "The icons used for an alternate buffer.";
|
||||
current = "The icons for the current buffer.";
|
||||
inactive = "The icons for inactive buffers.";
|
||||
visible = "The icons for visible buffers.";
|
||||
}
|
||||
// (
|
||||
mapAttrs
|
||||
(
|
||||
optionName: funcName:
|
||||
helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
|
||||
)
|
||||
keymapsActions
|
||||
);
|
||||
);
|
||||
|
||||
hide = {
|
||||
alternate = helpers.mkNullOrOption types.bool "Hide alternate buffers";
|
||||
current = helpers.mkNullOrOption types.bool "Hide current buffer";
|
||||
extensions = helpers.mkNullOrOption types.bool "Hide file extensions";
|
||||
inactive = helpers.mkNullOrOption types.bool "Hide inactive buffers";
|
||||
visible = helpers.mkNullOrOption types.bool "Hide visible buffers";
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions =
|
||||
insertAtEnd = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, new buffers will be inserted at the end of the list.
|
||||
Default is to insert after current buffer.
|
||||
'';
|
||||
|
||||
insertAtStart = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, new buffers will be inserted at the start of the list.
|
||||
Default is to insert after current buffer.
|
||||
'';
|
||||
|
||||
maximumPadding =
|
||||
helpers.defaultNullOpts.mkInt 4
|
||||
"Sets the maximum padding width with which to surround each tab";
|
||||
|
||||
minimumPadding =
|
||||
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.";
|
||||
|
||||
semanticLetters = helpers.defaultNullOpts.mkBool true ''
|
||||
If set, the letters for each buffer in buffer-pick mode will be assigned based on their
|
||||
name.
|
||||
Otherwise or in case all letters are already assigned, the behavior is to assign letters in
|
||||
order of usability (see `letters` option)
|
||||
'';
|
||||
|
||||
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 (
|
||||
with types;
|
||||
attrsOf (
|
||||
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.";
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
) "Set the filetypes which barbar will offset itself for";
|
||||
|
||||
noNameTitle = helpers.mkNullOrOption types.str ''
|
||||
Sets the name of unnamed buffers.
|
||||
By default format is "[Buffer X]" where X is the buffer number.
|
||||
But only a static string is accepted here.
|
||||
'';
|
||||
|
||||
keymaps =
|
||||
{
|
||||
silent = mkEnableOption "silent keymaps for barbar";
|
||||
}
|
||||
// (mapAttrs (
|
||||
optionName: funcName: helpers.mkNullOrOption types.str "Keymap for function Buffer${funcName}"
|
||||
) keymapsActions);
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
inherit (cfg) animation;
|
||||
auto_hide = cfg.autoHide;
|
||||
inherit (cfg) tabpages;
|
||||
|
@ -242,74 +223,58 @@ in {
|
|||
highlight_alternate = cfg.highlightAlternate;
|
||||
highlight_inactive_file_icons = cfg.highlightInactiveFileIcons;
|
||||
highlight_visible = cfg.highlightVisible;
|
||||
icons = let
|
||||
handleBufferOption = bufferOption:
|
||||
with bufferOption; {
|
||||
buffer_index = bufferIndex;
|
||||
buffer_number = bufferNumber;
|
||||
inherit button;
|
||||
diagnostics =
|
||||
/*
|
||||
Because the keys of this lua table are not strings (but
|
||||
`vim.diagnostic.severity.XXXX`), we have to manually build a raw lua string here.
|
||||
*/
|
||||
let
|
||||
setIcons = filterAttrs (n: v: v != null) cfg.icons.diagnostics;
|
||||
setIconsList =
|
||||
mapAttrsToList
|
||||
(name: value: {
|
||||
icons =
|
||||
let
|
||||
handleBufferOption =
|
||||
bufferOption: with bufferOption; {
|
||||
buffer_index = bufferIndex;
|
||||
buffer_number = bufferNumber;
|
||||
inherit button;
|
||||
diagnostics =
|
||||
/*
|
||||
Because the keys of this lua table are not strings (but
|
||||
`vim.diagnostic.severity.XXXX`), we have to manually build a raw lua string here.
|
||||
*/
|
||||
let
|
||||
setIcons = filterAttrs (n: v: v != null) cfg.icons.diagnostics;
|
||||
setIconsList = mapAttrsToList (name: value: {
|
||||
key = "vim.diagnostic.severity.${strings.toUpper name}";
|
||||
value = helpers.ifNonNull' value (helpers.toLuaObject {
|
||||
enabled = value.enable;
|
||||
inherit (value) icon;
|
||||
});
|
||||
})
|
||||
setIcons;
|
||||
in
|
||||
value = helpers.ifNonNull' value (
|
||||
helpers.toLuaObject {
|
||||
enabled = value.enable;
|
||||
inherit (value) icon;
|
||||
}
|
||||
);
|
||||
}) setIcons;
|
||||
in
|
||||
helpers.mkRaw (
|
||||
"{"
|
||||
+ concatStringsSep ","
|
||||
(
|
||||
map
|
||||
(iconOption: "[${iconOption.key}] = ${iconOption.value}")
|
||||
setIconsList
|
||||
)
|
||||
+ concatStringsSep "," (map (iconOption: "[${iconOption.key}] = ${iconOption.value}") setIconsList)
|
||||
+ "}"
|
||||
);
|
||||
filetype = with filetype; {
|
||||
custom_color = customColors;
|
||||
enabled = enable;
|
||||
filetype = with filetype; {
|
||||
custom_color = customColors;
|
||||
enabled = enable;
|
||||
};
|
||||
inherit separator;
|
||||
};
|
||||
inherit separator;
|
||||
};
|
||||
|
||||
handleStateOption = stateOption:
|
||||
with stateOption;
|
||||
handleStateOption =
|
||||
stateOption:
|
||||
with stateOption;
|
||||
{
|
||||
modified = handleBufferOption modified;
|
||||
pinned = handleBufferOption pinned;
|
||||
}
|
||||
// (
|
||||
handleBufferOption
|
||||
(
|
||||
getAttrs (attrNames stateOption)
|
||||
stateOption
|
||||
)
|
||||
);
|
||||
in
|
||||
(
|
||||
handleStateOption
|
||||
(
|
||||
getAttrs
|
||||
(attrNames stateOptions)
|
||||
cfg.icons
|
||||
)
|
||||
)
|
||||
// (
|
||||
genAttrs
|
||||
["alternate" "current" "inactive" "visible"]
|
||||
(optionName: handleStateOption cfg.icons.${optionName})
|
||||
);
|
||||
// (handleBufferOption (getAttrs (attrNames stateOption) stateOption));
|
||||
in
|
||||
(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,29 +285,23 @@ 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)
|
||||
{
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = "<Cmd>Buffer${funcName}<CR>";
|
||||
options.silent = cfg.keymaps.silent;
|
||||
}
|
||||
)
|
||||
keymapsActions
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = "<Cmd>Buffer${funcName}<CR>";
|
||||
options.silent = cfg.keymaps.silent;
|
||||
}
|
||||
) keymapsActions
|
||||
);
|
||||
in
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
|
|
|
@ -5,61 +5,61 @@
|
|||
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
|
||||
// {
|
||||
enable = mkEnableOption "barbecue-nvim";
|
||||
in
|
||||
{
|
||||
options.plugins.barbecue = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "barbecue-nvim";
|
||||
|
||||
package = helpers.mkPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
|
||||
package = helpers.mkPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
|
||||
|
||||
attachNavic = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to attach navic to language servers automatically.
|
||||
attachNavic = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to attach navic to language servers automatically.
|
||||
'';
|
||||
|
||||
createAutocmd = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to create winbar updater autocmd.
|
||||
'';
|
||||
|
||||
includeBuftypes = mkListStr ''[""]'' ''
|
||||
Buftypes to enable winbar in.
|
||||
'';
|
||||
|
||||
excludeFiletypes = mkListStr ''["netrw" "toggleterm"]'' ''
|
||||
Filetypes not to enable winbar in.
|
||||
'';
|
||||
|
||||
modifiers = {
|
||||
dirname = helpers.defaultNullOpts.mkStr ":~:." ''
|
||||
Filename modifiers applied to dirname.
|
||||
|
||||
See: `:help filename-modifiers`
|
||||
'';
|
||||
|
||||
createAutocmd = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to create winbar updater autocmd.
|
||||
basename = helpers.defaultNullOpts.mkStr "" ''
|
||||
Filename modifiers applied to basename.
|
||||
|
||||
See: `:help filename-modifiers`
|
||||
'';
|
||||
};
|
||||
|
||||
includeBuftypes = mkListStr ''[""]'' ''
|
||||
Buftypes to enable winbar in.
|
||||
'';
|
||||
showDirname = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display path to file.
|
||||
'';
|
||||
|
||||
excludeFiletypes = mkListStr ''["netrw" "toggleterm"]'' ''
|
||||
Filetypes not to enable winbar in.
|
||||
'';
|
||||
showBasename = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display file name.
|
||||
'';
|
||||
|
||||
modifiers = {
|
||||
dirname = helpers.defaultNullOpts.mkStr ":~:." ''
|
||||
Filename modifiers applied to dirname.
|
||||
showModified = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to replace file icon with the modified symbol when buffer is modified.
|
||||
'';
|
||||
|
||||
See: `:help filename-modifiers`
|
||||
'';
|
||||
|
||||
basename = helpers.defaultNullOpts.mkStr "" ''
|
||||
Filename modifiers applied to basename.
|
||||
|
||||
See: `:help filename-modifiers`
|
||||
'';
|
||||
};
|
||||
|
||||
showDirname = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display path to file.
|
||||
'';
|
||||
|
||||
showBasename = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display file name.
|
||||
'';
|
||||
|
||||
showModified = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to replace file icon with the modified symbol when buffer is modified.
|
||||
'';
|
||||
|
||||
modified =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
modified =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(bufnr)
|
||||
return vim.bo[bufnr].modified
|
||||
|
@ -70,12 +70,12 @@ in {
|
|||
NOTE: This can be used to get file modified status from SCM (e.g. git)
|
||||
'';
|
||||
|
||||
showNavic = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show/use navic in the winbar.
|
||||
'';
|
||||
showNavic = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show/use navic in the winbar.
|
||||
'';
|
||||
|
||||
leadCustomSection =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
leadCustomSection =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function()
|
||||
return " "
|
||||
|
@ -86,8 +86,8 @@ in {
|
|||
NOTE: This function shouldn't do any expensive actions as it is run on each render.
|
||||
'';
|
||||
|
||||
customSection =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
customSection =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function()
|
||||
return " "
|
||||
|
@ -98,101 +98,88 @@ in {
|
|||
NOTE: This function shouldn't do any expensive actions as it is run on each render.
|
||||
'';
|
||||
|
||||
theme = helpers.defaultNullOpts.mkStr "auto" ''
|
||||
Theme to be used for generating highlight groups dynamically.
|
||||
theme = helpers.defaultNullOpts.mkStr "auto" ''
|
||||
Theme to be used for generating highlight groups dynamically.
|
||||
'';
|
||||
|
||||
contextFollowIconColor = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether context text should follow its icon's color.
|
||||
'';
|
||||
|
||||
symbols = {
|
||||
modified = helpers.defaultNullOpts.mkStr "●" ''
|
||||
Modification indicator.
|
||||
'';
|
||||
|
||||
contextFollowIconColor = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether context text should follow its icon's color.
|
||||
ellipsis = helpers.defaultNullOpts.mkStr "…" ''
|
||||
Truncation indicator.
|
||||
'';
|
||||
|
||||
symbols = {
|
||||
modified = helpers.defaultNullOpts.mkStr "●" ''
|
||||
Modification indicator.
|
||||
'';
|
||||
|
||||
ellipsis = helpers.defaultNullOpts.mkStr "…" ''
|
||||
Truncation indicator.
|
||||
'';
|
||||
|
||||
separator = helpers.defaultNullOpts.mkStr "" ''
|
||||
Entry separator.
|
||||
'';
|
||||
};
|
||||
|
||||
kinds =
|
||||
mapAttrs
|
||||
(
|
||||
name: default:
|
||||
helpers.defaultNullOpts.mkStr default "icon for ${name}."
|
||||
)
|
||||
{
|
||||
File = "";
|
||||
Module = "";
|
||||
Namespace = "";
|
||||
Package = "";
|
||||
Class = "";
|
||||
Method = "";
|
||||
Property = "";
|
||||
Field = "";
|
||||
Constructor = "";
|
||||
Enum = "";
|
||||
Interface = "";
|
||||
Function = "";
|
||||
Variable = "";
|
||||
Constant = "";
|
||||
String = "";
|
||||
Number = "";
|
||||
Boolean = "";
|
||||
Array = "";
|
||||
Object = "";
|
||||
Key = "";
|
||||
Null = "";
|
||||
EnumMember = "";
|
||||
Struct = "";
|
||||
Event = "";
|
||||
Operator = "";
|
||||
TypeParameter = "";
|
||||
};
|
||||
separator = helpers.defaultNullOpts.mkStr "" ''
|
||||
Entry separator.
|
||||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
attach_navic = attachNavic;
|
||||
create_autocmd = createAutocmd;
|
||||
include_buftypes = includeBuftypes;
|
||||
exclude_filetypes = excludeFiletypes;
|
||||
modifiers = {
|
||||
inherit
|
||||
(modifiers)
|
||||
dirname
|
||||
basename
|
||||
;
|
||||
};
|
||||
show_dirname = showDirname;
|
||||
show_basename = showBasename;
|
||||
show_modified = showModified;
|
||||
inherit modified;
|
||||
show_navic = showNavic;
|
||||
lead_custom_section = leadCustomSection;
|
||||
custom_section = customSection;
|
||||
inherit theme;
|
||||
context_follow_icon_color = contextFollowIconColor;
|
||||
symbols = {
|
||||
inherit
|
||||
(symbols)
|
||||
modified
|
||||
ellipsis
|
||||
separator
|
||||
;
|
||||
};
|
||||
inherit kinds;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
kinds = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
|
||||
File = "";
|
||||
Module = "";
|
||||
Namespace = "";
|
||||
Package = "";
|
||||
Class = "";
|
||||
Method = "";
|
||||
Property = "";
|
||||
Field = "";
|
||||
Constructor = "";
|
||||
Enum = "";
|
||||
Interface = "";
|
||||
Function = "";
|
||||
Variable = "";
|
||||
Constant = "";
|
||||
String = "";
|
||||
Number = "";
|
||||
Boolean = "";
|
||||
Array = "";
|
||||
Object = "";
|
||||
Key = "";
|
||||
Null = "";
|
||||
EnumMember = "";
|
||||
Struct = "";
|
||||
Event = "";
|
||||
Operator = "";
|
||||
TypeParameter = "";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
attach_navic = attachNavic;
|
||||
create_autocmd = createAutocmd;
|
||||
include_buftypes = includeBuftypes;
|
||||
exclude_filetypes = excludeFiletypes;
|
||||
modifiers = {
|
||||
inherit (modifiers) dirname basename;
|
||||
};
|
||||
show_dirname = showDirname;
|
||||
show_basename = showBasename;
|
||||
show_modified = showModified;
|
||||
inherit modified;
|
||||
show_navic = showNavic;
|
||||
lead_custom_section = leadCustomSection;
|
||||
custom_section = customSection;
|
||||
inherit theme;
|
||||
context_follow_icon_color = contextFollowIconColor;
|
||||
symbols = {
|
||||
inherit (symbols) modified ellipsis separator;
|
||||
};
|
||||
inherit kinds;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('barbecue').setup(${helpers.toLuaObject setupOptions})
|
||||
|
|
|
@ -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
|
||||
// {
|
||||
enable = mkEnableOption "bufferline";
|
||||
plugins.bufferline = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "bufferline";
|
||||
|
||||
package = helpers.mkPackageOption "bufferline" pkgs.vimPlugins.bufferline-nvim;
|
||||
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
|
||||
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"
|
||||
''
|
||||
|
@ -121,166 +125,137 @@ in {
|
|||
```
|
||||
'';
|
||||
|
||||
bufferCloseIcon = helpers.defaultNullOpts.mkStr "" "The close icon for each buffer.";
|
||||
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.";
|
||||
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";
|
||||
indicator = {
|
||||
icon = helpers.defaultNullOpts.mkStr "▎" "icon";
|
||||
|
||||
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";
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
truncateNames = helpers.defaultNullOpts.mkBool true "Whether to truncate names.";
|
||||
|
||||
tabSize = helpers.defaultNullOpts.mkInt 18 "Size of the tabs";
|
||||
|
||||
maxNameLength = helpers.defaultNullOpts.mkInt 18 "Max length of a buffer name.";
|
||||
|
||||
colorIcons = helpers.defaultNullOpts.mkBool true "Enable color icons.";
|
||||
|
||||
showBufferIcons = helpers.defaultNullOpts.mkBool true "Show buffer icons";
|
||||
|
||||
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
|
||||
|
||||
getElementIcon =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
''
|
||||
Lua function returning an element icon.
|
||||
|
||||
```
|
||||
fun(opts: IconFetcherOpts): string?, string?
|
||||
```
|
||||
'';
|
||||
|
||||
showCloseIcon = helpers.defaultNullOpts.mkBool true "Whether to show the close icon.";
|
||||
|
||||
showTabIndicators =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to show the tab indicators.";
|
||||
|
||||
showDuplicatePrefix =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to show the prefix of duplicated files.";
|
||||
|
||||
enforceRegularTabs =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
"Whether to enforce regular tabs.";
|
||||
|
||||
alwaysShowBufferline =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to always show the bufferline.";
|
||||
|
||||
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";
|
||||
|
||||
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";
|
||||
|
||||
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
|
||||
|
||||
groups = {
|
||||
items =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]"
|
||||
"List of groups.";
|
||||
|
||||
options = {
|
||||
toggleHiddenOnEnter =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Re-open hidden groups on bufenter.";
|
||||
};
|
||||
};
|
||||
|
||||
hover = {
|
||||
enabled = mkEnableOption "hover";
|
||||
|
||||
reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal";
|
||||
|
||||
delay = helpers.defaultNullOpts.mkInt 200 "delay";
|
||||
};
|
||||
|
||||
debug = {
|
||||
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
|
||||
};
|
||||
|
||||
customFilter =
|
||||
helpers.defaultNullOpts.mkLuaFn "null"
|
||||
''
|
||||
```
|
||||
fun(buf: number, bufnums: number[]): boolean
|
||||
```
|
||||
'';
|
||||
|
||||
highlights =
|
||||
genAttrs
|
||||
(attrValues highlightOptions)
|
||||
(
|
||||
name:
|
||||
helpers.mkNullOrOption helpers.nixvimTypes.highlight ''
|
||||
Highlight group definition for ${name}.
|
||||
''
|
||||
);
|
||||
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";
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
truncateNames = helpers.defaultNullOpts.mkBool true "Whether to truncate names.";
|
||||
|
||||
tabSize = helpers.defaultNullOpts.mkInt 18 "Size of the tabs";
|
||||
|
||||
maxNameLength = helpers.defaultNullOpts.mkInt 18 "Max length of a buffer name.";
|
||||
|
||||
colorIcons = helpers.defaultNullOpts.mkBool true "Enable color icons.";
|
||||
|
||||
showBufferIcons = helpers.defaultNullOpts.mkBool true "Show buffer icons";
|
||||
|
||||
showBufferCloseIcons = helpers.defaultNullOpts.mkBool true "Show buffer close icons";
|
||||
|
||||
getElementIcon = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
Lua function returning an element icon.
|
||||
|
||||
```
|
||||
fun(opts: IconFetcherOpts): string?, string?
|
||||
```
|
||||
'';
|
||||
|
||||
showCloseIcon = helpers.defaultNullOpts.mkBool true "Whether to show the close icon.";
|
||||
|
||||
showTabIndicators = helpers.defaultNullOpts.mkBool true "Whether to show the tab indicators.";
|
||||
|
||||
showDuplicatePrefix = helpers.defaultNullOpts.mkBool true "Whether to show the prefix of duplicated files.";
|
||||
|
||||
enforceRegularTabs = helpers.defaultNullOpts.mkBool false "Whether to enforce regular tabs.";
|
||||
|
||||
alwaysShowBufferline = helpers.defaultNullOpts.mkBool true "Whether to always show the bufferline.";
|
||||
|
||||
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";
|
||||
|
||||
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";
|
||||
|
||||
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
|
||||
|
||||
groups = {
|
||||
items = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" "List of groups.";
|
||||
|
||||
options = {
|
||||
toggleHiddenOnEnter = helpers.defaultNullOpts.mkBool true "Re-open hidden groups on bufenter.";
|
||||
};
|
||||
};
|
||||
|
||||
hover = {
|
||||
enabled = mkEnableOption "hover";
|
||||
|
||||
reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal";
|
||||
|
||||
delay = helpers.defaultNullOpts.mkInt 200 "delay";
|
||||
};
|
||||
|
||||
debug = {
|
||||
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
|
||||
};
|
||||
|
||||
customFilter = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
```
|
||||
fun(buf: number, bufnums: number[]): boolean
|
||||
```
|
||||
'';
|
||||
|
||||
highlights = genAttrs (attrValues highlightOptions) (
|
||||
name:
|
||||
helpers.mkNullOrOption helpers.nixvimTypes.highlight ''
|
||||
Highlight group definition for ${name}.
|
||||
''
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg; {
|
||||
options =
|
||||
{
|
||||
inherit
|
||||
mode
|
||||
themable
|
||||
numbers
|
||||
;
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
options = {
|
||||
inherit mode themable numbers;
|
||||
buffer_close_icon = bufferCloseIcon;
|
||||
modified_icon = modifiedIcon;
|
||||
close_icon = closeIcon;
|
||||
|
@ -319,29 +294,19 @@ 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;
|
||||
};
|
||||
in
|
||||
highlights = mapAttrs (
|
||||
pluginOptionName: nixvimOptionName: cfg.highlights.${nixvimOptionName}
|
||||
) highlightOptions;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
|
|
|
@ -5,113 +5,109 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.navic;
|
||||
in {
|
||||
options.plugins.navic =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "nvim-navic";
|
||||
in
|
||||
{
|
||||
options.plugins.navic = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-navic";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
|
||||
package = helpers.mkPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
|
||||
|
||||
icons =
|
||||
mapAttrs
|
||||
(
|
||||
name: default:
|
||||
helpers.defaultNullOpts.mkStr default "icon for ${name}."
|
||||
)
|
||||
{
|
||||
File = " ";
|
||||
Module = " ";
|
||||
Namespace = " ";
|
||||
Package = " ";
|
||||
Class = " ";
|
||||
Method = " ";
|
||||
Property = " ";
|
||||
Field = " ";
|
||||
Constructor = " ";
|
||||
Enum = "";
|
||||
Interface = "";
|
||||
Function = " ";
|
||||
Variable = " ";
|
||||
Constant = " ";
|
||||
String = " ";
|
||||
Number = " ";
|
||||
Boolean = "◩ ";
|
||||
Array = " ";
|
||||
Object = " ";
|
||||
Key = " ";
|
||||
Null = " ";
|
||||
EnumMember = " ";
|
||||
Struct = " ";
|
||||
Event = " ";
|
||||
Operator = " ";
|
||||
TypeParameter = " ";
|
||||
};
|
||||
icons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
|
||||
File = " ";
|
||||
Module = " ";
|
||||
Namespace = " ";
|
||||
Package = " ";
|
||||
Class = " ";
|
||||
Method = " ";
|
||||
Property = " ";
|
||||
Field = " ";
|
||||
Constructor = " ";
|
||||
Enum = "";
|
||||
Interface = "";
|
||||
Function = " ";
|
||||
Variable = " ";
|
||||
Constant = " ";
|
||||
String = " ";
|
||||
Number = " ";
|
||||
Boolean = "◩ ";
|
||||
Array = " ";
|
||||
Object = " ";
|
||||
Key = " ";
|
||||
Null = " ";
|
||||
EnumMember = " ";
|
||||
Struct = " ";
|
||||
Event = " ";
|
||||
Operator = " ";
|
||||
TypeParameter = " ";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
autoAttach = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable to have nvim-navic automatically attach to every LSP for current buffer. Its disabled by default.
|
||||
'';
|
||||
|
||||
preference = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
Table ranking lsp_servers. Lower the index, higher the priority of the server. If there are more than one server attached to a buffer. In the example below will prefer clangd over pyright
|
||||
|
||||
Example: `[ "clangd" "pyright" ]`.
|
||||
'';
|
||||
};
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, will add colors to icons and text as defined by highlight groups NavicIcons* (NavicIconsFile, NavicIconsModule.. etc.), NavicText and NavicSeparator.
|
||||
lsp = {
|
||||
autoAttach = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable to have nvim-navic automatically attach to every LSP for current buffer. Its disabled by default.
|
||||
'';
|
||||
|
||||
separator = helpers.defaultNullOpts.mkStr " > " ''
|
||||
Icon to separate items. to use between items.
|
||||
'';
|
||||
preference = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
Table ranking lsp_servers. Lower the index, higher the priority of the server. If there are more than one server attached to a buffer. In the example below will prefer clangd over pyright
|
||||
|
||||
depthLimit = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Maximum depth of context to be shown. If the context hits this depth limit, it is truncated.
|
||||
'';
|
||||
|
||||
depthLimitIndicator = helpers.defaultNullOpts.mkStr ".." ''
|
||||
Icon to indicate that depth_limit was hit and the shown context is truncated.
|
||||
'';
|
||||
|
||||
safeOutput = helpers.defaultNullOpts.mkBool true ''
|
||||
Sanitize the output for use in statusline and winbar.
|
||||
'';
|
||||
|
||||
lazyUpdateContext = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, turns off context updates for the "CursorMoved" event.
|
||||
'';
|
||||
|
||||
click = helpers.defaultNullOpts.mkBool false ''
|
||||
Single click to goto element, double click to open nvim-navbuddy on the clicked element.
|
||||
Example: `[ "clangd" "pyright" ]`.
|
||||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
inherit
|
||||
icons
|
||||
highlight
|
||||
separator
|
||||
click
|
||||
;
|
||||
lsp = with lsp; {
|
||||
auto_attach = autoAttach;
|
||||
inherit preference;
|
||||
};
|
||||
depth_limit = depthLimit;
|
||||
safe_output = safeOutput;
|
||||
lazy_update_context = lazyUpdateContext;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
highlight = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, will add colors to icons and text as defined by highlight groups NavicIcons* (NavicIconsFile, NavicIconsModule.. etc.), NavicText and NavicSeparator.
|
||||
'';
|
||||
|
||||
separator = helpers.defaultNullOpts.mkStr " > " ''
|
||||
Icon to separate items. to use between items.
|
||||
'';
|
||||
|
||||
depthLimit = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Maximum depth of context to be shown. If the context hits this depth limit, it is truncated.
|
||||
'';
|
||||
|
||||
depthLimitIndicator = helpers.defaultNullOpts.mkStr ".." ''
|
||||
Icon to indicate that depth_limit was hit and the shown context is truncated.
|
||||
'';
|
||||
|
||||
safeOutput = helpers.defaultNullOpts.mkBool true ''
|
||||
Sanitize the output for use in statusline and winbar.
|
||||
'';
|
||||
|
||||
lazyUpdateContext = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, turns off context updates for the "CursorMoved" event.
|
||||
'';
|
||||
|
||||
click = helpers.defaultNullOpts.mkBool false ''
|
||||
Single click to goto element, double click to open nvim-navbuddy on the clicked element.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit
|
||||
icons
|
||||
highlight
|
||||
separator
|
||||
click
|
||||
;
|
||||
lsp = with lsp; {
|
||||
auto_attach = autoAttach;
|
||||
inherit preference;
|
||||
};
|
||||
depth_limit = depthLimit;
|
||||
safe_output = safeOutput;
|
||||
lazy_update_context = lazyUpdateContext;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-navic').setup(${helpers.toLuaObject setupOptions})
|
||||
|
|
|
@ -6,48 +6,44 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "ayu";
|
||||
isColorscheme = true;
|
||||
originalName = "neovim-ayu";
|
||||
defaultPackage = pkgs.vimPlugins.neovim-ayu;
|
||||
# The colorscheme option is set by the `setup` function.
|
||||
colorscheme = null;
|
||||
callSetup = false;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "ayu";
|
||||
isColorscheme = true;
|
||||
originalName = "neovim-ayu";
|
||||
defaultPackage = pkgs.vimPlugins.neovim-ayu;
|
||||
# The colorscheme option is set by the `setup` function.
|
||||
colorscheme = null;
|
||||
callSetup = false;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"mirage"
|
||||
"overrides"
|
||||
];
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"mirage"
|
||||
"overrides"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
mirage = helpers.defaultNullOpts.mkBool false ''
|
||||
Set to `true` to use `mirage` variant instead of `dark` for dark background.
|
||||
'';
|
||||
settingsOptions = {
|
||||
mirage = helpers.defaultNullOpts.mkBool false ''
|
||||
Set to `true` to use `mirage` variant instead of `dark` for dark background.
|
||||
'';
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Alternatively, `overrides` can be a function that returns a dictionary of the same
|
||||
format.
|
||||
You can use the function to override based on a dynamic condition, such as the value of
|
||||
`background`.
|
||||
'';
|
||||
};
|
||||
Alternatively, `overrides` can be a function that returns a dictionary of the same
|
||||
format.
|
||||
You can use the function to override based on a dynamic condition, such as the value of
|
||||
`background`.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraConfigLuaPre = ''
|
||||
local ayu = require("ayu")
|
||||
ayu.setup(${helpers.toLuaObject cfg.settings})
|
||||
ayu.colorscheme()
|
||||
'';
|
||||
};
|
||||
}
|
||||
extraConfig = cfg: {
|
||||
extraConfigLuaPre = ''
|
||||
local ayu = require("ayu")
|
||||
ayu.setup(${helpers.toLuaObject cfg.settings})
|
||||
ayu.colorscheme()
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,111 +8,123 @@
|
|||
with lib;
|
||||
# We configure this plugin manually (no `settings` option) so there is no point in using
|
||||
# `mkNeovimPlugin` here.
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "base16";
|
||||
isColorscheme = true;
|
||||
originalName = "base16.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.base16-nvim;
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "base16";
|
||||
isColorscheme = true;
|
||||
originalName = "base16.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.base16-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# We manually set the colorscheme if needed.
|
||||
colorscheme = null;
|
||||
# We manually set the colorscheme if needed.
|
||||
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"]
|
||||
)
|
||||
# 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"
|
||||
])
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
colorscheme = let
|
||||
extraOptions = {
|
||||
colorscheme =
|
||||
let
|
||||
customColorschemeType = types.submodule {
|
||||
options =
|
||||
listToAttrs
|
||||
(
|
||||
map
|
||||
(
|
||||
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"]
|
||||
);
|
||||
options = listToAttrs (
|
||||
map
|
||||
(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"
|
||||
]
|
||||
);
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
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.
|
||||
mkOption {
|
||||
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.
|
||||
|
||||
Example for the latter:
|
||||
```nix
|
||||
{
|
||||
base00 = "#16161D";
|
||||
base01 = "#2c313c";
|
||||
base02 = "#3e4451";
|
||||
base03 = "#6c7891";
|
||||
base04 = "#565c64";
|
||||
base05 = "#abb2bf";
|
||||
base06 = "#9a9bb3";
|
||||
base07 = "#c5c8e6";
|
||||
base08 = "#e06c75";
|
||||
base09 = "#d19a66";
|
||||
base0A = "#e5c07b";
|
||||
base0B = "#98c379";
|
||||
base0C = "#56b6c2";
|
||||
base0D = "#0184bc";
|
||||
base0E = "#c678dd";
|
||||
base0F = "#a06949";
|
||||
}
|
||||
```
|
||||
'';
|
||||
example = "edge-light";
|
||||
};
|
||||
|
||||
setUpBar = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to set your status bar theme to 'base16'.";
|
||||
Example for the latter:
|
||||
```nix
|
||||
{
|
||||
base00 = "#16161D";
|
||||
base01 = "#2c313c";
|
||||
base02 = "#3e4451";
|
||||
base03 = "#6c7891";
|
||||
base04 = "#565c64";
|
||||
base05 = "#abb2bf";
|
||||
base06 = "#9a9bb3";
|
||||
base07 = "#c5c8e6";
|
||||
base08 = "#e06c75";
|
||||
base09 = "#d19a66";
|
||||
base0A = "#e5c07b";
|
||||
base0B = "#98c379";
|
||||
base0C = "#56b6c2";
|
||||
base0D = "#0184bc";
|
||||
base0E = "#c678dd";
|
||||
base0F = "#a06949";
|
||||
}
|
||||
```
|
||||
'';
|
||||
example = "edge-light";
|
||||
};
|
||||
|
||||
setUpBar = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to set your status bar theme to 'base16'.";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg:
|
||||
mkMerge [
|
||||
{
|
||||
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
|
||||
plugins.lualine.theme = mkIf cfg.setUpBar "base16";
|
||||
plugins.lightline.colorscheme = null;
|
||||
extraConfig =
|
||||
cfg:
|
||||
mkMerge [
|
||||
{
|
||||
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
|
||||
plugins.lualine.theme = mkIf cfg.setUpBar "base16";
|
||||
plugins.lightline.colorscheme = null;
|
||||
|
||||
opts.termguicolors = mkDefault true;
|
||||
}
|
||||
(mkIf (isString cfg.colorscheme) {
|
||||
colorscheme = "base16-${cfg.colorscheme}";
|
||||
})
|
||||
(mkIf (isAttrs cfg.colorscheme) {
|
||||
extraConfigLuaPre = ''
|
||||
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
opts.termguicolors = mkDefault true;
|
||||
}
|
||||
(mkIf (isString cfg.colorscheme) { colorscheme = "base16-${cfg.colorscheme}"; })
|
||||
(mkIf (isAttrs cfg.colorscheme) {
|
||||
extraConfigLuaPre = ''
|
||||
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -6,44 +6,105 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "catppuccin";
|
||||
isColorscheme = true;
|
||||
defaultPackage = pkgs.vimPlugins.catppuccin-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "catppuccin";
|
||||
isColorscheme = true;
|
||||
defaultPackage = pkgs.vimPlugins.catppuccin-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-27: remove 2024-05-27
|
||||
optionsRenamedToSettings = [
|
||||
"flavour"
|
||||
["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"]
|
||||
"colorOverrides"
|
||||
"customHighlights"
|
||||
"integrations"
|
||||
];
|
||||
imports =
|
||||
mapAttrsToList (
|
||||
# TODO introduced 2024-03-27: remove 2024-05-27
|
||||
optionsRenamedToSettings = [
|
||||
"flavour"
|
||||
[
|
||||
"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"
|
||||
]
|
||||
"colorOverrides"
|
||||
"customHighlights"
|
||||
"integrations"
|
||||
];
|
||||
imports =
|
||||
mapAttrsToList
|
||||
(
|
||||
old: new:
|
||||
mkRenamedOptionModule
|
||||
["colorschemes" "catppuccin" old]
|
||||
["colorschemes" "catppuccin" "settings" new]
|
||||
mkRenamedOptionModule
|
||||
[
|
||||
"colorschemes"
|
||||
"catppuccin"
|
||||
old
|
||||
]
|
||||
[
|
||||
"colorschemes"
|
||||
"catppuccin"
|
||||
"settings"
|
||||
new
|
||||
]
|
||||
)
|
||||
{
|
||||
showBufferEnd = "show_end_of_buffer";
|
||||
|
@ -53,33 +114,35 @@ 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"])) ''
|
||||
flavour = helpers.mkNullOrOption (types.enum (flavours ++ [ "auto" ])) ''
|
||||
Theme flavour.
|
||||
'';
|
||||
|
||||
background = let
|
||||
mkBackgroundStyle = name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault flavours ''
|
||||
Background for `${name}` background.
|
||||
'';
|
||||
in {
|
||||
light = mkBackgroundStyle "light";
|
||||
background =
|
||||
let
|
||||
mkBackgroundStyle =
|
||||
name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault flavours ''
|
||||
Background for `${name}` background.
|
||||
'';
|
||||
in
|
||||
{
|
||||
light = mkBackgroundStyle "light";
|
||||
|
||||
dark = mkBackgroundStyle "dark";
|
||||
};
|
||||
dark = mkBackgroundStyle "dark";
|
||||
};
|
||||
|
||||
transparent_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable Transparent background.
|
||||
|
@ -169,19 +232,15 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
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."
|
||||
)
|
||||
);
|
||||
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."
|
||||
)
|
||||
);
|
||||
|
||||
custom_highlights = helpers.mkNullOrStrLuaFnOr (with types; attrsOf anything) ''
|
||||
Override specific highlight groups to use other groups or a hex color.
|
||||
|
@ -230,29 +289,30 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
flavour = "mocha";
|
||||
disable_underline = true;
|
||||
term_colors = true;
|
||||
color_overrides.mocha.base = "#1e1e2f";
|
||||
styles = {
|
||||
booleans = ["bold" "italic"];
|
||||
conditionals = ["bold"];
|
||||
};
|
||||
integrations = {
|
||||
cmp = true;
|
||||
gitsigns = true;
|
||||
nvimtree = true;
|
||||
treesitter = true;
|
||||
notify = false;
|
||||
mini = {
|
||||
enabled = true;
|
||||
indentscope_color = "";
|
||||
};
|
||||
settingsExample = {
|
||||
flavour = "mocha";
|
||||
disable_underline = true;
|
||||
term_colors = true;
|
||||
color_overrides.mocha.base = "#1e1e2f";
|
||||
styles = {
|
||||
booleans = [
|
||||
"bold"
|
||||
"italic"
|
||||
];
|
||||
conditionals = [ "bold" ];
|
||||
};
|
||||
integrations = {
|
||||
cmp = true;
|
||||
gitsigns = true;
|
||||
nvimtree = true;
|
||||
treesitter = true;
|
||||
notify = false;
|
||||
mini = {
|
||||
enabled = true;
|
||||
indentscope_color = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
}
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -6,83 +6,83 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cyberdream";
|
||||
isColorscheme = true;
|
||||
originalName = "cyberdream.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.cyberdream-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cyberdream";
|
||||
isColorscheme = true;
|
||||
originalName = "cyberdream.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.cyberdream-nvim;
|
||||
|
||||
maintainers = [helpers.maintainers.AndresBermeoMarinelli];
|
||||
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
|
||||
|
||||
settingsOptions = {
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable transparent background.
|
||||
'';
|
||||
settingsOptions = {
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable transparent background.
|
||||
'';
|
||||
|
||||
italic_comments = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable italics comments.
|
||||
'';
|
||||
italic_comments = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable italics comments.
|
||||
'';
|
||||
|
||||
hide_fillchars = helpers.defaultNullOpts.mkBool false ''
|
||||
Replace all fillchars with ' ' for the ultimate clean look.
|
||||
'';
|
||||
hide_fillchars = helpers.defaultNullOpts.mkBool false ''
|
||||
Replace all fillchars with ' ' for the ultimate clean look.
|
||||
'';
|
||||
|
||||
borderless_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
Modern borderless telescope theme.
|
||||
'';
|
||||
borderless_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
Modern borderless telescope theme.
|
||||
'';
|
||||
|
||||
terminal_colors = helpers.defaultNullOpts.mkBool true ''
|
||||
Set terminal colors used in `:terminal`.
|
||||
'';
|
||||
terminal_colors = helpers.defaultNullOpts.mkBool true ''
|
||||
Set terminal colors used in `:terminal`.
|
||||
'';
|
||||
|
||||
theme = {
|
||||
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
|
||||
Highlight groups to override, adding new groups is also possible.
|
||||
See `:h highlight-groups` for a list of highlight groups.
|
||||
theme = {
|
||||
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
|
||||
Highlight groups to override, adding new groups is also possible.
|
||||
See `:h highlight-groups` for a list of highlight groups.
|
||||
|
||||
Example:
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
Comment = {
|
||||
fg = "#696969";
|
||||
bg = "NONE";
|
||||
italic = true;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Complete list can be found in `lua/cyberdream/theme.lua` in upstream repository.
|
||||
'';
|
||||
|
||||
colors = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Override the default colors used.
|
||||
|
||||
For a full list of colors, see upstream documentation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
transparent = true;
|
||||
italic_comments = true;
|
||||
hide_fillchars = true;
|
||||
borderless_telescope = true;
|
||||
terminal_colors = true;
|
||||
|
||||
theme = {
|
||||
highlights = {
|
||||
```nix
|
||||
{
|
||||
Comment = {
|
||||
fg = "#696969";
|
||||
bg = "NONE";
|
||||
italic = true;
|
||||
};
|
||||
};
|
||||
colors = {
|
||||
bg = "#000000";
|
||||
green = "#00ff00";
|
||||
magenta = "#ff00ff";
|
||||
}
|
||||
```
|
||||
|
||||
Complete list can be found in `lua/cyberdream/theme.lua` in upstream repository.
|
||||
'';
|
||||
|
||||
colors = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Override the default colors used.
|
||||
|
||||
For a full list of colors, see upstream documentation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
transparent = true;
|
||||
italic_comments = true;
|
||||
hide_fillchars = true;
|
||||
borderless_telescope = true;
|
||||
terminal_colors = true;
|
||||
|
||||
theme = {
|
||||
highlights = {
|
||||
Comment = {
|
||||
fg = "#696969";
|
||||
bg = "NONE";
|
||||
italic = true;
|
||||
};
|
||||
};
|
||||
colors = {
|
||||
bg = "#000000";
|
||||
green = "#00ff00";
|
||||
magenta = "#ff00ff";
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.colorschemes.dracula;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
colorschemes.dracula = {
|
||||
enable = mkEnableOption "dracula";
|
||||
|
@ -63,7 +65,7 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "dracula";
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
globals = {
|
||||
dracula_bold = mkIf (!cfg.bold) 0;
|
||||
|
|
|
@ -11,41 +11,43 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
|||
originalName = "gruvbox.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.gruvbox-nvim;
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# Introduced January 31 2024
|
||||
# TODO remove in early March 2024.
|
||||
imports =
|
||||
map
|
||||
(
|
||||
optionName:
|
||||
lib.mkRemovedOptionModule
|
||||
["colorschemes" "gruvbox" optionName]
|
||||
"Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
|
||||
)
|
||||
[
|
||||
"italics"
|
||||
"bold"
|
||||
"underline"
|
||||
"undercurl"
|
||||
"contrastDark"
|
||||
"contrastLight"
|
||||
"highlightSearchCursor"
|
||||
"numberColumn"
|
||||
"signColumn"
|
||||
"colorColumn"
|
||||
"vertSplitColor"
|
||||
"italicizeComments"
|
||||
"italicizeStrings"
|
||||
"invertSelection"
|
||||
"invertSigns"
|
||||
"invertIndentGuides"
|
||||
"invertTabline"
|
||||
"improvedStrings"
|
||||
"improvedWarnings"
|
||||
"transparentBg"
|
||||
"trueColor"
|
||||
];
|
||||
(
|
||||
optionName:
|
||||
lib.mkRemovedOptionModule [
|
||||
"colorschemes"
|
||||
"gruvbox"
|
||||
optionName
|
||||
] "Please use `colorschemes.gruvbox.settings.${helpers.toSnakeCase optionName}` instead."
|
||||
)
|
||||
[
|
||||
"italics"
|
||||
"bold"
|
||||
"underline"
|
||||
"undercurl"
|
||||
"contrastDark"
|
||||
"contrastLight"
|
||||
"highlightSearchCursor"
|
||||
"numberColumn"
|
||||
"signColumn"
|
||||
"colorColumn"
|
||||
"vertSplitColor"
|
||||
"italicizeComments"
|
||||
"italicizeStrings"
|
||||
"invertSelection"
|
||||
"invertSigns"
|
||||
"invertIndentGuides"
|
||||
"invertTabline"
|
||||
"improvedStrings"
|
||||
"improvedWarnings"
|
||||
"transparentBg"
|
||||
"trueColor"
|
||||
];
|
||||
|
||||
settingsExample = {
|
||||
terminal_colors = true;
|
||||
|
|
|
@ -6,110 +6,121 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "kanagawa";
|
||||
isColorscheme = true;
|
||||
originalName = "kanagawa.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.kanagawa-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "kanagawa";
|
||||
isColorscheme = true;
|
||||
originalName = "kanagawa.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.kanagawa-nvim;
|
||||
|
||||
description = ''
|
||||
You can select the theme in two ways:
|
||||
- Set `colorschemes.kanagawa.settings.theme` AND explicitly unset `vim.o.background` (i.e. `options.background = ""`).
|
||||
- Set `colorschemes.kanagawa.settings.background` (the active theme will depend on the value of `vim.o.background`).
|
||||
description = ''
|
||||
You can select the theme in two ways:
|
||||
- Set `colorschemes.kanagawa.settings.theme` AND explicitly unset `vim.o.background` (i.e. `options.background = ""`).
|
||||
- Set `colorschemes.kanagawa.settings.background` (the active theme will depend on the value of `vim.o.background`).
|
||||
'';
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-15: remove 2024-05-15
|
||||
deprecateExtraOptions = true;
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"colorschemes"
|
||||
"kanagawa"
|
||||
];
|
||||
in
|
||||
(map
|
||||
(
|
||||
optionPath:
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (
|
||||
basePluginPath ++ [ "settings" ] ++ optionPath
|
||||
)
|
||||
)
|
||||
[
|
||||
[ "compile" ]
|
||||
[ "undercurl" ]
|
||||
[ "commentStyle" ]
|
||||
[ "functionStyle" ]
|
||||
[ "keywordStyle" ]
|
||||
[ "statementStyle" ]
|
||||
[ "typeStyle" ]
|
||||
[ "transparent" ]
|
||||
[ "dimInactive" ]
|
||||
[ "terminalColors" ]
|
||||
[
|
||||
"colors"
|
||||
"palette"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"theme"
|
||||
]
|
||||
[ "theme" ]
|
||||
[
|
||||
"background"
|
||||
"dark"
|
||||
]
|
||||
[
|
||||
"background"
|
||||
"light"
|
||||
]
|
||||
]
|
||||
)
|
||||
++ [
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "overrides" ]) ''
|
||||
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
|
||||
```
|
||||
function(colors)
|
||||
...
|
||||
end
|
||||
```
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
compile = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable compiling the colorscheme.
|
||||
'';
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
undercurl = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable undercurls.
|
||||
'';
|
||||
|
||||
# TODO introduced 2024-03-15: remove 2024-05-15
|
||||
deprecateExtraOptions = true;
|
||||
imports = let
|
||||
basePluginPath = ["colorschemes" "kanagawa"];
|
||||
in
|
||||
(
|
||||
map
|
||||
(
|
||||
optionPath:
|
||||
mkRenamedOptionModule
|
||||
(basePluginPath ++ optionPath)
|
||||
(basePluginPath ++ ["settings"] ++ optionPath)
|
||||
)
|
||||
[
|
||||
["compile"]
|
||||
["undercurl"]
|
||||
["commentStyle"]
|
||||
["functionStyle"]
|
||||
["keywordStyle"]
|
||||
["statementStyle"]
|
||||
["typeStyle"]
|
||||
["transparent"]
|
||||
["dimInactive"]
|
||||
["terminalColors"]
|
||||
["colors" "palette"]
|
||||
["colors" "theme"]
|
||||
["theme"]
|
||||
["background" "dark"]
|
||||
["background" "light"]
|
||||
]
|
||||
)
|
||||
++ [
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(basePluginPath ++ ["overrides"])
|
||||
''
|
||||
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
|
||||
```
|
||||
function(colors)
|
||||
...
|
||||
end
|
||||
```
|
||||
''
|
||||
)
|
||||
];
|
||||
commentStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||
Highlight options for comments.
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
compile = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable compiling the colorscheme.
|
||||
'';
|
||||
functionStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||
Highlight options for functions.
|
||||
'';
|
||||
|
||||
undercurl = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable undercurls.
|
||||
'';
|
||||
keywordStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||
Highlight options for keywords.
|
||||
'';
|
||||
|
||||
commentStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||
Highlight options for comments.
|
||||
'';
|
||||
statementStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{bold = true;}" ''
|
||||
Highlight options for statements.
|
||||
'';
|
||||
|
||||
functionStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||
Highlight options for functions.
|
||||
'';
|
||||
typeStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||
Highlight options for types.
|
||||
'';
|
||||
|
||||
keywordStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||
Highlight options for keywords.
|
||||
'';
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to set a background color.
|
||||
'';
|
||||
|
||||
statementStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{bold = true;}" ''
|
||||
Highlight options for statements.
|
||||
'';
|
||||
dimInactive = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether dim inactive window `:h hl-NormalNC`.
|
||||
'';
|
||||
|
||||
typeStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||
Highlight options for types.
|
||||
'';
|
||||
terminalColors = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, defines `vim.g.terminal_color_{0,17}`.
|
||||
'';
|
||||
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to set a background color.
|
||||
'';
|
||||
|
||||
dimInactive = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether dim inactive window `:h hl-NormalNC`.
|
||||
'';
|
||||
|
||||
terminalColors = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, defines `vim.g.terminal_color_{0,17}`.
|
||||
'';
|
||||
|
||||
colors = {
|
||||
theme =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.attrs
|
||||
colors = {
|
||||
theme =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.attrs
|
||||
''
|
||||
{
|
||||
wave = {};
|
||||
|
@ -145,21 +156,21 @@ with lib;
|
|||
```
|
||||
'';
|
||||
|
||||
palette = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Change all usages of these colors.
|
||||
palette = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Change all usages of these colors.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
sumiInk0 = "#000000";
|
||||
fujiWhite = "#FFFFFF";
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
sumiInk0 = "#000000";
|
||||
fujiWhite = "#FFFFFF";
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
overrides =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
overrides =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(colors)
|
||||
return {}
|
||||
|
@ -189,41 +200,41 @@ with lib;
|
|||
```
|
||||
'';
|
||||
|
||||
theme = helpers.defaultNullOpts.mkStr "wave" ''
|
||||
The theme to load when background is not set.
|
||||
theme = helpers.defaultNullOpts.mkStr "wave" ''
|
||||
The theme to load when background is not set.
|
||||
'';
|
||||
|
||||
background = {
|
||||
light = helpers.defaultNullOpts.mkStr "lotus" ''
|
||||
The theme to use when `vim.o.background = "light"`.
|
||||
'';
|
||||
|
||||
background = {
|
||||
light = helpers.defaultNullOpts.mkStr "lotus" ''
|
||||
The theme to use when `vim.o.background = "light"`.
|
||||
'';
|
||||
dark = helpers.defaultNullOpts.mkStr "wave" ''
|
||||
The theme to use when `vim.o.background = "dark"`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
dark = helpers.defaultNullOpts.mkStr "wave" ''
|
||||
The theme to use when `vim.o.background = "dark"`.
|
||||
'';
|
||||
settingsExample = {
|
||||
compile = false;
|
||||
undercurl = true;
|
||||
commentStyle.italic = true;
|
||||
functionStyle = { };
|
||||
transparent = false;
|
||||
dimInactive = false;
|
||||
terminalColors = true;
|
||||
colors = {
|
||||
theme = {
|
||||
wave.ui.float.bg = "none";
|
||||
dragon.syn.parameter = "yellow";
|
||||
all.ui.bg_gutter = "none";
|
||||
};
|
||||
palette = {
|
||||
sumiInk0 = "#000000";
|
||||
fujiWhite = "#FFFFFF";
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
compile = false;
|
||||
undercurl = true;
|
||||
commentStyle.italic = true;
|
||||
functionStyle = {};
|
||||
transparent = false;
|
||||
dimInactive = false;
|
||||
terminalColors = true;
|
||||
colors = {
|
||||
theme = {
|
||||
wave.ui.float.bg = "none";
|
||||
dragon.syn.parameter = "yellow";
|
||||
all.ui.bg_gutter = "none";
|
||||
};
|
||||
palette = {
|
||||
sumiInk0 = "#000000";
|
||||
fujiWhite = "#FFFFFF";
|
||||
};
|
||||
};
|
||||
overrides = "function(colors) return {} end";
|
||||
theme = "wave";
|
||||
};
|
||||
}
|
||||
overrides = "function(colors) return {} end";
|
||||
theme = "wave";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "melange";
|
||||
isColorscheme = true;
|
||||
originalName = "melange-nvim";
|
||||
defaultPackage = pkgs.vimPlugins.melange-nvim;
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "melange";
|
||||
isColorscheme = true;
|
||||
originalName = "melange-nvim";
|
||||
defaultPackage = pkgs.vimPlugins.melange-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
}
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
defaultPackage = pkgs.vimPlugins.nord-nvim;
|
||||
globalPrefix = "nord_";
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-20: remove 2024-04-20
|
||||
deprecateExtraConfig = true;
|
||||
|
|
|
@ -12,7 +12,7 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
defaultPackage = pkgs.vimPlugins.vim-one;
|
||||
globalPrefix = "one_";
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
allow_italics = helpers.defaultNullOpts.mkBool false ''
|
||||
|
@ -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; };
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
|||
originalName = "onedark.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.onedark-nvim;
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
settingsExample = {
|
||||
colors = {
|
||||
|
|
|
@ -11,9 +11,7 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
originalName = "oxocarbon.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.oxocarbon-nvim;
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = lib.mkDefault true;
|
||||
};
|
||||
extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -6,70 +6,67 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "palette";
|
||||
isColorscheme = true;
|
||||
originalName = "palette.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.palette-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "palette";
|
||||
isColorscheme = true;
|
||||
originalName = "palette.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.palette-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraPlugins = [
|
||||
# Annoyingly, lspconfig is required, otherwise this line is breaking:
|
||||
# https://github.com/roobert/palette.nvim/blob/a808c190a4f74f73782302152ebf323660d8db5f/lua/palette/init.lua#L45
|
||||
# An issue has been opened upstream to warn the maintainer: https://github.com/roobert/palette.nvim/issues/2
|
||||
pkgs.vimPlugins.nvim-lspconfig
|
||||
];
|
||||
extraPlugins = [
|
||||
# Annoyingly, lspconfig is required, otherwise this line is breaking:
|
||||
# https://github.com/roobert/palette.nvim/blob/a808c190a4f74f73782302152ebf323660d8db5f/lua/palette/init.lua#L45
|
||||
# An issue has been opened upstream to warn the maintainer: https://github.com/roobert/palette.nvim/issues/2
|
||||
pkgs.vimPlugins.nvim-lspconfig
|
||||
];
|
||||
|
||||
# TODO introduced 2024-04-07: remove 2024-06-07
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"palettes"
|
||||
"customPalettes"
|
||||
"italics"
|
||||
"transparentBackground"
|
||||
"caching"
|
||||
"cacheDir"
|
||||
];
|
||||
# TODO introduced 2024-04-07: remove 2024-06-07
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"palettes"
|
||||
"customPalettes"
|
||||
"italics"
|
||||
"transparentBackground"
|
||||
"caching"
|
||||
"cacheDir"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
palettes = {
|
||||
main = helpers.defaultNullOpts.mkStr "dark" ''
|
||||
Palette for the main colors.
|
||||
'';
|
||||
settingsOptions = {
|
||||
palettes = {
|
||||
main = helpers.defaultNullOpts.mkStr "dark" ''
|
||||
Palette for the main colors.
|
||||
'';
|
||||
|
||||
accent = helpers.defaultNullOpts.mkStr "pastel" ''
|
||||
Palette for the accent colors.
|
||||
'';
|
||||
accent = helpers.defaultNullOpts.mkStr "pastel" ''
|
||||
Palette for the accent colors.
|
||||
'';
|
||||
|
||||
state = helpers.defaultNullOpts.mkStr "pastel" ''
|
||||
Palette for the state colors.
|
||||
'';
|
||||
};
|
||||
state = helpers.defaultNullOpts.mkStr "pastel" ''
|
||||
Palette for the state colors.
|
||||
'';
|
||||
};
|
||||
|
||||
customPalettes =
|
||||
mapAttrs
|
||||
customPalettes =
|
||||
mapAttrs
|
||||
(
|
||||
name: colorNames:
|
||||
helpers.defaultNullOpts.mkAttrsOf (
|
||||
types.submodule {
|
||||
options =
|
||||
genAttrs
|
||||
colorNames
|
||||
(
|
||||
colorName:
|
||||
mkOption {
|
||||
type = types.str;
|
||||
description = "Definition of color '${colorName}'";
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
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"
|
||||
|
@ -101,35 +98,35 @@ with lib;
|
|||
];
|
||||
};
|
||||
|
||||
italics = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to use italics.
|
||||
'';
|
||||
italics = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to use italics.
|
||||
'';
|
||||
|
||||
transparent_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to use transparent background.
|
||||
'';
|
||||
transparent_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to use transparent background.
|
||||
'';
|
||||
|
||||
caching = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable caching.
|
||||
'';
|
||||
caching = helpers.defaultNullOpts.mkBool true ''
|
||||
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 = {};
|
||||
settingsExample = { };
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions =
|
||||
mapAttrsToList (
|
||||
name: defaultPaletteNames: let
|
||||
extraConfig = cfg: {
|
||||
assertions =
|
||||
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"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,68 +6,68 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "poimandres";
|
||||
isColorscheme = true;
|
||||
originalName = "poimandres.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.poimandres-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "poimandres";
|
||||
isColorscheme = true;
|
||||
originalName = "poimandres.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.poimandres-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"boldVertSplit"
|
||||
"darkVariant"
|
||||
"disableBackground"
|
||||
"disableFloatBackground"
|
||||
"disableItalics"
|
||||
"dimNcBackground"
|
||||
"groups"
|
||||
"highlightGroups"
|
||||
];
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"boldVertSplit"
|
||||
"darkVariant"
|
||||
"disableBackground"
|
||||
"disableFloatBackground"
|
||||
"disableItalics"
|
||||
"dimNcBackground"
|
||||
"groups"
|
||||
"highlightGroups"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
bold_vert_split = helpers.defaultNullOpts.mkBool false ''
|
||||
Use bold vertical separators.
|
||||
'';
|
||||
settingsOptions = {
|
||||
bold_vert_split = helpers.defaultNullOpts.mkBool false ''
|
||||
Use bold vertical separators.
|
||||
'';
|
||||
|
||||
dim_nc_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Dim 'non-current' window backgrounds.
|
||||
'';
|
||||
dim_nc_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Dim 'non-current' window backgrounds.
|
||||
'';
|
||||
|
||||
disable_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the background.
|
||||
'';
|
||||
disable_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the background.
|
||||
'';
|
||||
|
||||
disable_float_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the background for floats.
|
||||
'';
|
||||
disable_float_background = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the background for floats.
|
||||
'';
|
||||
|
||||
disable_italics = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable italics.
|
||||
'';
|
||||
disable_italics = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable italics.
|
||||
'';
|
||||
|
||||
dark_variant = helpers.defaultNullOpts.mkStr "main" ''
|
||||
Dark variant.
|
||||
'';
|
||||
dark_variant = helpers.defaultNullOpts.mkStr "main" ''
|
||||
Dark variant.
|
||||
'';
|
||||
|
||||
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
||||
Which color to use for each group.
|
||||
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
||||
Which color to use for each group.
|
||||
|
||||
default: see [source](https://github.com/olivercederborg/poimandres.nvim/blob/main/lua/poimandres/init.lua)
|
||||
'';
|
||||
default: see [source](https://github.com/olivercederborg/poimandres.nvim/blob/main/lua/poimandres/init.lua)
|
||||
'';
|
||||
|
||||
highlight_groups = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Highlight groups.
|
||||
'';
|
||||
};
|
||||
highlight_groups = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||
Highlight groups.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
bold_vert_split = false;
|
||||
dim_nc_background = true;
|
||||
disable_background = false;
|
||||
disable_float_background = false;
|
||||
disable_italics = true;
|
||||
};
|
||||
}
|
||||
settingsExample = {
|
||||
bold_vert_split = false;
|
||||
dim_nc_background = true;
|
||||
disable_background = false;
|
||||
disable_float_background = false;
|
||||
disable_italics = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,136 +6,155 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "rose-pine";
|
||||
isColorscheme = true;
|
||||
defaultPackage = pkgs.vimPlugins.rose-pine;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "rose-pine";
|
||||
isColorscheme = true;
|
||||
defaultPackage = pkgs.vimPlugins.rose-pine;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
optionsRenamedToSettings = [
|
||||
"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"])
|
||||
)
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
optionsRenamedToSettings = [
|
||||
"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"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
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.
|
||||
'';
|
||||
settingsOptions = {
|
||||
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"] ''
|
||||
Set the desired dark variant when `settings.variant` is set to "auto".
|
||||
'';
|
||||
dark_variant =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"main"
|
||||
"moon"
|
||||
"dawn"
|
||||
]
|
||||
''
|
||||
Set the desired dark variant when `settings.variant` is set to "auto".
|
||||
'';
|
||||
|
||||
dim_inactive_windows = helpers.defaultNullOpts.mkBool false ''
|
||||
Differentiate between active and inactive windows and panels.
|
||||
'';
|
||||
dim_inactive_windows = helpers.defaultNullOpts.mkBool false ''
|
||||
Differentiate between active and inactive windows and panels.
|
||||
'';
|
||||
|
||||
extend_background_behind_borders = helpers.defaultNullOpts.mkBool true ''
|
||||
Extend background behind borders.
|
||||
Appearance differs based on which border characters you are using.
|
||||
'';
|
||||
extend_background_behind_borders = helpers.defaultNullOpts.mkBool true ''
|
||||
Extend background behind borders.
|
||||
Appearance differs based on which border characters you are using.
|
||||
'';
|
||||
|
||||
enable = {
|
||||
legacy_highlights = helpers.defaultNullOpts.mkBool true "Enable legacy highlights.";
|
||||
enable = {
|
||||
legacy_highlights = helpers.defaultNullOpts.mkBool true "Enable legacy highlights.";
|
||||
|
||||
migrations = helpers.defaultNullOpts.mkBool true "Enable migrations.";
|
||||
migrations = helpers.defaultNullOpts.mkBool true "Enable migrations.";
|
||||
|
||||
terminal = helpers.defaultNullOpts.mkBool true "Enable terminal.";
|
||||
};
|
||||
|
||||
styles = {
|
||||
bold = helpers.defaultNullOpts.mkBool true "Enable bold.";
|
||||
|
||||
italic = helpers.defaultNullOpts.mkBool true "Enable italic.";
|
||||
|
||||
transparency = helpers.defaultNullOpts.mkBool true "Enable transparency.";
|
||||
};
|
||||
|
||||
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
||||
Highlight groups.
|
||||
|
||||
default: see [source](https://github.com/rose-pine/neovim/blob/main/lua/rose-pine/config.lua)
|
||||
'';
|
||||
|
||||
highlight_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
|
||||
Custom highlight groups.
|
||||
'';
|
||||
|
||||
before_highlight = helpers.defaultNullOpts.mkLuaFn "function(group, highlight, palette) end" ''
|
||||
Called before each highlight group, before setting the highlight.
|
||||
|
||||
`function(group, highlight, palette)`
|
||||
|
||||
```lua
|
||||
@param group string
|
||||
@param highlight Highlight
|
||||
@param palette Palette
|
||||
```
|
||||
'';
|
||||
terminal = helpers.defaultNullOpts.mkBool true "Enable terminal.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
variant = "auto";
|
||||
dark_variant = "moon";
|
||||
dim_inactive_windows = true;
|
||||
extend_background_behind_borders = true;
|
||||
enable = {
|
||||
legacy_highlights = false;
|
||||
migrations = true;
|
||||
terminal = false;
|
||||
};
|
||||
styles = {
|
||||
bold = false;
|
||||
italic = true;
|
||||
transparency = true;
|
||||
};
|
||||
groups = {
|
||||
border = "muted";
|
||||
link = "iris";
|
||||
panel = "surface";
|
||||
};
|
||||
highlight_groups = {};
|
||||
before_highlight = "function(group, highlight, palette) end";
|
||||
styles = {
|
||||
bold = helpers.defaultNullOpts.mkBool true "Enable bold.";
|
||||
|
||||
italic = helpers.defaultNullOpts.mkBool true "Enable italic.";
|
||||
|
||||
transparency = helpers.defaultNullOpts.mkBool true "Enable transparency.";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
||||
Highlight groups.
|
||||
|
||||
default: see [source](https://github.com/rose-pine/neovim/blob/main/lua/rose-pine/config.lua)
|
||||
'';
|
||||
|
||||
highlight_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
|
||||
Custom highlight groups.
|
||||
'';
|
||||
|
||||
before_highlight = helpers.defaultNullOpts.mkLuaFn "function(group, highlight, palette) end" ''
|
||||
Called before each highlight group, before setting the highlight.
|
||||
|
||||
`function(group, highlight, palette)`
|
||||
|
||||
```lua
|
||||
@param group string
|
||||
@param highlight Highlight
|
||||
@param palette Palette
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
variant = "auto";
|
||||
dark_variant = "moon";
|
||||
dim_inactive_windows = true;
|
||||
extend_background_behind_borders = true;
|
||||
enable = {
|
||||
legacy_highlights = false;
|
||||
migrations = true;
|
||||
terminal = false;
|
||||
};
|
||||
}
|
||||
styles = {
|
||||
bold = false;
|
||||
italic = true;
|
||||
transparency = true;
|
||||
};
|
||||
groups = {
|
||||
border = "muted";
|
||||
link = "iris";
|
||||
panel = "surface";
|
||||
};
|
||||
highlight_groups = { };
|
||||
before_highlight = "function(group, highlight, palette) end";
|
||||
};
|
||||
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -6,56 +6,87 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "tokyonight";
|
||||
isColorscheme = true;
|
||||
originalName = "tokyonight.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.tokyonight-nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "tokyonight";
|
||||
isColorscheme = true;
|
||||
originalName = "tokyonight.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.tokyonight-nvim;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
optionsRenamedToSettings = [
|
||||
"style"
|
||||
"transparent"
|
||||
"terminalColors"
|
||||
["styles" "comments"]
|
||||
["styles" "keywords"]
|
||||
["styles" "functions"]
|
||||
["styles" "variables"]
|
||||
["styles" "sidebars"]
|
||||
["styles" "floats"]
|
||||
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||
optionsRenamedToSettings = [
|
||||
"style"
|
||||
"transparent"
|
||||
"terminalColors"
|
||||
[
|
||||
"styles"
|
||||
"comments"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"keywords"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"functions"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"variables"
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"sidebars"
|
||||
"dayBrightness"
|
||||
"hideInactiveStatusline"
|
||||
"dimInactive"
|
||||
"lualineBold"
|
||||
"onColors"
|
||||
"onHighlights"
|
||||
];
|
||||
]
|
||||
[
|
||||
"styles"
|
||||
"floats"
|
||||
]
|
||||
"sidebars"
|
||||
"dayBrightness"
|
||||
"hideInactiveStatusline"
|
||||
"dimInactive"
|
||||
"lualineBold"
|
||||
"onColors"
|
||||
"onHighlights"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
style = helpers.defaultNullOpts.mkEnumFirstDefault ["storm" "night" "day"] ''
|
||||
The theme comes in three styles, `storm`, a darker variant `night` and `day`.
|
||||
'';
|
||||
settingsOptions = {
|
||||
style =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"storm"
|
||||
"night"
|
||||
"day"
|
||||
]
|
||||
''
|
||||
The theme comes in three styles, `storm`, a darker variant `night` and `day`.
|
||||
'';
|
||||
|
||||
light_style = helpers.defaultNullOpts.mkStr "day" ''
|
||||
The theme to use when the background is set to `light`.
|
||||
'';
|
||||
light_style = helpers.defaultNullOpts.mkStr "day" ''
|
||||
The theme to use when the background is set to `light`.
|
||||
'';
|
||||
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable setting the background color.
|
||||
'';
|
||||
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable setting the background color.
|
||||
'';
|
||||
|
||||
terminal_colors = helpers.defaultNullOpts.mkBool true ''
|
||||
Configure the colors used when opening a :terminal in Neovim
|
||||
'';
|
||||
terminal_colors = helpers.defaultNullOpts.mkBool true ''
|
||||
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.
|
||||
'';
|
||||
|
@ -77,65 +108,68 @@ with lib;
|
|||
floats = mkBackgroundStyle "floats";
|
||||
};
|
||||
|
||||
sidebars = helpers.defaultNullOpts.mkListOf types.str ''["qf" "help"]'' ''
|
||||
Set a darker background on sidebar-like windows.
|
||||
'';
|
||||
sidebars = helpers.defaultNullOpts.mkListOf types.str ''["qf" "help"]'' ''
|
||||
Set a darker background on sidebar-like windows.
|
||||
'';
|
||||
|
||||
day_brightness = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3" ''
|
||||
Adjusts the brightness of the colors of the **Day** style.
|
||||
Number between 0 and 1, from dull to vibrant colors.
|
||||
'';
|
||||
day_brightness = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3" ''
|
||||
Adjusts the brightness of the colors of the **Day** style.
|
||||
Number between 0 and 1, from dull to vibrant colors.
|
||||
'';
|
||||
|
||||
hide_inactive_statusline = helpers.defaultNullOpts.mkBool false ''
|
||||
Enabling this option will hide inactive statuslines and replace them with a thin border instead.
|
||||
Should work with the standard **StatusLine** and **LuaLine**.
|
||||
'';
|
||||
hide_inactive_statusline = helpers.defaultNullOpts.mkBool false ''
|
||||
Enabling this option will hide inactive statuslines and replace them with a thin border instead.
|
||||
Should work with the standard **StatusLine** and **LuaLine**.
|
||||
'';
|
||||
|
||||
dim_inactive = helpers.defaultNullOpts.mkBool false ''
|
||||
Dims inactive windows.
|
||||
'';
|
||||
dim_inactive = helpers.defaultNullOpts.mkBool false ''
|
||||
Dims inactive windows.
|
||||
'';
|
||||
|
||||
lualine_bold = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, section headers in the lualine theme will be bold.
|
||||
'';
|
||||
lualine_bold = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, section headers in the lualine theme will be bold.
|
||||
'';
|
||||
|
||||
on_colors = helpers.defaultNullOpts.mkLuaFn "function(colors) end" ''
|
||||
Override specific color groups to use other groups or a hex color.
|
||||
Function will be called with a `ColorScheme` table.
|
||||
`@param colors ColorScheme`
|
||||
'';
|
||||
on_colors = helpers.defaultNullOpts.mkLuaFn "function(colors) end" ''
|
||||
Override specific color groups to use other groups or a hex color.
|
||||
Function will be called with a `ColorScheme` table.
|
||||
`@param colors ColorScheme`
|
||||
'';
|
||||
|
||||
on_highlights = helpers.defaultNullOpts.mkLuaFn "function(highlights, colors) end" ''
|
||||
Override specific highlights to use other groups or a hex color.
|
||||
Function will be called with a `Highlights` and `ColorScheme` table.
|
||||
`@param highlights Highlights`
|
||||
`@param colors ColorScheme`
|
||||
'';
|
||||
on_highlights = helpers.defaultNullOpts.mkLuaFn "function(highlights, colors) end" ''
|
||||
Override specific highlights to use other groups or a hex color.
|
||||
Function will be called with a `Highlights` and `ColorScheme` table.
|
||||
`@param highlights Highlights`
|
||||
`@param colors ColorScheme`
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
style = "storm";
|
||||
light_style = "day";
|
||||
transparent = false;
|
||||
terminal_colors = true;
|
||||
styles = {
|
||||
comments.italic = true;
|
||||
keywords.italic = true;
|
||||
functions = { };
|
||||
variables = { };
|
||||
sidebars = "dark";
|
||||
floats = "dark";
|
||||
};
|
||||
sidebars = [
|
||||
"qf"
|
||||
"vista_kind"
|
||||
"terminal"
|
||||
"packer"
|
||||
];
|
||||
day_brightness = 0.3;
|
||||
hide_inactive_statusline = false;
|
||||
dim_inactive = false;
|
||||
lualine_bold = false;
|
||||
on_colors = "function(colors) end";
|
||||
on_highlights = "function(highlights, colors) end";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
style = "storm";
|
||||
light_style = "day";
|
||||
transparent = false;
|
||||
terminal_colors = true;
|
||||
styles = {
|
||||
comments.italic = true;
|
||||
keywords.italic = true;
|
||||
functions = {};
|
||||
variables = {};
|
||||
sidebars = "dark";
|
||||
floats = "dark";
|
||||
};
|
||||
sidebars = ["qf" "vista_kind" "terminal" "packer"];
|
||||
day_brightness = 0.3;
|
||||
hide_inactive_statusline = false;
|
||||
dim_inactive = false;
|
||||
lualine_bold = false;
|
||||
on_colors = "function(colors) end";
|
||||
on_highlights = "function(highlights, colors) end";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
opts.termguicolors = mkDefault true;
|
||||
};
|
||||
}
|
||||
extraConfig = cfg: { opts.termguicolors = mkDefault true; };
|
||||
}
|
||||
|
|
|
@ -6,42 +6,38 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "vscode";
|
||||
isColorscheme = true;
|
||||
originalName = "vscode-nvim";
|
||||
defaultPackage = pkgs.vimPlugins.vscode-nvim;
|
||||
colorscheme = null; # Color scheme is set by `require.("vscode").load()`
|
||||
callSetup = false;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "vscode";
|
||||
isColorscheme = true;
|
||||
originalName = "vscode-nvim";
|
||||
defaultPackage = pkgs.vimPlugins.vscode-nvim;
|
||||
colorscheme = null; # Color scheme is set by `require.("vscode").load()`
|
||||
callSetup = false;
|
||||
|
||||
maintainers = [maintainers.loicreynier];
|
||||
maintainers = [ maintainers.loicreynier ];
|
||||
|
||||
settingsOptions = {
|
||||
transparent = helpers.defaultNullOpts.mkBool false "Whether to enable transparent background";
|
||||
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
|
||||
"{}"
|
||||
''
|
||||
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
|
||||
"{}"
|
||||
''
|
||||
A dictionary of group names, each associated with a dictionary of parameters
|
||||
(`bg`, `fg`, `sp` and `style`) and colors in hex.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraConfigLuaPre = ''
|
||||
local _vscode = require("vscode")
|
||||
_vscode.setup(${helpers.toLuaObject cfg.settings})
|
||||
_vscode.load()
|
||||
settingsOptions = {
|
||||
transparent = helpers.defaultNullOpts.mkBool false "Whether to enable transparent background";
|
||||
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 "{}" ''
|
||||
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 "{}" ''
|
||||
A dictionary of group names, each associated with a dictionary of parameters
|
||||
(`bg`, `fg`, `sp` and `style`) and colors in hex.
|
||||
'';
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraConfigLuaPre = ''
|
||||
local _vscode = require("vscode")
|
||||
_vscode.setup(${helpers.toLuaObject cfg.settings})
|
||||
_vscode.load()
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,81 +6,61 @@
|
|||
...
|
||||
}:
|
||||
with helpers.vim-plugin;
|
||||
with lib; rec {
|
||||
mkCmpSourcePlugin = {
|
||||
name,
|
||||
extraPlugins ? [],
|
||||
useDefaultPackage ? true,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
rec {
|
||||
mkCmpSourcePlugin =
|
||||
{
|
||||
name,
|
||||
extraPlugins ? [ ],
|
||||
useDefaultPackage ? true,
|
||||
...
|
||||
}:
|
||||
mkVimPlugin config {
|
||||
inherit name;
|
||||
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
};
|
||||
|
||||
extractSourcesFromOptionValue = sources:
|
||||
if isList sources
|
||||
then sources
|
||||
else [];
|
||||
extractSourcesFromOptionValue = sources: if isList sources then sources else [ ];
|
||||
|
||||
autoInstallSourcePluginsModule = cfg: let
|
||||
# cfg.setup.sources
|
||||
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
|
||||
# cfg.filetype.<name>.sources
|
||||
filetypeSources =
|
||||
mapAttrsToList
|
||||
(_: filetypeConfig:
|
||||
extractSourcesFromOptionValue filetypeConfig.sources)
|
||||
cfg.filetype;
|
||||
# cfg.cmdline.<name>.sources
|
||||
cmdlineSources =
|
||||
mapAttrsToList
|
||||
(_: cmdlineConfig:
|
||||
extractSourcesFromOptionValue cmdlineConfig.sources)
|
||||
cfg.cmdline;
|
||||
autoInstallSourcePluginsModule =
|
||||
cfg:
|
||||
let
|
||||
# cfg.setup.sources
|
||||
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
|
||||
# cfg.filetype.<name>.sources
|
||||
filetypeSources = mapAttrsToList (
|
||||
_: filetypeConfig: extractSourcesFromOptionValue filetypeConfig.sources
|
||||
) cfg.filetype;
|
||||
# cfg.cmdline.<name>.sources
|
||||
cmdlineSources = mapAttrsToList (
|
||||
_: cmdlineConfig: extractSourcesFromOptionValue cmdlineConfig.sources
|
||||
) cfg.cmdline;
|
||||
|
||||
# [{name = "foo";} {name = "bar"; x = 42;} ...]
|
||||
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
|
||||
# [{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
|
||||
);
|
||||
# Take only the names from the sources provided by the user
|
||||
# ["foo" "bar"]
|
||||
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: {
|
||||
name = pluginName;
|
||||
value.enable =
|
||||
mkIf
|
||||
(elem sourceName foundSources)
|
||||
true;
|
||||
}
|
||||
)
|
||||
(import ./sources.nix);
|
||||
# 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: {
|
||||
name = pluginName;
|
||||
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())
|
||||
'';
|
||||
};
|
||||
in
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf cfg.autoEnableSources attrsEnabled)
|
||||
lspCapabilities
|
||||
|
|
|
@ -4,42 +4,45 @@
|
|||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ args: let
|
||||
cmpOptions = import ./options {inherit lib helpers;};
|
||||
}@args:
|
||||
let
|
||||
cmpOptions = import ./options { inherit lib helpers; };
|
||||
in
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cmp";
|
||||
originalName = "nvim-cmp";
|
||||
defaultPackage = pkgs.vimPlugins.nvim-cmp;
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cmp";
|
||||
originalName = "nvim-cmp";
|
||||
defaultPackage = pkgs.vimPlugins.nvim-cmp;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# Introduced on 2024 February 21
|
||||
# TODO: remove ~June 2024
|
||||
imports = [
|
||||
./deprecations.nix
|
||||
./sources
|
||||
];
|
||||
deprecateExtraOptions = true;
|
||||
# Introduced on 2024 February 21
|
||||
# TODO: remove ~June 2024
|
||||
imports = [
|
||||
./deprecations.nix
|
||||
./sources
|
||||
];
|
||||
deprecateExtraOptions = true;
|
||||
|
||||
extraOptions = {
|
||||
autoEnableSources = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Scans the sources array and installs the plugins if they are known to nixvim.
|
||||
'';
|
||||
};
|
||||
extraOptions = {
|
||||
autoEnableSources = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Scans the sources array and installs the plugins if they are known to nixvim.
|
||||
'';
|
||||
};
|
||||
|
||||
inherit (cmpOptions) filetype cmdline;
|
||||
};
|
||||
inherit (cmpOptions) filetype cmdline;
|
||||
};
|
||||
|
||||
inherit (cmpOptions) settingsOptions settingsExample;
|
||||
inherit (cmpOptions) settingsOptions settingsExample;
|
||||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
warnings = optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources)) ''
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
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.
|
||||
|
@ -49,35 +52,25 @@ in
|
|||
- Dismiss this warning by explicitly setting `autoEnableSources` to `false`;
|
||||
'';
|
||||
|
||||
extraConfigLua =
|
||||
''
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(${helpers.toLuaObject cfg.settings})
|
||||
extraConfigLua =
|
||||
''
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(${helpers.toLuaObject cfg.settings})
|
||||
|
||||
''
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.filetype
|
||||
)
|
||||
)
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.cmdline
|
||||
)
|
||||
);
|
||||
''
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
|
||||
) cfg.filetype
|
||||
))
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
|
||||
) cfg.cmdline
|
||||
));
|
||||
|
||||
# If autoEnableSources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
|
||||
};
|
||||
}
|
||||
# If autoEnableSources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,164 +1,360 @@
|
|||
{lib, ...}:
|
||||
with lib; let
|
||||
oldPluginBasePath = ["plugins" "nvim-cmp"];
|
||||
newPluginBasePath = ["plugins" "cmp"];
|
||||
settingsPath = newPluginBasePath ++ ["settings"];
|
||||
{ lib, ... }:
|
||||
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 = ["mapping"];}
|
||||
{
|
||||
old = ["completion" "keywordLength"];
|
||||
new = ["completion" "keyword_length"];
|
||||
old = [
|
||||
"performance"
|
||||
"fetchingTimeout"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"fetching_timeout"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["completion" "keywordPattern"];
|
||||
new = ["completion" "keyword_pattern"];
|
||||
}
|
||||
{old = ["completion" "autocomplete"];}
|
||||
{old = ["completion" "completeopt"];}
|
||||
{
|
||||
old = ["confirmation" "getCommitCharacters"];
|
||||
new = ["confirmation" "get_commit_characters"];
|
||||
old = [
|
||||
"performance"
|
||||
"asyncBudget"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"async_budget"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["formatting" "expandableIndicator"];
|
||||
new = ["formatting" "expandable_indicator"];
|
||||
old = [
|
||||
"performance"
|
||||
"maxViewEntries"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"max_view_entries"
|
||||
];
|
||||
}
|
||||
{old = ["formatting" "fields"];}
|
||||
{old = ["formatting" "format"];}
|
||||
{ old = [ "mapping" ]; }
|
||||
{
|
||||
old = ["matching" "disallowFuzzyMatching"];
|
||||
new = ["matching" "disallow_fuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordLength"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_length"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowFullfuzzyMatching"];
|
||||
new = ["matching" "disallow_fullfuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordPattern"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_pattern"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialFuzzyMatching"];
|
||||
new = ["matching" "disallow_partial_fuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"autocomplete"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialMatching"];
|
||||
new = ["matching" "disallow_partial_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"completeopt"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPrefixUnmatching"];
|
||||
new = ["matching" "disallow_prefix_unmatching"];
|
||||
old = [
|
||||
"confirmation"
|
||||
"getCommitCharacters"
|
||||
];
|
||||
new = [
|
||||
"confirmation"
|
||||
"get_commit_characters"
|
||||
];
|
||||
}
|
||||
{
|
||||
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"
|
||||
"expandableIndicator"
|
||||
];
|
||||
new = [
|
||||
"formatting"
|
||||
"expandable_indicator"
|
||||
];
|
||||
}
|
||||
{
|
||||
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 = [
|
||||
"formatting"
|
||||
"fields"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["window" "documentation" "maxHeight"];
|
||||
new = ["window" "documentation" "max_height"];
|
||||
old = [
|
||||
"formatting"
|
||||
"format"
|
||||
];
|
||||
}
|
||||
{old = ["experimental"];}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowFuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_fuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
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
|
||||
(
|
||||
rename:
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ rename.old)
|
||||
(settingsPath ++ (rename.new or rename.old))
|
||||
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" ]) ''
|
||||
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" ])
|
||||
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
|
||||
)
|
||||
renamedOptions;
|
||||
in {
|
||||
imports =
|
||||
renameWarnings
|
||||
++ [
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["enable"])
|
||||
(newPluginBasePath ++ ["enable"])
|
||||
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:
|
||||
```
|
||||
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
```
|
||||
''
|
||||
)
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["autoEnableSources"])
|
||||
(newPluginBasePath ++ ["autoEnableSources"])
|
||||
oldPluginBasePath
|
||||
++ [
|
||||
"sorting"
|
||||
"comparators"
|
||||
]
|
||||
)
|
||||
(
|
||||
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"])
|
||||
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(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:
|
||||
```
|
||||
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
```
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(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"])
|
||||
''
|
||||
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.
|
||||
''
|
||||
)
|
||||
];
|
||||
''
|
||||
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" ]) ''
|
||||
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,9 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
settingsOptions = import ./settings-options.nix {inherit lib helpers;};
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
|
||||
|
||||
settingsExample = {
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
|
@ -29,46 +27,44 @@ with lib; rec {
|
|||
'';
|
||||
};
|
||||
|
||||
attrsOfOptions = with types;
|
||||
attrsOf (
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = settingsOptions;
|
||||
}
|
||||
);
|
||||
attrsOfOptions =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = settingsOptions;
|
||||
});
|
||||
|
||||
filetype = mkOption {
|
||||
type = attrsOfOptions;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Options for `cmp.filetype()`.";
|
||||
example = {
|
||||
python = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
];
|
||||
sources = [ { name = "nvim_lsp"; } ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
type = attrsOfOptions;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Options for `cmp.cmdline()`.";
|
||||
example = {
|
||||
"/" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "buffer";}
|
||||
];
|
||||
sources = [ { name = "buffer"; } ];
|
||||
};
|
||||
":" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{ name = "path"; }
|
||||
{
|
||||
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.
|
||||
|
@ -39,16 +37,16 @@ with lib; {
|
|||
'';
|
||||
|
||||
mapping = mkOption {
|
||||
default = {};
|
||||
type = with helpers.nixvimTypes;
|
||||
maybeRaw
|
||||
(attrsOf strLua);
|
||||
apply = v:
|
||||
# Handle the raw case first
|
||||
if helpers.nixvimTypes.isRawType v
|
||||
then v
|
||||
default = { };
|
||||
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua);
|
||||
apply =
|
||||
v:
|
||||
# Handle the raw case first
|
||||
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,24 +108,16 @@ 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)
|
||||
)
|
||||
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
|
||||
''
|
||||
The event to trigger autocompletion.
|
||||
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
|
||||
'';
|
||||
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
|
||||
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
|
||||
''
|
||||
The event to trigger autocompletion.
|
||||
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
|
||||
'';
|
||||
|
||||
completeopt = helpers.defaultNullOpts.mkStr "menu,menuone,noselect" ''
|
||||
Like vim's completeopt setting.
|
||||
|
@ -138,15 +128,15 @@ with lib; {
|
|||
confirmation = {
|
||||
get_commit_characters =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(commit_characters)
|
||||
return commit_characters
|
||||
end
|
||||
''
|
||||
''
|
||||
You can append or exclude `commitCharacters` via this configuration option function.
|
||||
The `commitCharacters` are defined by the LSP spec.
|
||||
'';
|
||||
''
|
||||
function(commit_characters)
|
||||
return commit_characters
|
||||
end
|
||||
''
|
||||
''
|
||||
You can append or exclude `commitCharacters` via this configuration option function.
|
||||
The `commitCharacters` are defined by the LSP spec.
|
||||
'';
|
||||
};
|
||||
|
||||
formatting = {
|
||||
|
@ -160,21 +150,21 @@ with lib; {
|
|||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(_, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
''
|
||||
''
|
||||
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
|
||||
''
|
||||
function(_, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
''
|
||||
''
|
||||
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
|
||||
|
||||
The function used to customize the appearance of the completion menu.
|
||||
See `|complete-items|`.
|
||||
This value can also be used to modify the `dup` property.
|
||||
The function used to customize the appearance of the completion menu.
|
||||
See `|complete-items|`.
|
||||
This value can also be used to modify the `dup` property.
|
||||
|
||||
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
|
||||
`kind_hl_group` and `menu_hl_group`.
|
||||
'';
|
||||
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
|
||||
`kind_hl_group` and `menu_hl_group`.
|
||||
'';
|
||||
};
|
||||
|
||||
matching = {
|
||||
|
@ -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.
|
||||
|
@ -240,26 +225,20 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
sources = import ./sources-option.nix {inherit lib helpers;};
|
||||
sources = import ./sources-option.nix { inherit lib helpers; };
|
||||
|
||||
view = {
|
||||
entries =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
str
|
||||
(attrsOf anything)
|
||||
)
|
||||
''
|
||||
{
|
||||
name = "custom";
|
||||
selection_order = "top_down";
|
||||
}
|
||||
''
|
||||
''
|
||||
The view class used to customize nvim-cmp's appearance.
|
||||
'';
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
||||
''
|
||||
{
|
||||
name = "custom";
|
||||
selection_order = "top_down";
|
||||
}
|
||||
''
|
||||
''
|
||||
The view class used to customize nvim-cmp's appearance.
|
||||
'';
|
||||
|
||||
docs = {
|
||||
auto_open = helpers.defaultNullOpts.mkBool true ''
|
||||
|
@ -268,79 +247,71 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
window = let
|
||||
mkWinhighlightOption = default:
|
||||
helpers.defaultNullOpts.mkStr
|
||||
default
|
||||
''
|
||||
Specify the window's winhighlight option.
|
||||
window =
|
||||
let
|
||||
mkWinhighlightOption =
|
||||
default:
|
||||
helpers.defaultNullOpts.mkStr default ''
|
||||
Specify the window's winhighlight option.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
|
||||
zindex = helpers.mkNullOrOption types.ints.unsigned ''
|
||||
The window's zindex.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
in
|
||||
{
|
||||
completion = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
|
||||
"";
|
||||
|
||||
zindex = helpers.mkNullOrOption types.ints.unsigned ''
|
||||
The window's zindex.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
in {
|
||||
completion = {
|
||||
border =
|
||||
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;
|
||||
|
||||
inherit zindex;
|
||||
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Specify the window's scrolloff option.
|
||||
See |'scrolloff'|.
|
||||
'';
|
||||
|
||||
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Specify the window's scrolloff option.
|
||||
See |'scrolloff'|.
|
||||
'';
|
||||
col_offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offsets the completion window relative to the cursor.
|
||||
'';
|
||||
|
||||
col_offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offsets the completion window relative to the cursor.
|
||||
'';
|
||||
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
|
||||
The amount of padding to add on the completion window's sides.
|
||||
'';
|
||||
|
||||
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
|
||||
The amount of padding to add on the completion window's sides.
|
||||
'';
|
||||
scrollbar = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the scrollbar should be enabled if there are more items that fit.
|
||||
'';
|
||||
};
|
||||
|
||||
scrollbar = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the scrollbar should be enabled if there are more items that fit.
|
||||
'';
|
||||
};
|
||||
documentation = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
|
||||
"nvim-cmp documentation popup menu"
|
||||
"";
|
||||
|
||||
documentation = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder
|
||||
''[ "" "" "" " " "" "" "" " " ]''
|
||||
"nvim-cmp documentation popup menu"
|
||||
"";
|
||||
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
||||
|
||||
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
||||
inherit zindex;
|
||||
|
||||
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))"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# This can be kept as types.attrs since experimental features are often removed or completely
|
||||
# changed after a while
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
let
|
||||
sourceType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
|
@ -81,27 +79,26 @@ with lib; let
|
|||
};
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
default = [];
|
||||
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.
|
||||
Or it can be a raw lua string which might be necessary for more advanced use cases.
|
||||
mkOption {
|
||||
default = [ ];
|
||||
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.
|
||||
Or it can be a raw lua string which might be necessary for more advanced use cases.
|
||||
|
||||
WARNING:
|
||||
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
|
||||
plugins. This will work only when this option is set to a list.
|
||||
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
|
||||
your nixvim configuration.
|
||||
WARNING:
|
||||
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
|
||||
plugins. This will work only when this option is set to a list.
|
||||
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
|
||||
your nixvim configuration.
|
||||
|
||||
Default: `[]`
|
||||
'';
|
||||
example = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
}
|
||||
Default: `[]`
|
||||
'';
|
||||
example = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-fish;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-fish = {
|
||||
fishPackage = mkOption {
|
||||
|
@ -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 = {
|
||||
|
@ -30,13 +32,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').git.commits";}''
|
||||
"Function used to sort the commits.";
|
||||
''{__raw = "require('cmp_git.sort').git.commits";}''
|
||||
"Function used to sort the commits.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').git.commits";}''
|
||||
"Function used to format the commits.";
|
||||
''{__raw = "require('cmp_git.format').git.commits";}''
|
||||
"Function used to format the commits.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -47,9 +49,8 @@ in {
|
|||
|
||||
issues = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for issues.";
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for issues.";
|
||||
|
||||
filter = helpers.defaultNullOpts.mkStr "all" ''
|
||||
The filter to use when fetching issues.
|
||||
|
@ -65,13 +66,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
''{__raw = "require('cmp_git.sort').github.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.issues";}''
|
||||
"Function used to format the issues.";
|
||||
''{__raw = "require('cmp_git.format').github.issues";}''
|
||||
"Function used to format the issues.";
|
||||
};
|
||||
|
||||
mentions = {
|
||||
|
@ -81,20 +82,19 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
''{__raw = "require('cmp_git.sort').github.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
''{__raw = "require('cmp_git.format').github.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
};
|
||||
|
||||
pull_requests = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for pull requests.";
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for pull requests.";
|
||||
|
||||
limit = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
Max number of pull requests to fetch.
|
||||
|
@ -106,13 +106,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
|
||||
"Function used to sort the pull requests.";
|
||||
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
|
||||
"Function used to sort the pull requests.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.pull_requests";}''
|
||||
"Function used to format the pull requests.";
|
||||
''{__raw = "require('cmp_git.format').github.pull_requests";}''
|
||||
"Function used to format the pull requests.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -132,13 +132,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.issues";}''
|
||||
"Function used to format the issues.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.issues";}''
|
||||
"Function used to format the issues.";
|
||||
};
|
||||
|
||||
mentions = {
|
||||
|
@ -148,13 +148,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
};
|
||||
|
||||
merge_requests = {
|
||||
|
@ -168,114 +168,118 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
|
||||
"Function used to sort the merge requests.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
|
||||
"Function used to sort the merge requests.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
|
||||
"Function used to format the merge requests.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
|
||||
"Function used to format the merge requests.";
|
||||
};
|
||||
};
|
||||
|
||||
trigger_actions =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.submodule {
|
||||
options = {
|
||||
debug_name = helpers.mkNullOrStr "Debug name.";
|
||||
(types.submodule {
|
||||
options = {
|
||||
debug_name = helpers.mkNullOrStr "Debug name.";
|
||||
|
||||
trigger_character = mkOption {
|
||||
type = types.str;
|
||||
example = ":";
|
||||
description = ''
|
||||
The trigger character.
|
||||
Has to be a single character
|
||||
'';
|
||||
};
|
||||
trigger_character = mkOption {
|
||||
type = types.str;
|
||||
example = ":";
|
||||
description = ''
|
||||
The trigger character.
|
||||
Has to be a single character
|
||||
'';
|
||||
};
|
||||
|
||||
action = mkOption {
|
||||
type = helpers.nixvimTypes.strLuaFn;
|
||||
apply = helpers.mkRaw;
|
||||
description = ''
|
||||
The parameters to the action function are the different sources (currently `git`,
|
||||
`gitlab` and `github`), the completion callback, the trigger character, the
|
||||
parameters passed to complete from nvim-cmp, and the current git info.
|
||||
'';
|
||||
example = ''
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
'';
|
||||
action = mkOption {
|
||||
type = helpers.nixvimTypes.strLuaFn;
|
||||
apply = helpers.mkRaw;
|
||||
description = ''
|
||||
The parameters to the action function are the different sources (currently `git`,
|
||||
`gitlab` and `github`), the completion callback, the trigger character, the
|
||||
parameters passed to complete from nvim-cmp, and the current git info.
|
||||
'';
|
||||
example = ''
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
''
|
||||
[
|
||||
{
|
||||
debug_name = "git_commits";
|
||||
trigger_character = ":";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_issues";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_issues(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mrs";
|
||||
trigger_character = "!";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_issues_and_pr";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
]
|
||||
''
|
||||
''
|
||||
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
|
||||
add an entry in the `trigger_actions` list of the config.
|
||||
The two necessary fields are the `trigger_character` and the `action`.
|
||||
'';
|
||||
})
|
||||
''
|
||||
[
|
||||
{
|
||||
debug_name = "git_commits";
|
||||
trigger_character = ":";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_issues";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_issues(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mrs";
|
||||
trigger_character = "!";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_issues_and_pr";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
]
|
||||
''
|
||||
''
|
||||
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
|
||||
add an entry in the `trigger_actions` list of the config.
|
||||
The two necessary fields are the `trigger_character` and the `action`.
|
||||
'';
|
||||
};
|
||||
|
||||
example = {
|
||||
remotes = ["upstream" "origin" "foo"];
|
||||
remotes = [
|
||||
"upstream"
|
||||
"origin"
|
||||
"foo"
|
||||
];
|
||||
github.issues = {
|
||||
filter = "all";
|
||||
limit = 250;
|
||||
|
|
|
@ -4,41 +4,44 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-tabby;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-tabby =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||
The address of the tabby host server.
|
||||
'';
|
||||
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||
The address of the tabby host server.
|
||||
'';
|
||||
|
||||
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
The max number of lines to complete.
|
||||
'';
|
||||
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
The max number of lines to complete.
|
||||
'';
|
||||
|
||||
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to run the completion on every keystroke.
|
||||
'';
|
||||
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to run the completion on every keystroke.
|
||||
'';
|
||||
|
||||
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
|
||||
};
|
||||
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
inherit host;
|
||||
max_lines = maxLines;
|
||||
run_on_every_keystroke = runOnEveryKeyStroke;
|
||||
inherit stop;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit host;
|
||||
max_lines = maxLines;
|
||||
run_on_every_keystroke = runOnEveryKeyStroke;
|
||||
inherit stop;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
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,85 +5,79 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.codeium-nvim;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.codeium-nvim =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
|
||||
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" ''
|
||||
The hostname of the API server to use.
|
||||
'';
|
||||
api = {
|
||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
||||
The hostname of the API server to use.
|
||||
'';
|
||||
|
||||
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
|
||||
The port of the API server to use.
|
||||
'';
|
||||
};
|
||||
|
||||
tools = {
|
||||
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
|
||||
|
||||
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
|
||||
|
||||
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
|
||||
|
||||
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
|
||||
|
||||
languageServer = helpers.mkNullOrOption types.str ''
|
||||
The path to the language server downloaded from the official source.
|
||||
'';
|
||||
};
|
||||
|
||||
wrapper = helpers.mkNullOrOption types.str ''
|
||||
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
||||
tools.
|
||||
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
||||
codeium server.
|
||||
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
|
||||
The port of the API server to use.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
};
|
||||
tools = with tools; {
|
||||
inherit
|
||||
uname
|
||||
uuidgen
|
||||
curl
|
||||
gzip
|
||||
;
|
||||
language_server = languageServer;
|
||||
};
|
||||
inherit wrapper;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
||||
tools = {
|
||||
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
|
||||
|
||||
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
|
||||
|
||||
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
|
||||
|
||||
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
|
||||
|
||||
languageServer = helpers.mkNullOrOption types.str ''
|
||||
The path to the language server downloaded from the official source.
|
||||
'';
|
||||
};
|
||||
|
||||
wrapper = helpers.mkNullOrOption types.str ''
|
||||
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
||||
tools.
|
||||
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
||||
codeium server.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
};
|
||||
tools = with tools; {
|
||||
inherit
|
||||
uname
|
||||
uuidgen
|
||||
curl
|
||||
gzip
|
||||
;
|
||||
language_server = languageServer;
|
||||
};
|
||||
inherit wrapper;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,63 +4,58 @@
|
|||
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
|
||||
// {
|
||||
event =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; listOf str)
|
||||
''["InsertEnter" "LspAttach"]''
|
||||
in
|
||||
{
|
||||
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
event =
|
||||
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
|
||||
to touch this.
|
||||
'';
|
||||
|
||||
fixPairs = helpers.defaultNullOpts.mkBool true ''
|
||||
Suppose you have the following code: `print('h')`.
|
||||
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
|
||||
fixPairs = helpers.defaultNullOpts.mkBool true ''
|
||||
Suppose you have the following code: `print('h')`.
|
||||
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
|
||||
|
||||
This is not good behavior for consistency reasons and will just end up deleting the two ending
|
||||
characters.
|
||||
This option fixes that.
|
||||
Don't turn this off unless you are having problems with pairs and believe this might be
|
||||
causing them.
|
||||
'';
|
||||
};
|
||||
This is not good behavior for consistency reasons and will just end up deleting the two ending
|
||||
characters.
|
||||
This option fixes that.
|
||||
Don't turn this off unless you are having problems with pairs and believe this might be
|
||||
causing them.
|
||||
'';
|
||||
};
|
||||
|
||||
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;
|
||||
{
|
||||
inherit event;
|
||||
fix_pairs = fixPairs;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit event;
|
||||
fix_pairs = fixPairs;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
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,27 +5,28 @@
|
|||
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 =
|
||||
[
|
||||
./codeium-nvim.nix
|
||||
./copilot-cmp.nix
|
||||
./cmp-fish.nix
|
||||
./cmp-git.nix
|
||||
./cmp-tabby.nix
|
||||
./cmp-tabnine.nix
|
||||
./crates-nvim.nix
|
||||
]
|
||||
++ pluginModules;
|
||||
imports = [
|
||||
./codeium-nvim.nix
|
||||
./copilot-cmp.nix
|
||||
./cmp-fish.nix
|
||||
./cmp-git.nix
|
||||
./cmp-tabby.nix
|
||||
./cmp-tabnine.nix
|
||||
./crates-nvim.nix
|
||||
] ++ pluginModules;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
keymapsDefinitions = {
|
||||
clear = {
|
||||
default = "<C-]>";
|
||||
|
@ -34,36 +35,36 @@ with lib; let
|
|||
};
|
||||
};
|
||||
in
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "codeium-vim";
|
||||
originalName = "codeium.vim";
|
||||
defaultPackage = pkgs.vimPlugins.codeium-vim;
|
||||
globalPrefix = "codeium_";
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "codeium-vim";
|
||||
originalName = "codeium.vim";
|
||||
defaultPackage = pkgs.vimPlugins.codeium-vim;
|
||||
globalPrefix = "codeium_";
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-19: remove 2024-03-19
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"bin"
|
||||
"filetypes"
|
||||
"manual"
|
||||
"noMapTab"
|
||||
"idleDelay"
|
||||
"render"
|
||||
"tabFallback"
|
||||
"disableBindings"
|
||||
];
|
||||
# TODO introduced 2024-02-19: remove 2024-03-19
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"bin"
|
||||
"filetypes"
|
||||
"manual"
|
||||
"noMapTab"
|
||||
"idleDelay"
|
||||
"render"
|
||||
"tabFallback"
|
||||
"disableBindings"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
bin = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.codeium}/bin/codeium_language_server";
|
||||
description = "The path to the codeium language server executable.";
|
||||
};
|
||||
settingsOptions = {
|
||||
bin = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.codeium}/bin/codeium_language_server";
|
||||
description = "The path to the codeium language server executable.";
|
||||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
''
|
||||
{
|
||||
help = false;
|
||||
|
@ -77,65 +78,61 @@ in
|
|||
This can be used to opt out of completions for certain filetypes.
|
||||
'';
|
||||
|
||||
manual = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, codeium completions will never automatically trigger.
|
||||
'';
|
||||
manual = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, codeium completions will never automatically trigger.
|
||||
'';
|
||||
|
||||
no_map_tab = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the `<Tab>` keybinding.
|
||||
'';
|
||||
no_map_tab = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the `<Tab>` keybinding.
|
||||
'';
|
||||
|
||||
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
|
||||
Delay in milliseconds before autocompletions are shown (limited by language server to a
|
||||
minimum of 75).
|
||||
'';
|
||||
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
|
||||
Delay in milliseconds before autocompletions are shown (limited by language server to a
|
||||
minimum of 75).
|
||||
'';
|
||||
|
||||
render = helpers.defaultNullOpts.mkBool true ''
|
||||
A global boolean flag that controls whether codeium renders are enabled or disabled.
|
||||
'';
|
||||
render = helpers.defaultNullOpts.mkBool true ''
|
||||
A global boolean flag that controls whether codeium renders are enabled or disabled.
|
||||
'';
|
||||
|
||||
tab_fallback = helpers.mkNullOrOption types.str ''
|
||||
The fallback key when there is no suggestion display in `codeium#Accept()`.
|
||||
tab_fallback = helpers.mkNullOrOption types.str ''
|
||||
The fallback key when there is no suggestion display in `codeium#Accept()`.
|
||||
|
||||
Default: "\<C-N>" when a popup menu is visible, else "\t".
|
||||
'';
|
||||
Default: "\<C-N>" when a popup menu is visible, else "\t".
|
||||
'';
|
||||
|
||||
disable_bindings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable default keybindings.
|
||||
'';
|
||||
};
|
||||
disable_bindings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable default keybindings.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps =
|
||||
mapAttrs
|
||||
(
|
||||
extraOptions = {
|
||||
keymaps = mapAttrs (
|
||||
optionName: v:
|
||||
helpers.defaultNullOpts.mkStr v.default ''
|
||||
${v.description}
|
||||
Command: `${v.command}`
|
||||
''
|
||||
) keymapsDefinitions;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.codeium-vim.settings.enabled = true;
|
||||
|
||||
keymaps =
|
||||
let
|
||||
processKeymap =
|
||||
optionName: v:
|
||||
helpers.defaultNullOpts.mkStr v.default ''
|
||||
${v.description}
|
||||
Command: `${v.command}`
|
||||
''
|
||||
)
|
||||
keymapsDefinitions;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.codeium-vim.settings.enabled = true;
|
||||
|
||||
keymaps = let
|
||||
processKeymap = optionName: v:
|
||||
optional
|
||||
(v != null)
|
||||
{
|
||||
optional (v != null) {
|
||||
key = v;
|
||||
action = let
|
||||
inherit (keymapsDefinitions.${optionName}) command;
|
||||
in
|
||||
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,13 +5,16 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.copilot-lua;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.copilot-lua = let
|
||||
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [false]) str);
|
||||
in
|
||||
plugins.copilot-lua =
|
||||
let
|
||||
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str);
|
||||
in
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "copilot.lua";
|
||||
|
@ -36,9 +39,18 @@ in {
|
|||
};
|
||||
|
||||
layout = {
|
||||
position = helpers.defaultNullOpts.mkEnum ["bottom" "top" "left" "right"] "bottom" ''
|
||||
The panel position.
|
||||
'';
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"bottom"
|
||||
"top"
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"bottom"
|
||||
''
|
||||
The panel position.
|
||||
'';
|
||||
|
||||
ratio = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.4" ''
|
||||
The panel ratio.
|
||||
|
@ -69,52 +81,51 @@ in {
|
|||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
yaml = false;
|
||||
markdown = false;
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
gitrebase = false;
|
||||
hgcommit = false;
|
||||
svn = false;
|
||||
cvs = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
Specify filetypes for attaching copilot.
|
||||
Each value can be either a boolean or a lua function that returns a boolean.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
markdown = true; # overrides default
|
||||
terraform = false; # disallow specific filetype
|
||||
sh.__raw = \'\'
|
||||
function ()
|
||||
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
|
||||
-- disable for .env files
|
||||
return false
|
||||
yaml = false;
|
||||
markdown = false;
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
gitrebase = false;
|
||||
hgcommit = false;
|
||||
svn = false;
|
||||
cvs = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
Specify filetypes for attaching copilot.
|
||||
Each value can be either a boolean or a lua function that returns a boolean.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
markdown = true; # overrides default
|
||||
terraform = false; # disallow specific filetype
|
||||
sh.__raw = \'\'
|
||||
function ()
|
||||
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
|
||||
-- disable for .env files
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
```
|
||||
\'\';
|
||||
}
|
||||
```
|
||||
|
||||
The key `"*"` can be used to disable the default configuration.
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
javascript = true; # allow specific filetype
|
||||
typescript = true; # allow specific filetype
|
||||
"*" = false; # disable for all other filetypes and ignore default `filetypes`
|
||||
}
|
||||
```
|
||||
'';
|
||||
The key `"*"` can be used to disable the default configuration.
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
javascript = true; # allow specific filetype
|
||||
typescript = true; # allow specific filetype
|
||||
"*" = false; # disable for all other filetypes and ignore default `filetypes`
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
copilotNodeCommand = mkOption {
|
||||
type = types.str;
|
||||
|
@ -164,41 +175,44 @@ in {
|
|||
}
|
||||
];
|
||||
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
panel = with panel; {
|
||||
inherit enabled;
|
||||
auto_refresh = autoRefresh;
|
||||
keymap = with keymap; {
|
||||
jump_prev = jumpPrev;
|
||||
jump_next = jumpNext;
|
||||
inherit accept refresh open;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
panel = with panel; {
|
||||
inherit enabled;
|
||||
auto_refresh = autoRefresh;
|
||||
keymap = with keymap; {
|
||||
jump_prev = jumpPrev;
|
||||
jump_next = jumpNext;
|
||||
inherit accept refresh open;
|
||||
};
|
||||
layout = with layout; {
|
||||
inherit position ratio;
|
||||
};
|
||||
};
|
||||
layout = with layout; {
|
||||
inherit position ratio;
|
||||
suggestion = with suggestion; {
|
||||
inherit enabled;
|
||||
auto_trigger = autoTrigger;
|
||||
inherit debounce;
|
||||
keymap = with keymap; {
|
||||
inherit accept;
|
||||
accept_word = acceptWord;
|
||||
accept_line = acceptLine;
|
||||
inherit next prev dismiss;
|
||||
};
|
||||
};
|
||||
};
|
||||
suggestion = with suggestion; {
|
||||
inherit enabled;
|
||||
auto_trigger = autoTrigger;
|
||||
inherit debounce;
|
||||
keymap = with keymap; {
|
||||
inherit accept;
|
||||
accept_word = acceptWord;
|
||||
accept_line = acceptLine;
|
||||
inherit next prev dismiss;
|
||||
};
|
||||
};
|
||||
inherit filetypes;
|
||||
copilot_node_command = copilotNodeCommand;
|
||||
server_opts_overrides = serverOptsOverrides;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
inherit filetypes;
|
||||
copilot_node_command = copilotNodeCommand;
|
||||
server_opts_overrides = serverOptsOverrides;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,79 +7,79 @@
|
|||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "copilot-vim";
|
||||
originalName = "copilot.vim";
|
||||
defaultPackage = pkgs.vimPlugins.copilot-vim;
|
||||
globalPrefix = "copilot_";
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "copilot-vim";
|
||||
originalName = "copilot.vim";
|
||||
defaultPackage = pkgs.vimPlugins.copilot-vim;
|
||||
globalPrefix = "copilot_";
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"nodeCommand"
|
||||
"filetypes"
|
||||
"proxy"
|
||||
];
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"nodeCommand"
|
||||
"filetypes"
|
||||
"proxy"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
node_command = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.nodejs-18_x}/bin/node";
|
||||
description = "Tell Copilot what `node` binary to use.";
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = with types; nullOr (attrsOf bool);
|
||||
default = null;
|
||||
description = "A dictionary mapping file types to their enabled status.";
|
||||
example = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
};
|
||||
|
||||
proxy = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Tell Copilot what proxy server to use.
|
||||
|
||||
If this is not set, Copilot will use the value of environment variables like
|
||||
`$HTTPS_PROXY`.
|
||||
'';
|
||||
example = "localhost:3128";
|
||||
};
|
||||
|
||||
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
|
||||
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
|
||||
with GitHub Copilot.
|
||||
To work around this, SSL certificate verification can be disabled by setting this option to
|
||||
`false`.
|
||||
|
||||
You can also tell `Node.js` to disable SSL verification by setting the
|
||||
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
|
||||
'';
|
||||
|
||||
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
A list of "workspace folders" or project roots that Copilot may use to improve to improve
|
||||
the quality of suggestions.
|
||||
|
||||
Example: ["~/Projects/myproject"]
|
||||
|
||||
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
|
||||
added automatically.
|
||||
'';
|
||||
settingsOptions = {
|
||||
node_command = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.nodejs-18_x}/bin/node";
|
||||
description = "Tell Copilot what `node` binary to use.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
filetypes = {
|
||||
filetypes = mkOption {
|
||||
type = with types; nullOr (attrsOf bool);
|
||||
default = null;
|
||||
description = "A dictionary mapping file types to their enabled status.";
|
||||
example = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
proxy = "localhost:3128";
|
||||
proxy_strict_ssl = false;
|
||||
workspace_folders = ["~/Projects/myproject"];
|
||||
};
|
||||
}
|
||||
|
||||
proxy = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Tell Copilot what proxy server to use.
|
||||
|
||||
If this is not set, Copilot will use the value of environment variables like
|
||||
`$HTTPS_PROXY`.
|
||||
'';
|
||||
example = "localhost:3128";
|
||||
};
|
||||
|
||||
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
|
||||
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
|
||||
with GitHub Copilot.
|
||||
To work around this, SSL certificate verification can be disabled by setting this option to
|
||||
`false`.
|
||||
|
||||
You can also tell `Node.js` to disable SSL verification by setting the
|
||||
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
|
||||
'';
|
||||
|
||||
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
A list of "workspace folders" or project roots that Copilot may use to improve to improve
|
||||
the quality of suggestions.
|
||||
|
||||
Example: ["~/Projects/myproject"]
|
||||
|
||||
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
|
||||
added automatically.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
filetypes = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
proxy = "localhost:3128";
|
||||
proxy_strict_ssl = false;
|
||||
workspace_folders = [ "~/Projects/myproject" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,40 +5,44 @@
|
|||
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 {
|
||||
freeformType = types.attrs;
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
freeformType = types.attrs;
|
||||
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the source";
|
||||
};
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the source";
|
||||
};
|
||||
|
||||
short_name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
A short name for the source.
|
||||
If not specified, it is uppercase `src`.
|
||||
'';
|
||||
example = "nLUA";
|
||||
default = null;
|
||||
short_name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
A short name for the source.
|
||||
If not specified, it is uppercase `src`.
|
||||
'';
|
||||
example = "nLUA";
|
||||
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.
|
||||
'';
|
||||
default = [];
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
src = "nvimlua";
|
||||
|
@ -53,13 +57,13 @@ in {
|
|||
short_name = "COP";
|
||||
accept_key = "<c-f>";
|
||||
}
|
||||
{src = "demo";}
|
||||
{ src = "demo"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('coq_3p')(${helpers.toLuaObject cfg.sources})
|
||||
|
|
|
@ -6,78 +6,87 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "coq-nvim";
|
||||
originalName = "coq_nvim";
|
||||
defaultPackage = pkgs.vimPlugins.coq_nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "coq-nvim";
|
||||
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";
|
||||
artifactsPackage = mkOption {
|
||||
type = types.package;
|
||||
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
|
||||
default = pkgs.vimPlugins.coq-artifacts;
|
||||
};
|
||||
extraOptions = {
|
||||
installArtifacts = mkEnableOption "and install coq-artifacts";
|
||||
artifactsPackage = mkOption {
|
||||
type = types.package;
|
||||
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
|
||||
default = pkgs.vimPlugins.coq-artifacts;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: Introduced 12-03-2022, remove 12-05-2022
|
||||
optionsRenamedToSettings = [
|
||||
"xdg"
|
||||
"autoStart"
|
||||
];
|
||||
imports = let
|
||||
basePath = ["plugins" "coq-nvim"];
|
||||
settingsPath = basePath ++ ["settings"];
|
||||
in [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePath ++ ["recommendedKeymaps"])
|
||||
(settingsPath ++ ["keymap" "recommended"])
|
||||
)
|
||||
|
||||
(
|
||||
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";
|
||||
|
||||
xdg = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use XDG paths. May be required when installing coq with Nix.";
|
||||
};
|
||||
|
||||
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
|
||||
|
||||
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf cfg.installArtifacts [
|
||||
cfg.artifactsPackage
|
||||
# TODO: Introduced 12-03-2022, remove 12-05-2022
|
||||
optionsRenamedToSettings = [
|
||||
"xdg"
|
||||
"autoStart"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePath = [
|
||||
"plugins"
|
||||
"coq-nvim"
|
||||
];
|
||||
settingsPath = basePath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePath ++ [ "recommendedKeymaps" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"keymap"
|
||||
"recommended"
|
||||
]
|
||||
))
|
||||
|
||||
globals = {
|
||||
coq_settings = cfg.settings;
|
||||
};
|
||||
(mkRenamedOptionModule (basePath ++ [ "alwaysComplete" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"completion"
|
||||
"always"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
extraConfigLua = "require('coq')";
|
||||
callSetup = false;
|
||||
settingsOptions = {
|
||||
auto_start = helpers.mkNullOrOption (
|
||||
with helpers.nixvimTypes; maybeRaw (either bool (enum [ "shut-up" ]))
|
||||
) "Auto-start or shut up";
|
||||
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
local coq = require 'coq'
|
||||
'';
|
||||
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
|
||||
};
|
||||
xdg = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use XDG paths. May be required when installing coq with Nix.";
|
||||
};
|
||||
}
|
||||
|
||||
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
|
||||
|
||||
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf cfg.installArtifacts [ cfg.artifactsPackage ];
|
||||
|
||||
globals = {
|
||||
coq_settings = cfg.settings;
|
||||
};
|
||||
|
||||
extraConfigLua = "require('coq')";
|
||||
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
local coq = require 'coq'
|
||||
'';
|
||||
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,85 +5,86 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lspkind;
|
||||
in {
|
||||
options.plugins.lspkind =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
in
|
||||
{
|
||||
options.plugins.lspkind = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["text" "text_symbol" "symbol_text" "symbol"]
|
||||
"symbol_text"
|
||||
"Defines how annotations are shown";
|
||||
mode = helpers.defaultNullOpts.mkEnum [
|
||||
"text"
|
||||
"text_symbol"
|
||||
"symbol_text"
|
||||
"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";
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
|
||||
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";
|
||||
|
||||
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)";
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
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";
|
||||
|
||||
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)";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
else {}
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
// (
|
||||
if doCmp then
|
||||
{
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = optionalString (!doCmp) ''
|
||||
require('lspkind').init(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
||||
plugins.cmp.settings.formatting.format =
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
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 ''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
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 {
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
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,19 +40,20 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
dap_configurations = dapConfigurations;
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
dap_configurations = dapConfigurations;
|
||||
|
||||
delve = with delve; {
|
||||
inherit path port args;
|
||||
initialize_timeout_sec = initializeTimeoutSec;
|
||||
build_flags = buildFlags;
|
||||
delve = with delve; {
|
||||
inherit path port args;
|
||||
initialize_timeout_sec = initializeTimeoutSec;
|
||||
build_flags = buildFlags;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -5,22 +5,28 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-python;
|
||||
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
|
||||
in {
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-python = {
|
||||
enable = mkEnableOption "dap-python";
|
||||
|
||||
package = helpers.mkPackageOption "dap-python" pkgs.vimPlugins.nvim-dap-python;
|
||||
|
||||
adapterPythonPath = mkOption {
|
||||
default = "${pkgs.python3.withPackages (ps: with ps; [debugpy])}/bin/python3";
|
||||
default = "${pkgs.python3.withPackages (ps: with ps; [ debugpy ])}/bin/python3";
|
||||
description = "Path to the python interpreter. Path must be absolute or in $PATH and needs to have the debugpy package installed.";
|
||||
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,30 +52,27 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
inherit console;
|
||||
include_configs = includeConfigs;
|
||||
};
|
||||
in
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit console;
|
||||
include_configs = includeConfigs;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
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 {
|
||||
|
@ -32,7 +31,7 @@ with lib; let
|
|||
layoutOption = types.submodule {
|
||||
options = {
|
||||
elements = mkOption {
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Elements to display in this layout.";
|
||||
type = with types; listOf (either str elementOption);
|
||||
};
|
||||
|
@ -46,178 +45,185 @@ 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
|
||||
// {
|
||||
enable = mkEnableOption "dap-ui";
|
||||
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;
|
||||
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
|
||||
|
||||
controls = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
||||
controls = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
||||
|
||||
element =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["repl" "scopes" "stacks" "watches" "breakpoints" "console"]
|
||||
"Element to show the controls on.";
|
||||
|
||||
icons = {
|
||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
||||
pause = helpers.defaultNullOpts.mkStr "" "";
|
||||
play = helpers.defaultNullOpts.mkStr "" "";
|
||||
run_last = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_into = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_over = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_out = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_back = helpers.defaultNullOpts.mkStr "" "";
|
||||
terminate = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
};
|
||||
|
||||
elementMappings = helpers.mkNullOrOption (
|
||||
types.attrsOf (
|
||||
types.submodule {
|
||||
options = mkKeymapOptions "element mapping overrides" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
}
|
||||
)
|
||||
) "Per-element overrides of global mappings.";
|
||||
|
||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||
|
||||
floating = {
|
||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
||||
|
||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||
element = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"repl"
|
||||
"scopes"
|
||||
"stacks"
|
||||
"watches"
|
||||
"breakpoints"
|
||||
"console"
|
||||
] "Element to show the controls on.";
|
||||
|
||||
icons = {
|
||||
collapsed = helpers.defaultNullOpts.mkStr "" "";
|
||||
current_frame = helpers.defaultNullOpts.mkStr "" "";
|
||||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
||||
pause = helpers.defaultNullOpts.mkStr "" "";
|
||||
play = helpers.defaultNullOpts.mkStr "" "";
|
||||
run_last = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_into = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_over = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_out = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_back = helpers.defaultNullOpts.mkStr "" "";
|
||||
terminate = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
|
||||
layouts =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf layoutOption)
|
||||
''
|
||||
```nix
|
||||
[
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "scopes";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "breakpoints";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "stacks";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "watches";
|
||||
size = 0.25;
|
||||
}
|
||||
];
|
||||
position = "left";
|
||||
size = 40;
|
||||
}
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "repl";
|
||||
size = 0.5;
|
||||
}
|
||||
{
|
||||
id = "console";
|
||||
size = 0.5;
|
||||
}
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
```
|
||||
''
|
||||
"List of layouts for dap-ui.";
|
||||
|
||||
mappings =
|
||||
helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
})
|
||||
"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.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
{
|
||||
inherit controls icons layouts mappings;
|
||||
|
||||
element_mappings = elementMappings;
|
||||
|
||||
floating = with floating; {
|
||||
inherit border mappings;
|
||||
max_height = maxHeight;
|
||||
max_width = maxWidth;
|
||||
elementMappings = helpers.mkNullOrOption (types.attrsOf (
|
||||
types.submodule {
|
||||
options = mkKeymapOptions "element mapping overrides" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
|
||||
force_buffers = forceBuffers;
|
||||
|
||||
render = with render; {
|
||||
inherit indent;
|
||||
max_type_length = maxTypeLength;
|
||||
max_value_lines = maxValueLines;
|
||||
};
|
||||
|
||||
select_window = selectWindow;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
)) "Per-element overrides of global mappings.";
|
||||
|
||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||
|
||||
floating = {
|
||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
||||
|
||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||
|
||||
icons = {
|
||||
collapsed = helpers.defaultNullOpts.mkStr "" "";
|
||||
current_frame = helpers.defaultNullOpts.mkStr "" "";
|
||||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
|
||||
layouts = helpers.defaultNullOpts.mkNullable (types.listOf layoutOption) ''
|
||||
```nix
|
||||
[
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "scopes";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "breakpoints";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "stacks";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "watches";
|
||||
size = 0.25;
|
||||
}
|
||||
];
|
||||
position = "left";
|
||||
size = 40;
|
||||
}
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "repl";
|
||||
size = 0.5;
|
||||
}
|
||||
{
|
||||
id = "console";
|
||||
size = 0.5;
|
||||
}
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
```
|
||||
'' "List of layouts for dap-ui.";
|
||||
|
||||
mappings = helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
}) "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.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
inherit
|
||||
controls
|
||||
icons
|
||||
layouts
|
||||
mappings
|
||||
;
|
||||
|
||||
element_mappings = elementMappings;
|
||||
|
||||
floating = with floating; {
|
||||
inherit border mappings;
|
||||
max_height = maxHeight;
|
||||
max_width = maxWidth;
|
||||
};
|
||||
|
||||
force_buffers = forceBuffers;
|
||||
|
||||
render = with render; {
|
||||
inherit indent;
|
||||
max_type_length = maxTypeLength;
|
||||
max_value_lines = maxValueLines;
|
||||
};
|
||||
|
||||
select_window = selectWindow;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -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,26 +63,27 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
inherit commented;
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit commented;
|
||||
|
||||
enabled_commands = enabledCommands;
|
||||
highlight_changed_variables = highlightChangedVariables;
|
||||
highlight_new_as_changed = highlightNewAsChanged;
|
||||
show_stop_reason = showStopReason;
|
||||
only_first_definition = onlyFirstDefinition;
|
||||
all_references = allReferences;
|
||||
clear_on_continue = clearOnContinue;
|
||||
display_callback = displayCallback;
|
||||
virt_text_pos = virtTextPos;
|
||||
all_frames = allFrames;
|
||||
virt_lines = virtLines;
|
||||
virt_text_win_col = virtTextWinCol;
|
||||
};
|
||||
in
|
||||
enabled_commands = enabledCommands;
|
||||
highlight_changed_variables = highlightChangedVariables;
|
||||
highlight_new_as_changed = highlightNewAsChanged;
|
||||
show_stop_reason = showStopReason;
|
||||
only_first_definition = onlyFirstDefinition;
|
||||
all_references = allReferences;
|
||||
clear_on_continue = clearOnContinue;
|
||||
display_callback = displayCallback;
|
||||
virt_text_pos = virtTextPos;
|
||||
all_frames = allFrames;
|
||||
virt_lines = virtLines;
|
||||
virt_text_win_col = virtTextWinCol;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,40 +1,37 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
mkAdapterType = attrs:
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
mkAdapterType =
|
||||
attrs:
|
||||
types.submodule {
|
||||
options =
|
||||
{
|
||||
id = helpers.mkNullOrOption types.str ''
|
||||
Identifier of the adapter. This is used for the
|
||||
`adapterId` property of the initialize request.
|
||||
For most debug adapters setting this is not necessary.
|
||||
options = {
|
||||
id = helpers.mkNullOrOption types.str ''
|
||||
Identifier of the adapter. This is used for the
|
||||
`adapterId` property of the initialize request.
|
||||
For most debug adapters setting this is not necessary.
|
||||
'';
|
||||
|
||||
enrichConfig = helpers.mkNullOrLuaFn ''
|
||||
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
|
||||
configuration with additional information. It receives a configuration as first
|
||||
argument, and a callback that must be called with the final configuration as second argument.
|
||||
'';
|
||||
|
||||
options = {
|
||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
|
||||
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
||||
'';
|
||||
|
||||
enrichConfig = helpers.mkNullOrLuaFn ''
|
||||
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
|
||||
configuration with additional information. It receives a configuration as first
|
||||
argument, and a callback that must be called with the final configuration as second argument.
|
||||
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
|
||||
How many seconds the client waits for a disconnect response from the debug
|
||||
adapter before emitting a warning and closing the connection.
|
||||
'';
|
||||
|
||||
options = {
|
||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
|
||||
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
||||
'';
|
||||
|
||||
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
|
||||
How many seconds the client waits for a disconnect response from the debug
|
||||
adapter before emitting a warning and closing the connection.
|
||||
'';
|
||||
|
||||
sourceFiletype = helpers.mkNullOrOption types.str ''
|
||||
The filetype to use for content retrieved via a source request.
|
||||
'';
|
||||
};
|
||||
}
|
||||
// attrs;
|
||||
sourceFiletype = helpers.mkNullOrOption types.str ''
|
||||
The filetype to use for content retrieved via a source request.
|
||||
'';
|
||||
};
|
||||
} // attrs;
|
||||
};
|
||||
|
||||
executableAdapterOption = mkAdapterType {
|
||||
|
@ -54,7 +51,7 @@ with lib; rec {
|
|||
serverAdapterOption = mkAdapterType {
|
||||
host = helpers.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
|
||||
|
||||
port = helpers.mkNullOrOption (types.either types.int (types.enum ["$\{port}"])) ''
|
||||
port = helpers.mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
|
||||
Port to connect to.
|
||||
If "$\{port}" dap resolves a free port.
|
||||
This is intended to be used with `executable.args`.
|
||||
|
@ -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,18 +121,20 @@ 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
|
||||
else
|
||||
filterAttrs (n: _: n != "enrichConfig") (
|
||||
adapter
|
||||
// {
|
||||
inherit type;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
))
|
||||
adapters;
|
||||
mapAttrs (
|
||||
_: adapter:
|
||||
if isString adapter then
|
||||
helpers.mkRaw adapter
|
||||
else
|
||||
filterAttrs (n: _: n != "enrichConfig") (
|
||||
adapter
|
||||
// {
|
||||
inherit type;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
)
|
||||
) adapters;
|
||||
}
|
||||
|
|
|
@ -5,70 +5,70 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap;
|
||||
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
with dapHelpers; {
|
||||
imports = [
|
||||
./dap-go.nix
|
||||
./dap-python.nix
|
||||
./dap-ui.nix
|
||||
./dap-virtual-text.nix
|
||||
];
|
||||
with dapHelpers;
|
||||
{
|
||||
imports = [
|
||||
./dap-go.nix
|
||||
./dap-python.nix
|
||||
./dap-ui.nix
|
||||
./dap-virtual-text.nix
|
||||
];
|
||||
|
||||
options.plugins.dap =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "dap";
|
||||
options.plugins.dap = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "dap";
|
||||
|
||||
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||||
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||||
|
||||
adapters = helpers.mkCompositeOption "Dap adapters." {
|
||||
executables = mkAdapterOption "executable" executableAdapterOption;
|
||||
servers = mkAdapterOption "server" serverAdapterOption;
|
||||
};
|
||||
adapters = helpers.mkCompositeOption "Dap adapters." {
|
||||
executables = mkAdapterOption "executable" executableAdapterOption;
|
||||
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.
|
||||
'';
|
||||
|
||||
signs = helpers.mkCompositeOption "Signs for dap." {
|
||||
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||||
signs = helpers.mkCompositeOption "Signs for dap." {
|
||||
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||||
|
||||
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||||
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||||
|
||||
dapLogPoint = mkSignOption "L" "Sign for log points.";
|
||||
dapLogPoint = mkSignOption "L" "Sign for log points.";
|
||||
|
||||
dapStopped = mkSignOption "→" "Sign to indicate where the debuggee is stopped.";
|
||||
dapStopped = mkSignOption "→" "Sign to indicate where the debuggee is stopped.";
|
||||
|
||||
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
|
||||
};
|
||||
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
|
||||
};
|
||||
|
||||
extensionConfigLua = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Extension configuration for dap. Don't use this directly !
|
||||
'';
|
||||
default = "";
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
extensionConfigLua = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Extension configuration for dap. Don't use this directly !
|
||||
'';
|
||||
default = "";
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -80,22 +80,22 @@ in
|
|||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.adapters != null) ''
|
||||
require("dap").adapters = ${helpers.toLuaObject options.adapters}
|
||||
'')
|
||||
+ (optionalString (options.configurations != null) ''
|
||||
require("dap").configurations = ${helpers.toLuaObject options.configurations}
|
||||
'')
|
||||
+ (optionalString (cfg.signs != null) ''
|
||||
local __dap_signs = ${helpers.toLuaObject options.signs}
|
||||
for sign_name, sign in pairs(__dap_signs) do
|
||||
vim.fn.sign_define(sign_name, sign)
|
||||
end
|
||||
'')
|
||||
+ cfg.extensionConfigLua;
|
||||
};
|
||||
}
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.adapters != null) ''
|
||||
require("dap").adapters = ${helpers.toLuaObject options.adapters}
|
||||
'')
|
||||
+ (optionalString (options.configurations != null) ''
|
||||
require("dap").configurations = ${helpers.toLuaObject options.configurations}
|
||||
'')
|
||||
+ (optionalString (cfg.signs != null) ''
|
||||
local __dap_signs = ${helpers.toLuaObject options.signs}
|
||||
for sign_name, sign in pairs(__dap_signs) do
|
||||
vim.fn.sign_define(sign_name, sign)
|
||||
end
|
||||
'')
|
||||
+ cfg.extensionConfigLua;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,92 +5,100 @@
|
|||
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
|
||||
// {
|
||||
enable = mkEnableOption "chadtree";
|
||||
in
|
||||
{
|
||||
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "chadtree";
|
||||
|
||||
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
|
||||
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
|
||||
|
||||
options = {
|
||||
follow = helpers.defaultNullOpts.mkBool true ''
|
||||
CHADTree will highlight currently open file, and open all its parents.
|
||||
options = {
|
||||
follow = helpers.defaultNullOpts.mkBool true ''
|
||||
CHADTree will highlight currently open file, and open all its parents.
|
||||
'';
|
||||
|
||||
lang = helpers.mkNullOrOption types.str ''
|
||||
CHADTree will guess your locale from unix environmental variables.
|
||||
Set to `c` to disable emojis.
|
||||
'';
|
||||
|
||||
mimetypes = {
|
||||
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
|
||||
Show a warning before opening these datatypes.
|
||||
'';
|
||||
|
||||
lang = helpers.mkNullOrOption types.str ''
|
||||
CHADTree will guess your locale from unix environmental variables.
|
||||
Set to `c` to disable emojis.
|
||||
allowExts = mkListStr ''[".ts"]'' ''
|
||||
Skip warning for these extensions.
|
||||
'';
|
||||
|
||||
mimetypes = {
|
||||
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
|
||||
Show a warning before opening these datatypes.
|
||||
'';
|
||||
|
||||
allowExts = mkListStr ''[".ts"]'' ''
|
||||
Skip warning for these extensions.
|
||||
'';
|
||||
};
|
||||
|
||||
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
|
||||
Change how many lines `{` and `}` scroll.
|
||||
'';
|
||||
|
||||
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
|
||||
CHADTree's background refresh rate.
|
||||
'';
|
||||
|
||||
session = helpers.defaultNullOpts.mkBool true ''
|
||||
Save & restore currently open folders.
|
||||
'';
|
||||
|
||||
showHidden = helpers.defaultNullOpts.mkBool false ''
|
||||
Hide some files and folders by default. By default this can be toggled using the `.` key.
|
||||
see `chadtree_settings.ignore` for more details.
|
||||
'';
|
||||
|
||||
versionControl = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
|
||||
'';
|
||||
|
||||
ignore = {
|
||||
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
|
||||
Files whose name match these exactly will be ignored.
|
||||
'';
|
||||
|
||||
nameGlob = mkListStr "[]" ''
|
||||
Files whose name match these glob patterns will be ignored.
|
||||
ie. `*.py` will match all python files
|
||||
'';
|
||||
|
||||
pathGlob = mkListStr "[]" ''
|
||||
Files whose full path match these glob patterns will be ignored.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
view = {
|
||||
openDirection = helpers.defaultNullOpts.mkEnum ["left" "right"] "left" ''
|
||||
Which way does CHADTree open?
|
||||
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
|
||||
Change how many lines `{` and `}` scroll.
|
||||
'';
|
||||
|
||||
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
|
||||
CHADTree's background refresh rate.
|
||||
'';
|
||||
|
||||
session = helpers.defaultNullOpts.mkBool true ''
|
||||
Save & restore currently open folders.
|
||||
'';
|
||||
|
||||
showHidden = helpers.defaultNullOpts.mkBool false ''
|
||||
Hide some files and folders by default. By default this can be toggled using the `.` key.
|
||||
see `chadtree_settings.ignore` for more details.
|
||||
'';
|
||||
|
||||
versionControl = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
|
||||
'';
|
||||
|
||||
ignore = {
|
||||
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
|
||||
Files whose name match these exactly will be ignored.
|
||||
'';
|
||||
|
||||
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
|
||||
CHADTree can sort by the following criterion.
|
||||
Reorder them if you want a different sorting order.
|
||||
legal keys: some of
|
||||
`["is_folder" "ext" "file_name"]`
|
||||
nameGlob = mkListStr "[]" ''
|
||||
Files whose name match these glob patterns will be ignored.
|
||||
ie. `*.py` will match all python files
|
||||
'';
|
||||
|
||||
width = helpers.defaultNullOpts.mkInt 40 ''
|
||||
How big is CHADTree when initially opened?
|
||||
pathGlob = mkListStr "[]" ''
|
||||
Files whose full path match these glob patterns will be ignored.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
windowOptions =
|
||||
helpers.defaultNullOpts.mkAttributeSet ''
|
||||
view = {
|
||||
openDirection =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"left"
|
||||
''
|
||||
Which way does CHADTree open?
|
||||
'';
|
||||
|
||||
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
|
||||
CHADTree can sort by the following criterion.
|
||||
Reorder them if you want a different sorting order.
|
||||
legal keys: some of
|
||||
`["is_folder" "ext" "file_name"]`
|
||||
'';
|
||||
|
||||
width = helpers.defaultNullOpts.mkInt 40 ''
|
||||
How big is CHADTree when initially opened?
|
||||
'';
|
||||
|
||||
windowOptions =
|
||||
helpers.defaultNullOpts.mkAttributeSet
|
||||
''
|
||||
{
|
||||
cursorline = true;
|
||||
number = false;
|
||||
|
@ -103,34 +111,44 @@ in {
|
|||
''
|
||||
Set of window local options to for CHADTree windows.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
theme = {
|
||||
highlights = {
|
||||
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
These are used for files that are ignored by user supplied pattern
|
||||
in `chadtree.ignore` and by version control.
|
||||
'';
|
||||
|
||||
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
|
||||
These are used to show bookmarks.
|
||||
'';
|
||||
|
||||
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
|
||||
These are used to notify the number of times a file / folder appears in the `quickfix` list.
|
||||
'';
|
||||
|
||||
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
These are used to put a version control status beside each file.
|
||||
'';
|
||||
};
|
||||
|
||||
iconGlyphSet = helpers.defaultNullOpts.mkEnum ["devicons" "emoji" "ascii" "ascii_hollow"] "devicons" ''
|
||||
Icon glyph set to use.
|
||||
theme = {
|
||||
highlights = {
|
||||
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
These are used for files that are ignored by user supplied pattern
|
||||
in `chadtree.ignore` and by version control.
|
||||
'';
|
||||
|
||||
textColourSet =
|
||||
helpers.defaultNullOpts.mkEnum [
|
||||
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
|
||||
These are used to show bookmarks.
|
||||
'';
|
||||
|
||||
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
|
||||
These are used to notify the number of times a file / folder appears in the `quickfix` list.
|
||||
'';
|
||||
|
||||
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
These are used to put a version control status beside each file.
|
||||
'';
|
||||
};
|
||||
|
||||
iconGlyphSet =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"devicons"
|
||||
"emoji"
|
||||
"ascii"
|
||||
"ascii_hollow"
|
||||
]
|
||||
"devicons"
|
||||
''
|
||||
Icon glyph set to use.
|
||||
'';
|
||||
|
||||
textColourSet =
|
||||
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,282 +168,294 @@ in {
|
|||
If you are not happy with that, you can choose one of the many others.
|
||||
'';
|
||||
|
||||
iconColourSet = helpers.defaultNullOpts.mkEnum ["github" "none"] "github" ''
|
||||
Right now you all the file icons are coloured according to Github colours.
|
||||
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.
|
||||
You may also disable colouring if you wish.
|
||||
'';
|
||||
};
|
||||
|
||||
keymap = {
|
||||
windowManagement = {
|
||||
quit = mkListStr ''["q"]'' ''
|
||||
Close CHADTree window, quit if it is the last window.
|
||||
'';
|
||||
|
||||
bigger = mkListStr ''["+" "="]'' ''
|
||||
Resize CHADTree window bigger.
|
||||
'';
|
||||
|
||||
smaller = mkListStr ''["-" "_"]'' ''
|
||||
Resize CHADTree window smaller.
|
||||
'';
|
||||
|
||||
refresh = mkListStr ''["<c-r>"]'' ''
|
||||
Refresh CHADTree.
|
||||
'';
|
||||
};
|
||||
|
||||
keymap = {
|
||||
windowManagement = {
|
||||
quit = mkListStr ''["q"]'' ''
|
||||
Close CHADTree window, quit if it is the last window.
|
||||
'';
|
||||
rerooting = {
|
||||
changeDir = mkListStr ''["b"]'' ''
|
||||
Change vim's working directory.
|
||||
'';
|
||||
|
||||
bigger = mkListStr ''["+" "="]'' ''
|
||||
Resize CHADTree window bigger.
|
||||
'';
|
||||
changeFocus = mkListStr ''["c"]'' ''
|
||||
Set CHADTree's root to folder at cursor. Does not change working directory.
|
||||
'';
|
||||
|
||||
smaller = mkListStr ''["-" "_"]'' ''
|
||||
Resize CHADTree window smaller.
|
||||
'';
|
||||
changeFocusUp = mkListStr ''["C"]'' ''
|
||||
Set CHADTree's root one level up.
|
||||
'';
|
||||
};
|
||||
|
||||
refresh = mkListStr ''["<c-r>"]'' ''
|
||||
Refresh CHADTree.
|
||||
'';
|
||||
};
|
||||
openFileFolder = {
|
||||
primary = mkListStr ''["<enter>"]'' ''
|
||||
Open file at cursor.
|
||||
'';
|
||||
|
||||
rerooting = {
|
||||
changeDir = mkListStr ''["b"]'' ''
|
||||
Change vim's working directory.
|
||||
'';
|
||||
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
|
||||
Open file at cursor, keep cursor in CHADTree's window.
|
||||
'';
|
||||
|
||||
changeFocus = mkListStr ''["c"]'' ''
|
||||
Set CHADTree's root to folder at cursor. Does not change working directory.
|
||||
'';
|
||||
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
|
||||
Open file at cursor in a new tab.
|
||||
'';
|
||||
|
||||
changeFocusUp = mkListStr ''["C"]'' ''
|
||||
Set CHADTree's root one level up.
|
||||
'';
|
||||
};
|
||||
vSplit = mkListStr ''["w"]'' ''
|
||||
Open file at cursor in vertical split.
|
||||
'';
|
||||
|
||||
openFileFolder = {
|
||||
primary = mkListStr ''["<enter>"]'' ''
|
||||
Open file at cursor.
|
||||
'';
|
||||
hSplit = mkListStr ''["W"]'' ''
|
||||
Open file at cursor in horizontal split.
|
||||
'';
|
||||
|
||||
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
|
||||
Open file at cursor, keep cursor in CHADTree's window.
|
||||
'';
|
||||
openSys = mkListStr ''["o"]'' ''
|
||||
Open file with GUI tools using `open` or `xdg open`.
|
||||
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
|
||||
Depends on platform and user setup.
|
||||
'';
|
||||
|
||||
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
|
||||
Open file at cursor in a new tab.
|
||||
'';
|
||||
collapse = mkListStr ''["o"]'' ''
|
||||
Collapse all subdirectories for directory at cursor.
|
||||
'';
|
||||
};
|
||||
|
||||
vSplit = mkListStr ''["w"]'' ''
|
||||
Open file at cursor in vertical split.
|
||||
'';
|
||||
cursor = {
|
||||
refocus = mkListStr ''["~"]'' ''
|
||||
Put cursor at the root of CHADTree.
|
||||
'';
|
||||
|
||||
hSplit = mkListStr ''["W"]'' ''
|
||||
Open file at cursor in horizontal split.
|
||||
'';
|
||||
jumpToCurrent = mkListStr ''["J"]'' ''
|
||||
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
|
||||
'';
|
||||
|
||||
openSys = mkListStr ''["o"]'' ''
|
||||
Open file with GUI tools using `open` or `xdg open`.
|
||||
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
|
||||
Depends on platform and user setup.
|
||||
'';
|
||||
stat = mkListStr ''["K"]'' ''
|
||||
Print `ls --long` stat for file under cursor.
|
||||
'';
|
||||
|
||||
collapse = mkListStr ''["o"]'' ''
|
||||
Collapse all subdirectories for directory at cursor.
|
||||
'';
|
||||
};
|
||||
copyName = mkListStr ''["y"]'' ''
|
||||
Copy paths of files under cursor or visual block.
|
||||
'';
|
||||
|
||||
cursor = {
|
||||
refocus = mkListStr ''["~"]'' ''
|
||||
Put cursor at the root of CHADTree.
|
||||
'';
|
||||
copyBasename = mkListStr ''["Y"]'' ''
|
||||
Copy names of files under cursor or visual block.
|
||||
'';
|
||||
|
||||
jumpToCurrent = mkListStr ''["J"]'' ''
|
||||
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
|
||||
'';
|
||||
copyRelname = mkListStr ''["<c-y>"]'' ''
|
||||
Copy relative paths of files under cursor or visual block.
|
||||
'';
|
||||
};
|
||||
|
||||
stat = mkListStr ''["K"]'' ''
|
||||
Print `ls --long` stat for file under cursor.
|
||||
'';
|
||||
filtering = {
|
||||
filter = mkListStr ''["f"]'' ''
|
||||
Set a glob pattern to narrow down visible files.
|
||||
'';
|
||||
|
||||
copyName = mkListStr ''["y"]'' ''
|
||||
Copy paths of files under cursor or visual block.
|
||||
'';
|
||||
clearFilter = mkListStr ''["F"]'' ''
|
||||
Clear filter.
|
||||
'';
|
||||
};
|
||||
|
||||
copyBasename = mkListStr ''["Y"]'' ''
|
||||
Copy names of files under cursor or visual block.
|
||||
'';
|
||||
bookmarks = {
|
||||
bookmarkGoto = mkListStr ''["m"]'' ''
|
||||
Goto bookmark `A-Z`.
|
||||
'';
|
||||
};
|
||||
|
||||
copyRelname = mkListStr ''["<c-y>"]'' ''
|
||||
Copy relative paths of files under cursor or visual block.
|
||||
'';
|
||||
};
|
||||
selecting = {
|
||||
select = mkListStr ''["s"]'' ''
|
||||
Select files under cursor or visual block.
|
||||
'';
|
||||
|
||||
filtering = {
|
||||
filter = mkListStr ''["f"]'' ''
|
||||
Set a glob pattern to narrow down visible files.
|
||||
'';
|
||||
clearSelection = mkListStr ''["S"]'' ''
|
||||
Clear selection.
|
||||
'';
|
||||
};
|
||||
|
||||
clearFilter = mkListStr ''["F"]'' ''
|
||||
Clear filter.
|
||||
'';
|
||||
};
|
||||
fileOperations = {
|
||||
new = mkListStr ''["a"]'' ''
|
||||
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
|
||||
|
||||
bookmarks = {
|
||||
bookmarkGoto = mkListStr ''["m"]'' ''
|
||||
Goto bookmark `A-Z`.
|
||||
'';
|
||||
};
|
||||
Intermediary folders are created automatically.
|
||||
|
||||
selecting = {
|
||||
select = mkListStr ''["s"]'' ''
|
||||
Select files under cursor or visual block.
|
||||
'';
|
||||
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
|
||||
'';
|
||||
|
||||
clearSelection = mkListStr ''["S"]'' ''
|
||||
Clear selection.
|
||||
'';
|
||||
};
|
||||
link = mkListStr ''["A"]'' ''
|
||||
Create links at location under cursor from selection.
|
||||
|
||||
fileOperations = {
|
||||
new = mkListStr ''["a"]'' ''
|
||||
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
|
||||
Links are always relative.
|
||||
|
||||
Intermediary folders are created automatically.
|
||||
Intermediary folders are created automatically.
|
||||
'';
|
||||
|
||||
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
|
||||
'';
|
||||
rename = mkListStr ''["r"]'' ''
|
||||
Rename file under cursor.
|
||||
'';
|
||||
|
||||
link = mkListStr ''["A"]'' ''
|
||||
Create links at location under cursor from selection.
|
||||
toggleExec = mkListStr ''["X"]'' ''
|
||||
Toggle all the `+x` bits of the selected / highlighted files.
|
||||
|
||||
Links are always relative.
|
||||
Except for directories, where `-x` will prevent reading.
|
||||
'';
|
||||
|
||||
Intermediary folders are created automatically.
|
||||
'';
|
||||
copy = mkListStr ''["p"]'' ''
|
||||
Copy the selected files to location under cursor.
|
||||
'';
|
||||
|
||||
rename = mkListStr ''["r"]'' ''
|
||||
Rename file under cursor.
|
||||
'';
|
||||
cut = mkListStr ''["x"]'' ''
|
||||
Move the selected files to location under cursor.
|
||||
'';
|
||||
|
||||
toggleExec = mkListStr ''["X"]'' ''
|
||||
Toggle all the `+x` bits of the selected / highlighted files.
|
||||
delete = mkListStr ''["d"]'' ''
|
||||
Delete the selected files. Items deleted cannot be recovered.
|
||||
'';
|
||||
|
||||
Except for directories, where `-x` will prevent reading.
|
||||
'';
|
||||
trash = mkListStr ''[t]'' ''
|
||||
Trash the selected files using platform specific `trash` command, if they are available.
|
||||
Items trashed may be recovered.
|
||||
'';
|
||||
};
|
||||
|
||||
copy = mkListStr ''["p"]'' ''
|
||||
Copy the selected files to location under cursor.
|
||||
'';
|
||||
toggles = {
|
||||
toggleHidden = mkListStr ''["."]'' ''
|
||||
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
|
||||
'';
|
||||
|
||||
cut = mkListStr ''["x"]'' ''
|
||||
Move the selected files to location under cursor.
|
||||
'';
|
||||
toggleFollow = mkListStr ''["u"]'' ''
|
||||
Toggle `follow` on and off. See `chadtree.follow` for details.
|
||||
'';
|
||||
|
||||
delete = mkListStr ''["d"]'' ''
|
||||
Delete the selected files. Items deleted cannot be recovered.
|
||||
'';
|
||||
|
||||
trash = mkListStr ''[t]'' ''
|
||||
Trash the selected files using platform specific `trash` command, if they are available.
|
||||
Items trashed may be recovered.
|
||||
'';
|
||||
};
|
||||
|
||||
toggles = {
|
||||
toggleHidden = mkListStr ''["."]'' ''
|
||||
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
|
||||
'';
|
||||
|
||||
toggleFollow = mkListStr ''["u"]'' ''
|
||||
Toggle `follow` on and off. See `chadtree.follow` for details.
|
||||
'';
|
||||
|
||||
toggleVersionControl = mkListStr ''["i"]'' ''
|
||||
Toggle version control integration on and off.
|
||||
'';
|
||||
};
|
||||
toggleVersionControl = mkListStr ''["i"]'' ''
|
||||
Toggle version control integration on and off.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg; {
|
||||
xdg = true;
|
||||
options = with options; {
|
||||
inherit follow;
|
||||
inherit lang;
|
||||
mimetypes = with mimetypes; {
|
||||
inherit warn;
|
||||
allow_exts = allowExts;
|
||||
};
|
||||
page_increment = pageIncrement;
|
||||
polling_rate = pollingRate;
|
||||
inherit session;
|
||||
show_hidden = showHidden;
|
||||
version_control = versionControl;
|
||||
ignore = with ignore; {
|
||||
name_exact = nameExact;
|
||||
name_glob = nameGlob;
|
||||
path_glob = pathGlob;
|
||||
};
|
||||
};
|
||||
view = with view; {
|
||||
open_direction = openDirection;
|
||||
sort_by = sortBy;
|
||||
inherit width;
|
||||
window_options = windowOptions;
|
||||
};
|
||||
theme = with theme; {
|
||||
highlights = with highlights; {
|
||||
inherit ignored;
|
||||
inherit bookmarks;
|
||||
inherit quickfix;
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
xdg = true;
|
||||
options = with options; {
|
||||
inherit follow;
|
||||
inherit lang;
|
||||
mimetypes = with mimetypes; {
|
||||
inherit warn;
|
||||
allow_exts = allowExts;
|
||||
};
|
||||
page_increment = pageIncrement;
|
||||
polling_rate = pollingRate;
|
||||
inherit session;
|
||||
show_hidden = showHidden;
|
||||
version_control = versionControl;
|
||||
ignore = with ignore; {
|
||||
name_exact = nameExact;
|
||||
name_glob = nameGlob;
|
||||
path_glob = pathGlob;
|
||||
};
|
||||
};
|
||||
icon_glyph_set = iconGlyphSet;
|
||||
text_colour_set = textColourSet;
|
||||
icon_colour_set = iconColourSet;
|
||||
view = with view; {
|
||||
open_direction = openDirection;
|
||||
sort_by = sortBy;
|
||||
inherit width;
|
||||
window_options = windowOptions;
|
||||
};
|
||||
theme = with theme; {
|
||||
highlights = with highlights; {
|
||||
inherit ignored;
|
||||
inherit bookmarks;
|
||||
inherit quickfix;
|
||||
version_control = versionControl;
|
||||
};
|
||||
icon_glyph_set = iconGlyphSet;
|
||||
text_colour_set = textColourSet;
|
||||
icon_colour_set = iconColourSet;
|
||||
};
|
||||
keymap =
|
||||
with keymap;
|
||||
with windowManagement;
|
||||
with rerooting;
|
||||
with openFileFolder;
|
||||
with cursor;
|
||||
with filtering;
|
||||
with bookmarks;
|
||||
with selecting;
|
||||
with fileOperations;
|
||||
with toggles;
|
||||
{
|
||||
inherit quit;
|
||||
inherit bigger;
|
||||
inherit smaller;
|
||||
inherit refresh;
|
||||
change_dir = changeDir;
|
||||
change_focus = changeFocus;
|
||||
change_focus_up = changeFocusUp;
|
||||
inherit primary;
|
||||
inherit secondary;
|
||||
inherit tertiary;
|
||||
v_split = vSplit;
|
||||
h_split = hSplit;
|
||||
open_sys = openSys;
|
||||
inherit collapse;
|
||||
inherit refocus;
|
||||
jump_to_current = jumpToCurrent;
|
||||
inherit stat;
|
||||
copy_name = copyName;
|
||||
copy_basename = copyBasename;
|
||||
copy_relname = copyRelname;
|
||||
inherit filter;
|
||||
clear_filter = clearFilter;
|
||||
bookmark_goto = bookmarkGoto;
|
||||
inherit select;
|
||||
clear_selection = clearSelection;
|
||||
inherit new;
|
||||
inherit link;
|
||||
inherit rename;
|
||||
toggle_exec = toggleExec;
|
||||
inherit copy;
|
||||
inherit cut;
|
||||
inherit delete;
|
||||
inherit trash;
|
||||
toggle_hidden = toggleHidden;
|
||||
toggle_follow = toggleFollow;
|
||||
toggle_version_control = toggleVersionControl;
|
||||
};
|
||||
};
|
||||
keymap = with keymap;
|
||||
with windowManagement;
|
||||
with rerooting;
|
||||
with openFileFolder;
|
||||
with cursor;
|
||||
with filtering;
|
||||
with bookmarks;
|
||||
with selecting;
|
||||
with fileOperations;
|
||||
with toggles; {
|
||||
inherit quit;
|
||||
inherit bigger;
|
||||
inherit smaller;
|
||||
inherit refresh;
|
||||
change_dir = changeDir;
|
||||
change_focus = changeFocus;
|
||||
change_focus_up = changeFocusUp;
|
||||
inherit primary;
|
||||
inherit secondary;
|
||||
inherit tertiary;
|
||||
v_split = vSplit;
|
||||
h_split = hSplit;
|
||||
open_sys = openSys;
|
||||
inherit collapse;
|
||||
inherit refocus;
|
||||
jump_to_current = jumpToCurrent;
|
||||
inherit stat;
|
||||
copy_name = copyName;
|
||||
copy_basename = copyBasename;
|
||||
copy_relname = copyRelname;
|
||||
inherit filter;
|
||||
clear_filter = clearFilter;
|
||||
bookmark_goto = bookmarkGoto;
|
||||
inherit select;
|
||||
clear_selection = clearSelection;
|
||||
inherit new;
|
||||
inherit link;
|
||||
inherit rename;
|
||||
toggle_exec = toggleExec;
|
||||
inherit copy;
|
||||
inherit cut;
|
||||
inherit delete;
|
||||
inherit trash;
|
||||
toggle_hidden = toggleHidden;
|
||||
toggle_follow = toggleFollow;
|
||||
toggle_version_control = toggleVersionControl;
|
||||
};
|
||||
};
|
||||
in
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins =
|
||||
[cfg.package]
|
||||
++ (optional (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") pkgs.vimPlugins.nvim-web-devicons);
|
||||
[ cfg.package ]
|
||||
++ (optional (
|
||||
cfg.theme == null || cfg.theme.iconGlyphSet == "devicons"
|
||||
) pkgs.vimPlugins.nvim-web-devicons);
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
originalName = "committia.vim";
|
||||
defaultPackage = pkgs.vimPlugins.committia-vim;
|
||||
globalPrefix = "committia_";
|
||||
extraPackages = [pkgs.git];
|
||||
extraPackages = [ pkgs.git ];
|
||||
|
||||
maintainers = [helpers.maintainers.alisonjenkins];
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
|
||||
settingsOptions = {
|
||||
open_only_vim_starting = helpers.defaultNullOpts.mkBool true ''
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,9 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
name = "fugitive";
|
||||
originalName = "vim-fugitive";
|
||||
defaultPackage = pkgs.vimPlugins.vim-fugitive;
|
||||
extraPackages = [pkgs.git];
|
||||
extraPackages = [ pkgs.git ];
|
||||
|
||||
maintainers = [lib.maintainers.GaetanLepage];
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# In typical tpope fashion, this plugin has no config options
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.git-worktree;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.git-worktree = {
|
||||
enable = mkEnableOption "git-worktree";
|
||||
|
@ -43,16 +45,17 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = with cfg; {
|
||||
enabled = cfg.enable;
|
||||
change_directory_command = cfg.changeDirectoryCommand;
|
||||
update_on_change = cfg.updateOnChange;
|
||||
update_on_change_command = cfg.updateOnChangeCommand;
|
||||
clearjumps_on_change = cfg.clearJumpsOnChange;
|
||||
inherit autopush;
|
||||
};
|
||||
in
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
enabled = cfg.enable;
|
||||
change_directory_command = cfg.changeDirectoryCommand;
|
||||
update_on_change = cfg.updateOnChange;
|
||||
update_on_change_command = cfg.updateOnChangeCommand;
|
||||
clearjumps_on_change = cfg.clearJumpsOnChange;
|
||||
inherit autopush;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
|
@ -66,17 +69,15 @@ in {
|
|||
plenary-nvim
|
||||
];
|
||||
|
||||
extraPackages = [pkgs.git];
|
||||
extraPackages = [ pkgs.git ];
|
||||
|
||||
extraConfigLua = let
|
||||
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
|
||||
in ''
|
||||
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
|
||||
${
|
||||
if cfg.enableTelescope
|
||||
then telescopeCfg
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
extraConfigLua =
|
||||
let
|
||||
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
|
||||
in
|
||||
''
|
||||
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.gitblame;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.gitblame = {
|
||||
enable = mkEnableOption "gitblame";
|
||||
|
@ -22,40 +24,47 @@ in {
|
|||
|
||||
highlightGroup = helpers.defaultNullOpts.mkStr "Comment" "The highlight group for virtual text.";
|
||||
|
||||
displayVirtualText = helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true) "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
|
||||
displayVirtualText =
|
||||
helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true)
|
||||
"If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline.";
|
||||
|
||||
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString []) "A list of filetypes for which gitblame information will not be displayed.";
|
||||
ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString
|
||||
[ ]
|
||||
) "A list of filetypes for which gitblame information will not be displayed.";
|
||||
|
||||
delay = helpers.defaultNullOpts.mkUnsignedInt 0 "The delay in milliseconds after which the blame info will be displayed.";
|
||||
delay =
|
||||
helpers.defaultNullOpts.mkUnsignedInt 0
|
||||
"The delay in milliseconds after which the blame info will be displayed.";
|
||||
|
||||
virtualTextColumn = helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null) "Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
|
||||
virtualTextColumn =
|
||||
helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null)
|
||||
"Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL.";
|
||||
|
||||
extmarkOptions = helpers.defaultNullOpts.mkAttributeSet (toString null) "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
setupOptions = {
|
||||
enabled = cfg.enable;
|
||||
message_template = cfg.messageTemplate;
|
||||
date_format = cfg.dateFormat;
|
||||
message_when_not_committed = cfg.messageWhenNotCommitted;
|
||||
highlight_group = cfg.highlightGroup;
|
||||
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
|
||||
if cfg.displayVirtualText
|
||||
then 1
|
||||
else 0
|
||||
);
|
||||
ignored_filetypes = cfg.ignoredFiletypes;
|
||||
inherit (cfg) delay;
|
||||
virtual_text_column = cfg.virtualTextColumn;
|
||||
set_extmark_options = cfg.extmarkOptions;
|
||||
};
|
||||
in
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
enabled = cfg.enable;
|
||||
message_template = cfg.messageTemplate;
|
||||
date_format = cfg.dateFormat;
|
||||
message_when_not_committed = cfg.messageWhenNotCommitted;
|
||||
highlight_group = cfg.highlightGroup;
|
||||
display_virtual_text = helpers.ifNonNull' cfg.displayVirtualText (
|
||||
if cfg.displayVirtualText then 1 else 0
|
||||
);
|
||||
ignored_filetypes = cfg.ignoredFiletypes;
|
||||
inherit (cfg) delay;
|
||||
virtual_text_column = cfg.virtualTextColumn;
|
||||
set_extmark_options = cfg.extmarkOptions;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraPackages = [pkgs.git];
|
||||
extraPackages = [ pkgs.git ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('gitblame').setup${helpers.toLuaObject setupOptions}
|
||||
|
|
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