mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
added formatter + reformat existing codebase (#175)
This commit is contained in:
parent
0bf4313f22
commit
264de8cefb
96 changed files with 3727 additions and 3341 deletions
14
default.nix
14
default.nix
|
@ -1,7 +1,9 @@
|
||||||
(import (
|
(import (
|
||||||
fetchTarball {
|
fetchTarball {
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/c75e76f80c57784a6734356315b306140646ee84.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/c75e76f80c57784a6734356315b306140646ee84.tar.gz";
|
||||||
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h"; }
|
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h";
|
||||||
) {
|
}
|
||||||
src = ./.;
|
) {
|
||||||
}).defaultNix
|
src = ./.;
|
||||||
|
})
|
||||||
|
.defaultNix
|
||||||
|
|
46
docs.nix
46
docs.nix
|
@ -1,8 +1,12 @@
|
||||||
{ pkgs, lib, modules, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
lib,
|
||||||
|
modules,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
options = lib.evalModules {
|
options = lib.evalModules {
|
||||||
modules = modules;
|
modules = modules;
|
||||||
specialArgs = { inherit pkgs lib; };
|
specialArgs = {inherit pkgs lib;};
|
||||||
};
|
};
|
||||||
docs = pkgs.nixosOptionsDoc {
|
docs = pkgs.nixosOptionsDoc {
|
||||||
# If we don't do this, we end up with _module.args on the generated options, which we do not want
|
# If we don't do this, we end up with _module.args on the generated options, which we do not want
|
||||||
|
@ -11,25 +15,25 @@ let
|
||||||
};
|
};
|
||||||
asciidoc = docs.optionsAsciiDoc;
|
asciidoc = docs.optionsAsciiDoc;
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "nixvim-docs";
|
name = "nixvim-docs";
|
||||||
|
|
||||||
src = asciidoc;
|
src = asciidoc;
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.asciidoctor
|
pkgs.asciidoctor
|
||||||
];
|
];
|
||||||
|
|
||||||
phases = [ "buildPhase" ];
|
phases = ["buildPhase"];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
mkdir -p $out/share/doc
|
mkdir -p $out/share/doc
|
||||||
cat <<EOF > header.adoc
|
cat <<EOF > header.adoc
|
||||||
= NixVim options
|
= NixVim options
|
||||||
This lists all the options available for NixVim.
|
This lists all the options available for NixVim.
|
||||||
:toc:
|
:toc:
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
cat header.adoc $src > tmp.adoc
|
cat header.adoc $src > tmp.adoc
|
||||||
asciidoctor tmp.adoc -o $out/share/doc/index.html
|
asciidoctor tmp.adoc -o $out/share/doc/index.html
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{pkgs, ...}: {
|
||||||
{
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
# This just enables NixVim.
|
# This just enables NixVim.
|
||||||
# If all you have is this, then there will be little visible difference
|
# If all you have is this, then there will be little visible difference
|
||||||
|
@ -53,8 +52,8 @@
|
||||||
# This is one of lightline's example configurations
|
# This is one of lightline's example configurations
|
||||||
active = {
|
active = {
|
||||||
left = [
|
left = [
|
||||||
[ "mode" "paste" ]
|
["mode" "paste"]
|
||||||
[ "redaonly" "filename" "modified" "helloworld" ]
|
["redaonly" "filename" "modified" "helloworld"]
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@
|
||||||
|
|
||||||
# What about plugins not available as a module?
|
# What about plugins not available as a module?
|
||||||
# Use extraPlugins:
|
# Use extraPlugins:
|
||||||
extraPlugins = with pkgs.vimPlugins; [ vim-toml ];
|
extraPlugins = with pkgs.vimPlugins; [vim-toml];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
154
flake.nix
154
flake.nix
|
@ -6,92 +6,108 @@
|
||||||
inputs.beautysh.url = "github:lovesegfault/beautysh";
|
inputs.beautysh.url = "github:lovesegfault/beautysh";
|
||||||
inputs.beautysh.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.beautysh.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
...
|
||||||
|
} @ inputs:
|
||||||
with nixpkgs.lib;
|
with nixpkgs.lib;
|
||||||
with builtins;
|
with builtins; let
|
||||||
let
|
|
||||||
# TODO: Support nesting
|
# TODO: Support nesting
|
||||||
nixvimModules = map (f: ./modules + "/${f}") (attrNames (builtins.readDir ./modules));
|
nixvimModules = map (f: ./modules + "/${f}") (attrNames (builtins.readDir ./modules));
|
||||||
|
|
||||||
modules = pkgs: nixvimModules ++ [
|
modules = pkgs:
|
||||||
(rec {
|
nixvimModules
|
||||||
_file = ./flake.nix;
|
++ [
|
||||||
key = _file;
|
rec {
|
||||||
config = {
|
_file = ./flake.nix;
|
||||||
_module.args = {
|
key = _file;
|
||||||
pkgs = mkForce pkgs;
|
config = {
|
||||||
inherit (pkgs) lib;
|
_module.args = {
|
||||||
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
|
pkgs = mkForce pkgs;
|
||||||
inputs = inputs;
|
inherit (pkgs) lib;
|
||||||
|
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
|
||||||
|
inputs = inputs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
})
|
|
||||||
|
|
||||||
# ./plugins/default.nix
|
# ./plugins/default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
flakeOutput =
|
flakeOutput =
|
||||||
flake-utils.lib.eachDefaultSystem
|
flake-utils.lib.eachDefaultSystem
|
||||||
(system:
|
(system: let
|
||||||
let
|
pkgs = import nixpkgs {inherit system;};
|
||||||
pkgs = import nixpkgs { inherit system; };
|
extractRustAnalyzer = {
|
||||||
extractRustAnalyzer = { stdenv, pkgs }: stdenv.mkDerivation {
|
stdenv,
|
||||||
pname = "extract_rust_analyzer";
|
pkgs,
|
||||||
version = "master";
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "extract_rust_analyzer";
|
||||||
|
version = "master";
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
buildInputs = [ pkgs.python3 ];
|
buildInputs = [pkgs.python3];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
ls -la
|
ls -la
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
|
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { };
|
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer {};
|
||||||
in
|
in {
|
||||||
{
|
packages = {
|
||||||
packages = {
|
docs = pkgs.callPackage (import ./docs.nix) {
|
||||||
docs = pkgs.callPackage (import ./docs.nix) {
|
modules = nixvimModules;
|
||||||
modules = nixvimModules;
|
};
|
||||||
};
|
runUpdates =
|
||||||
runUpdates = pkgs.callPackage
|
pkgs.callPackage
|
||||||
({ pkgs, stdenv }: stdenv.mkDerivation {
|
({
|
||||||
pname = "run-updates";
|
pkgs,
|
||||||
version = pkgs.rust-analyzer.version;
|
stdenv,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "run-updates";
|
||||||
|
version = pkgs.rust-analyzer.version;
|
||||||
|
|
||||||
src = pkgs.rust-analyzer.src;
|
src = pkgs.rust-analyzer.src;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra nixpkgs-fmt];
|
nativeBuildInputs = with pkgs; [extractRustAnalyzerPkg alejandra nixpkgs-fmt];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
extract_rust_analyzer.py editors/code/package.json |
|
extract_rust_analyzer.py editors/code/package.json |
|
||||||
alejandra --quiet |
|
alejandra --quiet |
|
||||||
nixpkgs-fmt > rust-analyzer-config.nix
|
nixpkgs-fmt > rust-analyzer-config.nix
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share
|
mkdir -p $out/share
|
||||||
cp rust-analyzer-config.nix $out/share
|
cp rust-analyzer-config.nix $out/share
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
{ };
|
{};
|
||||||
};
|
};
|
||||||
legacyPackages = rec {
|
legacyPackages = rec {
|
||||||
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
|
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
|
||||||
makeNixvim = configuration: makeNixvimWithModule {
|
makeNixvim = configuration:
|
||||||
module = {
|
makeNixvimWithModule {
|
||||||
config = configuration;
|
module = {
|
||||||
};
|
config = configuration;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
});
|
||||||
in
|
in
|
||||||
flakeOutput // {
|
flakeOutput
|
||||||
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
|
// {
|
||||||
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
|
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
|
||||||
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
|
||||||
};
|
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
259
lib/helpers.nix
259
lib/helpers.nix
|
@ -1,146 +1,185 @@
|
||||||
{ lib, ... }:
|
{lib, ...}:
|
||||||
with lib;
|
with lib; rec {
|
||||||
rec {
|
|
||||||
# vim dictionaries are, in theory, compatible with JSON
|
# vim dictionaries are, in theory, compatible with JSON
|
||||||
toVimDict = args: toJSON
|
toVimDict = args:
|
||||||
|
toJSON
|
||||||
(lib.filterAttrs (n: v: !isNull v) args);
|
(lib.filterAttrs (n: v: !isNull v) args);
|
||||||
|
|
||||||
# Black functional magic that converts a bunch of different Nix types to their
|
# Black functional magic that converts a bunch of different Nix types to their
|
||||||
# lua equivalents!
|
# lua equivalents!
|
||||||
toLuaObject = args:
|
toLuaObject = args:
|
||||||
if builtins.isAttrs args then
|
if builtins.isAttrs args
|
||||||
if hasAttr "__raw" args then
|
then
|
||||||
args.__raw
|
if hasAttr "__raw" args
|
||||||
|
then args.__raw
|
||||||
else
|
else
|
||||||
"{" + (concatStringsSep ","
|
"{"
|
||||||
|
+ (concatStringsSep ","
|
||||||
(mapAttrsToList
|
(mapAttrsToList
|
||||||
(n: v:
|
(n: v:
|
||||||
if head (stringToCharacters n) == "@" then
|
if head (stringToCharacters n) == "@"
|
||||||
toLuaObject v
|
then toLuaObject v
|
||||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||||
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args))) + "}"
|
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args)))
|
||||||
else if builtins.isList args then
|
+ "}"
|
||||||
"{" + concatMapStringsSep "," toLuaObject args + "}"
|
else if builtins.isList args
|
||||||
else if builtins.isString args then
|
then "{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||||
# This should be enough!
|
else if builtins.isString args
|
||||||
|
then
|
||||||
|
# This should be enough!
|
||||||
builtins.toJSON args
|
builtins.toJSON args
|
||||||
else if builtins.isPath args then
|
else if builtins.isPath args
|
||||||
builtins.toJSON (toString args)
|
then builtins.toJSON (toString args)
|
||||||
else if builtins.isBool args then
|
else if builtins.isBool args
|
||||||
"${ boolToString args }"
|
then "${boolToString args}"
|
||||||
else if builtins.isFloat args then
|
else if builtins.isFloat args
|
||||||
"${ toString args }"
|
then "${toString args}"
|
||||||
else if builtins.isInt args then
|
else if builtins.isInt args
|
||||||
"${ toString args }"
|
then "${toString args}"
|
||||||
else if isNull args then
|
else if isNull args
|
||||||
"nil"
|
then "nil"
|
||||||
else "";
|
else "";
|
||||||
|
|
||||||
# Generates maps for a lua config
|
# Generates maps for a lua config
|
||||||
genMaps = mode: maps:
|
genMaps = mode: maps: let
|
||||||
let
|
normalized =
|
||||||
normalized = builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(key: action:
|
|
||||||
if builtins.isString action then
|
|
||||||
{
|
|
||||||
silent = false;
|
|
||||||
expr = false;
|
|
||||||
unique = false;
|
|
||||||
noremap = true;
|
|
||||||
script = false;
|
|
||||||
nowait = false;
|
|
||||||
action = action;
|
|
||||||
}
|
|
||||||
else action)
|
|
||||||
maps;
|
|
||||||
in
|
|
||||||
builtins.attrValues (builtins.mapAttrs
|
|
||||||
(key: action:
|
(key: action:
|
||||||
{
|
if builtins.isString action
|
||||||
action = action.action;
|
then {
|
||||||
config = lib.filterAttrs (_: v: v) {
|
silent = false;
|
||||||
inherit (action) silent expr unique noremap script nowait;
|
expr = false;
|
||||||
};
|
unique = false;
|
||||||
key = key;
|
noremap = true;
|
||||||
mode = mode;
|
script = false;
|
||||||
})
|
nowait = false;
|
||||||
|
action = action;
|
||||||
|
}
|
||||||
|
else action)
|
||||||
|
maps;
|
||||||
|
in
|
||||||
|
builtins.attrValues (builtins.mapAttrs
|
||||||
|
(key: action: {
|
||||||
|
action = action.action;
|
||||||
|
config = lib.filterAttrs (_: v: v) {
|
||||||
|
inherit (action) silent expr unique noremap script nowait;
|
||||||
|
};
|
||||||
|
key = key;
|
||||||
|
mode = mode;
|
||||||
|
})
|
||||||
normalized);
|
normalized);
|
||||||
|
|
||||||
# Creates an option with a nullable type that defaults to null.
|
# Creates an option with a nullable type that defaults to null.
|
||||||
mkNullOrOption = type: desc: lib.mkOption {
|
mkNullOrOption = type: desc:
|
||||||
type = lib.types.nullOr type;
|
lib.mkOption {
|
||||||
default = null;
|
type = lib.types.nullOr type;
|
||||||
description = desc;
|
default = null;
|
||||||
};
|
description = desc;
|
||||||
|
};
|
||||||
|
|
||||||
mkIfNonNull = c: mkIf (!isNull c) c;
|
mkIfNonNull = c: mkIf (!isNull c) c;
|
||||||
|
|
||||||
defaultNullOpts = rec {
|
defaultNullOpts = rec {
|
||||||
mkNullable = type: default: desc: mkNullOrOption type (
|
mkNullable = type: default: desc:
|
||||||
let
|
mkNullOrOption type (
|
||||||
defaultDesc = "default: `${default}`";
|
let
|
||||||
in
|
defaultDesc = "default: `${default}`";
|
||||||
if desc == "" then defaultDesc else ''
|
in
|
||||||
${desc}
|
if desc == ""
|
||||||
|
then defaultDesc
|
||||||
|
else ''
|
||||||
|
${desc}
|
||||||
|
|
||||||
${defaultDesc}
|
${defaultDesc}
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
mkInt = default: mkNullable lib.types.int (toString default);
|
mkInt = default: mkNullable lib.types.int (toString default);
|
||||||
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
|
mkBool = default:
|
||||||
|
mkNullable lib.types.bool (
|
||||||
|
if default
|
||||||
|
then "true"
|
||||||
|
else "false"
|
||||||
|
);
|
||||||
mkStr = default: mkNullable lib.types.str ''${builtins.toString default}'';
|
mkStr = default: mkNullable lib.types.str ''${builtins.toString default}'';
|
||||||
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
||||||
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
||||||
};
|
};
|
||||||
|
|
||||||
mkPackageOption = name: default: mkOption {
|
mkPackageOption = name: default:
|
||||||
type = types.package;
|
mkOption {
|
||||||
inherit default;
|
type = types.package;
|
||||||
description = "Plugin to use for ${name}";
|
inherit default;
|
||||||
};
|
description = "Plugin to use for ${name}";
|
||||||
|
|
||||||
mkPlugin = { config, lib, ... }: { name
|
|
||||||
, description
|
|
||||||
, package ? null
|
|
||||||
, extraPlugins ? [ ]
|
|
||||||
, extraPackages ? [ ]
|
|
||||||
, options ? { }
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.plugins.${name};
|
|
||||||
# TODO support nested options!
|
|
||||||
pluginOptions = mapAttrs (k: v: v.option) options;
|
|
||||||
globals = mapAttrs'
|
|
||||||
(name: opt: {
|
|
||||||
name = opt.global;
|
|
||||||
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
|
||||||
})
|
|
||||||
options;
|
|
||||||
# does this evaluate package?
|
|
||||||
packageOption = if package == null then { } else {
|
|
||||||
package = mkPackageOption name package;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.plugins.${name} = {
|
|
||||||
enable = mkEnableOption description;
|
|
||||||
} // packageOption // pluginOptions;
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
inherit extraPackages globals;
|
|
||||||
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
|
||||||
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkPlugin = {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
package ? null,
|
||||||
|
extraPlugins ? [],
|
||||||
|
extraPackages ? [],
|
||||||
|
options ? {},
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.${name};
|
||||||
|
# TODO support nested options!
|
||||||
|
pluginOptions = mapAttrs (k: v: v.option) options;
|
||||||
|
globals =
|
||||||
|
mapAttrs'
|
||||||
|
(name: opt: {
|
||||||
|
name = opt.global;
|
||||||
|
value =
|
||||||
|
if cfg.${name} != null
|
||||||
|
then opt.value cfg.${name}
|
||||||
|
else null;
|
||||||
|
})
|
||||||
|
options;
|
||||||
|
# does this evaluate package?
|
||||||
|
packageOption =
|
||||||
|
if package == null
|
||||||
|
then {}
|
||||||
|
else {
|
||||||
|
package = mkPackageOption name package;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.plugins.${name} =
|
||||||
|
{
|
||||||
|
enable = mkEnableOption description;
|
||||||
|
}
|
||||||
|
// packageOption
|
||||||
|
// pluginOptions;
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
inherit extraPackages globals;
|
||||||
|
# does this evaluate package? it would not be desired to evaluate pacakge if we use another package.
|
||||||
|
extraPlugins = extraPlugins ++ optional (package != null) cfg.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
globalVal = val:
|
globalVal = val:
|
||||||
if builtins.isBool val then
|
if builtins.isBool val
|
||||||
(if val == false then 0 else 1)
|
then
|
||||||
|
(
|
||||||
|
if val == false
|
||||||
|
then 0
|
||||||
|
else 1
|
||||||
|
)
|
||||||
else val;
|
else val;
|
||||||
|
|
||||||
mkDefaultOpt = { type, global, description ? null, example ? null, default ? null, value ? v: (globalVal v), ... }: {
|
mkDefaultOpt = {
|
||||||
|
type,
|
||||||
|
global,
|
||||||
|
description ? null,
|
||||||
|
example ? null,
|
||||||
|
default ? null,
|
||||||
|
value ? v: (globalVal v),
|
||||||
|
...
|
||||||
|
}: {
|
||||||
option = mkOption {
|
option = mkOption {
|
||||||
type = types.nullOr type;
|
type = types.nullOr type;
|
||||||
default = default;
|
default = default;
|
||||||
|
@ -153,7 +192,7 @@ rec {
|
||||||
|
|
||||||
extraOptionsOptions = {
|
extraOptionsOptions = {
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
default = { };
|
default = {};
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
description = ''
|
description = ''
|
||||||
These attributes will be added to the table parameter for the setup function.
|
These attributes will be added to the table parameter for the setup function.
|
||||||
|
@ -162,7 +201,7 @@ rec {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkRaw = r: { __raw = r; };
|
mkRaw = r: {__raw = r;};
|
||||||
|
|
||||||
wrapDo = string: ''
|
wrapDo = string: ''
|
||||||
do
|
do
|
||||||
|
|
|
@ -1,73 +1,74 @@
|
||||||
{ lib, ... }:
|
{lib, ...}:
|
||||||
with lib;
|
with lib; rec {
|
||||||
|
|
||||||
rec {
|
|
||||||
# This should be used instead of mkRemovedOptionModule, when the option still works,
|
# This should be used instead of mkRemovedOptionModule, when the option still works,
|
||||||
# but is just deprecated and should be changed now and for the future
|
# but is just deprecated and should be changed now and for the future
|
||||||
mkDeprecatedOption =
|
mkDeprecatedOption = {
|
||||||
{ option # an array of the path to the option
|
option, # an array of the path to the option
|
||||||
, alternative ? null
|
alternative ? null,
|
||||||
, message ? null
|
message ? null,
|
||||||
, visible ? false
|
visible ? false,
|
||||||
}:
|
}: {
|
||||||
{ options, config, ... }:
|
options,
|
||||||
let
|
config,
|
||||||
fromOpt = getAttrFromPath option options;
|
...
|
||||||
fromValue = getAttrFromPath option config;
|
}: let
|
||||||
fullMessage = "The option `${showOption option}` has been deprecated, but might still work." +
|
fromOpt = getAttrFromPath option options;
|
||||||
(optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.") +
|
fromValue = getAttrFromPath option config;
|
||||||
(optionalString (message != null) " Message: ${message}");
|
fullMessage =
|
||||||
in
|
"The option `${showOption option}` has been deprecated, but might still work."
|
||||||
{
|
+ (optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.")
|
||||||
config = mkIf (fromOpt.isDefined && fromValue != fromOpt.default) {
|
+ (optionalString (message != null) " Message: ${message}");
|
||||||
warnings = [
|
in {
|
||||||
("Nixvim: ${fullMessage}")
|
config = mkIf (fromOpt.isDefined && fromValue != fromOpt.default) {
|
||||||
];
|
warnings = [
|
||||||
};
|
"Nixvim: ${fullMessage}"
|
||||||
};
|
|
||||||
|
|
||||||
mkRenamedOption =
|
|
||||||
{ option
|
|
||||||
, newOption
|
|
||||||
, visible ? false
|
|
||||||
, warn ? true
|
|
||||||
, overrideDescription ? null
|
|
||||||
}:
|
|
||||||
{ options, ... }:
|
|
||||||
let
|
|
||||||
fromOpt = getAttrFromPath option options;
|
|
||||||
# toOf = attrByPath newOption
|
|
||||||
# (abort "Renaming error: option `${showOption newOption}` does not exist.");
|
|
||||||
toType = let opt = attrByPath newOption { } options; in
|
|
||||||
opt.type or (types.submodule { });
|
|
||||||
message = "`${showOption option}` has been renamed to `${showOption newOption}`, but can still be used for compatibility";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = setAttrByPath option (mkOption
|
|
||||||
{
|
|
||||||
inherit visible;
|
|
||||||
description =
|
|
||||||
if overrideDescription == null
|
|
||||||
then message
|
|
||||||
else overrideDescription;
|
|
||||||
} // optionalAttrs (toType != null) {
|
|
||||||
type = toType;
|
|
||||||
});
|
|
||||||
config = mkMerge [
|
|
||||||
{
|
|
||||||
warnings = mkIf (warn && fromOpt.isDefined) [ "Nixvim: ${message}" ];
|
|
||||||
}
|
|
||||||
(mkAliasAndWrapDefinitions (setAttrByPath newOption) fromOpt)
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
mkAliasOption = option: newOption: mkRenamedOption {
|
|
||||||
inherit option newOption;
|
|
||||||
visible = true;
|
|
||||||
warn = false;
|
|
||||||
overrideDescription = "Alias of ${showOption newOption}";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkRenamedOption = {
|
||||||
|
option,
|
||||||
|
newOption,
|
||||||
|
visible ? false,
|
||||||
|
warn ? true,
|
||||||
|
overrideDescription ? null,
|
||||||
|
}: {options, ...}: let
|
||||||
|
fromOpt = getAttrFromPath option options;
|
||||||
|
# toOf = attrByPath newOption
|
||||||
|
# (abort "Renaming error: option `${showOption newOption}` does not exist.");
|
||||||
|
toType = let
|
||||||
|
opt = attrByPath newOption {} options;
|
||||||
|
in
|
||||||
|
opt.type or (types.submodule {});
|
||||||
|
message = "`${showOption option}` has been renamed to `${showOption newOption}`, but can still be used for compatibility";
|
||||||
|
in {
|
||||||
|
options = setAttrByPath option (mkOption
|
||||||
|
{
|
||||||
|
inherit visible;
|
||||||
|
description =
|
||||||
|
if overrideDescription == null
|
||||||
|
then message
|
||||||
|
else overrideDescription;
|
||||||
|
}
|
||||||
|
// optionalAttrs (toType != null) {
|
||||||
|
type = toType;
|
||||||
|
});
|
||||||
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
warnings = mkIf (warn && fromOpt.isDefined) ["Nixvim: ${message}"];
|
||||||
|
}
|
||||||
|
(mkAliasAndWrapDefinitions (setAttrByPath newOption) fromOpt)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
mkAliasOption = option: newOption:
|
||||||
|
mkRenamedOption {
|
||||||
|
inherit option newOption;
|
||||||
|
visible = true;
|
||||||
|
warn = false;
|
||||||
|
overrideDescription = "Alias of ${showOption newOption}";
|
||||||
|
};
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# mkRemovedOption =
|
# mkRemovedOption =
|
||||||
# { option
|
# { option
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
with lib;
|
config,
|
||||||
let
|
lib,
|
||||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||||
|
|
||||||
autoGroupOption = types.submodule {
|
autoGroupOption = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -47,13 +50,11 @@ let
|
||||||
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands.";
|
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
autoGroups = mkOption {
|
autoGroups = mkOption {
|
||||||
type = types.attrsOf autoGroupOption;
|
type = types.attrsOf autoGroupOption;
|
||||||
default = { };
|
default = {};
|
||||||
description = "augroup definitions";
|
description = "augroup definitions";
|
||||||
example = ''
|
example = ''
|
||||||
autoGroups = {
|
autoGroups = {
|
||||||
|
@ -66,7 +67,7 @@ in
|
||||||
|
|
||||||
autoCmd = mkOption {
|
autoCmd = mkOption {
|
||||||
type = types.listOf autoCmdOption;
|
type = types.listOf autoCmdOption;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "autocmd definitions";
|
description = "autocmd definitions";
|
||||||
example = ''
|
example = ''
|
||||||
autoCmd = [
|
autoCmd = [
|
||||||
|
@ -80,40 +81,41 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (config.autoGroups != { } || config.autoCmd != { }) {
|
config = mkIf (config.autoGroups != {} || config.autoCmd != {}) {
|
||||||
extraConfigLuaPost = (optionalString (config.autoGroups != { }) ''
|
extraConfigLuaPost =
|
||||||
-- Set up autogroups {{
|
(optionalString (config.autoGroups != {}) ''
|
||||||
do
|
-- Set up autogroups {{
|
||||||
local __nixvim_autogroups = ${helpers.toLuaObject config.autoGroups}
|
do
|
||||||
|
local __nixvim_autogroups = ${helpers.toLuaObject config.autoGroups}
|
||||||
|
|
||||||
for group_name, options in pairs(__nixvim_autogroups) do
|
for group_name, options in pairs(__nixvim_autogroups) do
|
||||||
vim.api.nvim_create_augroup(group_name, options)
|
vim.api.nvim_create_augroup(group_name, options)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
-- }}
|
||||||
-- }}
|
'')
|
||||||
'') +
|
+ (optionalString (config.autoCmd != []) ''
|
||||||
(optionalString (config.autoCmd != [ ]) ''
|
-- Set up autocommands {{
|
||||||
-- Set up autocommands {{
|
do
|
||||||
do
|
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
||||||
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
|
||||||
|
|
||||||
for _, autocmd in ipairs(__nixvim_autocommands) do
|
for _, autocmd in ipairs(__nixvim_autocommands) do
|
||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd(
|
||||||
autocmd.event,
|
autocmd.event,
|
||||||
{
|
{
|
||||||
group = autocmd.group,
|
group = autocmd.group,
|
||||||
pattern = autocmd.pattern,
|
pattern = autocmd.pattern,
|
||||||
buffer = autocmd.buffer,
|
buffer = autocmd.buffer,
|
||||||
desc = autocmd.desc,
|
desc = autocmd.desc,
|
||||||
callback = autocmd.callback,
|
callback = autocmd.callback,
|
||||||
command = autocmd.command,
|
command = autocmd.command,
|
||||||
once = autocmd.once,
|
once = autocmd.once,
|
||||||
nested = autocmd.nested
|
nested = autocmd.nested
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
-- }}
|
||||||
-- }}
|
'');
|
||||||
'');
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; {
|
||||||
options = {
|
options = {
|
||||||
colorscheme = mkOption {
|
colorscheme = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
|
|
@ -1,56 +1,58 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
let
|
|
||||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
{
|
{
|
||||||
options = {
|
config,
|
||||||
highlight = mkOption {
|
lib,
|
||||||
type = types.attrsOf types.anything;
|
...
|
||||||
default = { };
|
}: let
|
||||||
description = "Define highlight groups";
|
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||||
example = ''
|
in
|
||||||
highlight = {
|
with lib; {
|
||||||
Comment.fg = '#ff0000';
|
options = {
|
||||||
};
|
highlight = mkOption {
|
||||||
'';
|
type = types.attrsOf types.anything;
|
||||||
|
default = {};
|
||||||
|
description = "Define highlight groups";
|
||||||
|
example = ''
|
||||||
|
highlight = {
|
||||||
|
Comment.fg = '#ff0000';
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
match = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
default = {};
|
||||||
|
description = "Define match groups";
|
||||||
|
example = ''
|
||||||
|
match = {
|
||||||
|
ExtraWhitespace = '\\s\\+$';
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
match = mkOption {
|
config = mkIf (config.highlight != {} || config.match != {}) {
|
||||||
type = types.attrsOf types.str;
|
extraConfigLuaPost =
|
||||||
default = { };
|
(optionalString (config.highlight != {}) ''
|
||||||
description = "Define match groups";
|
-- Highlight groups {{
|
||||||
example = ''
|
do
|
||||||
match = {
|
local highlights = ${helpers.toLuaObject config.highlight}
|
||||||
ExtraWhitespace = '\\s\\+$';
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf (config.highlight != { } || config.match != { }) {
|
for k,v in pairs(highlights) do
|
||||||
extraConfigLuaPost = (optionalString (config.highlight != { }) ''
|
vim.api.nvim_set_hl(0, k, v)
|
||||||
-- Highlight groups {{
|
end
|
||||||
do
|
|
||||||
local highlights = ${helpers.toLuaObject config.highlight}
|
|
||||||
|
|
||||||
for k,v in pairs(highlights) do
|
|
||||||
vim.api.nvim_set_hl(0, k, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- }}
|
|
||||||
'') +
|
|
||||||
(optionalString (config.match != { }) ''
|
|
||||||
-- Match groups {{
|
|
||||||
do
|
|
||||||
local match = ${helpers.toLuaObject config.match}
|
|
||||||
|
|
||||||
for k,v in pairs(match) do
|
|
||||||
vim.fn.matchadd(k, v)
|
|
||||||
end
|
end
|
||||||
end
|
-- }}
|
||||||
-- }}
|
'')
|
||||||
'');
|
+ (optionalString (config.match != {}) ''
|
||||||
};
|
-- Match groups {{
|
||||||
}
|
do
|
||||||
|
local match = ${helpers.toLuaObject config.match}
|
||||||
|
|
||||||
|
for k,v in pairs(match) do
|
||||||
|
vim.fn.matchadd(k, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
with lib;
|
config,
|
||||||
let
|
lib,
|
||||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||||
|
|
||||||
mapOption = types.oneOf [
|
mapOption = types.oneOf [
|
||||||
types.str
|
types.str
|
||||||
|
@ -57,13 +60,13 @@ let
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
mapOptions = mode: mkOption {
|
mapOptions = mode:
|
||||||
description = "Mappings for ${mode} mode";
|
mkOption {
|
||||||
type = types.attrsOf mapOption;
|
description = "Mappings for ${mode} mode";
|
||||||
default = { };
|
type = types.attrsOf mapOption;
|
||||||
};
|
default = {};
|
||||||
in
|
};
|
||||||
{
|
in {
|
||||||
options = {
|
options = {
|
||||||
maps = mkOption {
|
maps = mkOption {
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
|
@ -82,7 +85,7 @@ in
|
||||||
command = mapOptions "command-line";
|
command = mapOptions "command-line";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Custom keybindings for any mode.
|
Custom keybindings for any mode.
|
||||||
|
|
||||||
|
@ -101,32 +104,30 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
mappings =
|
||||||
mappings =
|
(helpers.genMaps "" config.maps.normalVisualOp)
|
||||||
(helpers.genMaps "" config.maps.normalVisualOp) ++
|
++ (helpers.genMaps "n" config.maps.normal)
|
||||||
(helpers.genMaps "n" config.maps.normal) ++
|
++ (helpers.genMaps "i" config.maps.insert)
|
||||||
(helpers.genMaps "i" config.maps.insert) ++
|
++ (helpers.genMaps "v" config.maps.visual)
|
||||||
(helpers.genMaps "v" config.maps.visual) ++
|
++ (helpers.genMaps "x" config.maps.visualOnly)
|
||||||
(helpers.genMaps "x" config.maps.visualOnly) ++
|
++ (helpers.genMaps "s" config.maps.select)
|
||||||
(helpers.genMaps "s" config.maps.select) ++
|
++ (helpers.genMaps "t" config.maps.terminal)
|
||||||
(helpers.genMaps "t" config.maps.terminal) ++
|
++ (helpers.genMaps "o" config.maps.operator)
|
||||||
(helpers.genMaps "o" config.maps.operator) ++
|
++ (helpers.genMaps "l" config.maps.lang)
|
||||||
(helpers.genMaps "l" config.maps.lang) ++
|
++ (helpers.genMaps "!" config.maps.insertCommand)
|
||||||
(helpers.genMaps "!" config.maps.insertCommand) ++
|
++ (helpers.genMaps "c" config.maps.command);
|
||||||
(helpers.genMaps "c" config.maps.command);
|
in {
|
||||||
in
|
extraConfigLua = optionalString (mappings != []) ''
|
||||||
{
|
-- Set up keybinds {{{
|
||||||
extraConfigLua = optionalString (mappings != [ ]) ''
|
do
|
||||||
-- Set up keybinds {{{
|
local __nixvim_binds = ${helpers.toLuaObject mappings}
|
||||||
do
|
|
||||||
local __nixvim_binds = ${helpers.toLuaObject mappings}
|
|
||||||
|
|
||||||
for i, map in ipairs(__nixvim_binds) do
|
for i, map in ipairs(__nixvim_binds) do
|
||||||
vim.keymap.set(map.mode, map.key, map.action, map.config)
|
vim.keymap.set(map.mode, map.key, map.action, map.config)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- }}}
|
end
|
||||||
'';
|
-- }}}
|
||||||
};
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,48 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
options = mkOption {
|
options = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
default = { };
|
default = {};
|
||||||
description = "The configuration options, e.g. line numbers";
|
description = "The configuration options, e.g. line numbers";
|
||||||
};
|
};
|
||||||
|
|
||||||
globals = mkOption {
|
globals = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
default = { };
|
default = {};
|
||||||
description = "Global variables";
|
description = "Global variables";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
extraConfigLuaPre = optionalString (config.globals != { }) ''
|
extraConfigLuaPre =
|
||||||
-- Set up globals {{{
|
optionalString (config.globals != {}) ''
|
||||||
do
|
-- Set up globals {{{
|
||||||
local nixvim_globals = ${helpers.toLuaObject config.globals}
|
do
|
||||||
|
local nixvim_globals = ${helpers.toLuaObject config.globals}
|
||||||
|
|
||||||
for k,v in pairs(nixvim_globals) do
|
for k,v in pairs(nixvim_globals) do
|
||||||
vim.g[k] = v
|
vim.g[k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
-- }}}
|
||||||
-- }}}
|
''
|
||||||
'' + optionalString (config.options != { }) ''
|
+ optionalString (config.options != {}) ''
|
||||||
-- Set up options {{{
|
-- Set up options {{{
|
||||||
do
|
do
|
||||||
local nixvim_options = ${helpers.toLuaObject config.options}
|
local nixvim_options = ${helpers.toLuaObject config.options}
|
||||||
|
|
||||||
for k,v in pairs(nixvim_options) do
|
for k,v in pairs(nixvim_options) do
|
||||||
vim.opt[k] = v
|
vim.opt[k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
-- }}}
|
||||||
-- }}}
|
'';
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
pluginWithConfigType = types.submodule {
|
pluginWithConfigType = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
config = mkOption {
|
config = mkOption {
|
||||||
|
@ -9,9 +13,11 @@ let
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
optional = mkEnableOption "optional" // {
|
optional =
|
||||||
description = "Don't load by default (load with :packadd)";
|
mkEnableOption "optional"
|
||||||
};
|
// {
|
||||||
|
description = "Don't load by default (load with :packadd)";
|
||||||
|
};
|
||||||
|
|
||||||
plugin = mkOption {
|
plugin = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -19,8 +25,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
viAlias = mkOption {
|
viAlias = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@ -46,13 +51,13 @@ in
|
||||||
|
|
||||||
extraPlugins = mkOption {
|
extraPlugins = mkOption {
|
||||||
type = with types; listOf (either package pluginWithConfigType);
|
type = with types; listOf (either package pluginWithConfigType);
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "List of vim plugins to install";
|
description = "List of vim plugins to install";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = mkOption {
|
extraPackages = mkOption {
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "Extra packages to be made available to neovim";
|
description = "Extra packages to be made available to neovim";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,7 +79,6 @@ in
|
||||||
description = "Extra contents for init.lua after everything else";
|
description = "Extra contents for init.lua after everything else";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extraConfigVim = mkOption {
|
extraConfigVim = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -101,18 +105,23 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
defaultPlugin = {
|
||||||
|
plugin = null;
|
||||||
|
config = "";
|
||||||
|
optional = false;
|
||||||
|
};
|
||||||
|
|
||||||
defaultPlugin = {
|
normalizedPlugins = map (x:
|
||||||
plugin = null;
|
defaultPlugin
|
||||||
config = "";
|
// (
|
||||||
optional = false;
|
if x ? plugin
|
||||||
};
|
then x
|
||||||
|
else {plugin = x;}
|
||||||
|
))
|
||||||
|
config.extraPlugins;
|
||||||
|
|
||||||
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) config.extraPlugins;
|
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
||||||
|
|
||||||
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
|
||||||
inherit (config) viAlias vimAlias;
|
inherit (config) viAlias vimAlias;
|
||||||
# inherit customRC;
|
# inherit customRC;
|
||||||
plugins = normalizedPlugins;
|
plugins = normalizedPlugins;
|
||||||
|
@ -121,44 +130,47 @@ in
|
||||||
# or more generally before the commit:
|
# or more generally before the commit:
|
||||||
# cda1f8ae468 - neovim: pass packpath via the wrapper
|
# cda1f8ae468 - neovim: pass packpath via the wrapper
|
||||||
// optionalAttrs (functionArgs pkgs.neovimUtils.makeNeovimConfig ? configure) {
|
// optionalAttrs (functionArgs pkgs.neovimUtils.makeNeovimConfig ? configure) {
|
||||||
configure.packages =
|
configure.packages = {
|
||||||
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
nixvim = {
|
||||||
|
start = map (x: x.plugin) normalizedPlugins;
|
||||||
|
opt = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
customRC =
|
customRC =
|
||||||
''
|
''
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
${neovimConfig.neovimRcContent}
|
${neovimConfig.neovimRcContent}
|
||||||
]])
|
]])
|
||||||
'' +
|
''
|
||||||
(optionalString (config.extraConfigLuaPre != "") ''
|
+ (optionalString (config.extraConfigLuaPre != "") ''
|
||||||
${config.extraConfigLuaPre}
|
${config.extraConfigLuaPre}
|
||||||
'') +
|
'')
|
||||||
(optionalString (config.extraConfigVim != "") ''
|
+ (optionalString (config.extraConfigVim != "") ''
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
${config.extraConfigVim}
|
${config.extraConfigVim}
|
||||||
]])
|
]])
|
||||||
'') +
|
'')
|
||||||
(optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
+ (optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||||
${config.extraConfigLua}
|
${config.extraConfigLua}
|
||||||
${config.extraConfigLuaPost}
|
${config.extraConfigLuaPost}
|
||||||
'');
|
'');
|
||||||
|
|
||||||
extraWrapperArgs = builtins.concatStringsSep " " (
|
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||||
(optional (config.extraPackages != [ ])
|
(optional (config.extraPackages != [])
|
||||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
||||||
++
|
++ (optional (config.wrapRc)
|
||||||
(optional (config.wrapRc)
|
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
|
||||||
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
|
);
|
||||||
);
|
|
||||||
|
|
||||||
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig // {
|
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig
|
||||||
|
// {
|
||||||
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
||||||
wrapRc = false;
|
wrapRc = false;
|
||||||
});
|
});
|
||||||
in
|
in {
|
||||||
{
|
finalPackage = wrappedNeovim;
|
||||||
finalPackage = wrappedNeovim;
|
initContent = customRC;
|
||||||
initContent = customRC;
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ ... }:
|
{...}: {
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
../plugins/default.nix
|
../plugins/default.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ lib, ... }:
|
{lib, ...}:
|
||||||
with lib;
|
with lib; {
|
||||||
|
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
warnings = mkOption {
|
warnings = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ lib, pkgs, config, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.barbar;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.barbar;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.barbar = {
|
options.plugins.barbar = {
|
||||||
enable = mkEnableOption "barbar.nvim";
|
enable = mkEnableOption "barbar.nvim";
|
||||||
|
|
||||||
|
@ -65,24 +68,25 @@ in
|
||||||
|
|
||||||
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
||||||
|
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
enable = helpers.defaultNullOpts.mkNullable
|
enable =
|
||||||
(with types; (either bool (enum [ "numbers" "both" ])))
|
helpers.defaultNullOpts.mkNullable
|
||||||
|
(with types; (either bool (enum ["numbers" "both"])))
|
||||||
"true"
|
"true"
|
||||||
''
|
''
|
||||||
Enable/disable icons if set to 'numbers', will show buffer index in the tabline if set to
|
Enable/disable icons if set to 'numbers', will show buffer index in the tabline if set to
|
||||||
'both', will show buffer index and icons in the tabline
|
'both', will show buffer index and icons in the tabline
|
||||||
'';
|
'';
|
||||||
|
|
||||||
customColors = helpers.defaultNullOpts.mkNullable
|
customColors =
|
||||||
|
helpers.defaultNullOpts.mkNullable
|
||||||
(types.either types.bool types.str)
|
(types.either types.bool types.str)
|
||||||
"false"
|
"false"
|
||||||
''
|
''
|
||||||
If set, the icon color will follow its corresponding buffer
|
If set, the icon color will follow its corresponding buffer
|
||||||
highlight group. By default, the Buffer*Icon group is linked to the
|
highlight group. By default, the Buffer*Icon group is linked to the
|
||||||
Buffer* group (see Highlighting below). Otherwise, it will take its
|
Buffer* group (see Highlighting below). Otherwise, it will take its
|
||||||
default value as defined by devicons.
|
default value as defined by devicons.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
separatorActive = helpers.defaultNullOpts.mkStr "▎" "Icon for the active tab separator";
|
separatorActive = helpers.defaultNullOpts.mkStr "▎" "Icon for the active tab separator";
|
||||||
|
@ -122,7 +126,6 @@ in
|
||||||
But only a static string is accepted here.
|
But only a static string is accepted here.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
# Keybinds concept:
|
# Keybinds concept:
|
||||||
# keys = {
|
# keys = {
|
||||||
# previousBuffer = mkBindDef "normal" "Previous buffer" { action = ":BufferPrevious<CR>"; silent = true; } "<A-,>";
|
# previousBuffer = mkBindDef "normal" "Previous buffer" { action = ":BufferPrevious<CR>"; silent = true; } "<A-,>";
|
||||||
|
@ -182,16 +185,16 @@ in
|
||||||
tabpages = cfg.tabpages;
|
tabpages = cfg.tabpages;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
nvim-web-devicons
|
nvim-web-devicons
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('bufferline').setup(${helpers.toLuaObject setupOptions})
|
require('bufferline').setup(${helpers.toLuaObject setupOptions})
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# maps = genMaps cfg.keys;
|
# maps = genMaps cfg.keys;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
{ config, pkgs, lib, ... }@args:
|
{
|
||||||
with lib;
|
config,
|
||||||
let
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.bufferline;
|
cfg = config.plugins.bufferline;
|
||||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||||
helpers = import ../helpers.nix args;
|
helpers = import ../helpers.nix args;
|
||||||
|
|
||||||
highlight = mkOption {
|
highlight = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
guifg = mkOption {
|
guifg = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
@ -20,14 +24,13 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
(optionWarnings.mkDeprecatedOption {
|
(optionWarnings.mkDeprecatedOption {
|
||||||
option = [ "plugins" "bufferline" "indicatorIcon" ];
|
option = ["plugins" "bufferline" "indicatorIcon"];
|
||||||
alternative = [ "plugins" "bufferline" "indicator" "icon" ];
|
alternative = ["plugins" "bufferline" "indicator" "icon"];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -111,7 +114,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
diagnostics = mkOption {
|
diagnostics = mkOption {
|
||||||
type = types.nullOr (types.enum [ false "nvim_lsp" "coc" ]);
|
type = types.nullOr (types.enum [false "nvim_lsp" "coc"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
diagnosticsUpdateInInsert = mkOption {
|
diagnosticsUpdateInInsert = mkOption {
|
||||||
|
@ -147,7 +150,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
separatorStyle = mkOption {
|
separatorStyle = mkOption {
|
||||||
type = types.nullOr (types.enum [ "slant" "thick" "thin" ]);
|
type = types.nullOr (types.enum ["slant" "thick" "thin"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
enforceRegularTabs = mkOption {
|
enforceRegularTabs = mkOption {
|
||||||
|
@ -159,27 +162,27 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
sortBy = mkOption {
|
sortBy = mkOption {
|
||||||
type = types.nullOr (types.enum [ "id" "extension" "relative_directory" "directory" "tabs" ]);
|
type = types.nullOr (types.enum ["id" "extension" "relative_directory" "directory" "tabs"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
indicator = mkOption {
|
indicator = mkOption {
|
||||||
default = { };
|
default = {};
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
icon = mkOption {
|
icon = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = types.nullOr (types.enum [ "icon" "underline" "none" ]);
|
type = types.nullOr (types.enum ["icon" "underline" "none"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
highlights = mkOption {
|
highlights = mkOption {
|
||||||
default = { };
|
default = {};
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
fill = highlight;
|
fill = highlight;
|
||||||
background = highlight;
|
background = highlight;
|
||||||
|
@ -246,16 +249,16 @@ in
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = { };
|
default = {};
|
||||||
description = "Extra options, will override others if defined";
|
description = "Extra options, will override others if defined";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
setupOptions = {
|
||||||
setupOptions = {
|
options =
|
||||||
options = {
|
{
|
||||||
numbers = cfg.numbers;
|
numbers = cfg.numbers;
|
||||||
close_command = cfg.closeCommand;
|
close_command = cfg.closeCommand;
|
||||||
right_mouse_command = cfg.rightMouseCommand;
|
right_mouse_command = cfg.rightMouseCommand;
|
||||||
|
@ -264,10 +267,13 @@ in
|
||||||
# deprecated, but might still work
|
# deprecated, but might still work
|
||||||
indicator_icon = cfg.indicatorIcon;
|
indicator_icon = cfg.indicatorIcon;
|
||||||
indicator =
|
indicator =
|
||||||
if cfg.indicator != null then with cfg.indicator; {
|
if cfg.indicator != null
|
||||||
icon = icon;
|
then
|
||||||
style = style;
|
with cfg.indicator; {
|
||||||
} else null;
|
icon = icon;
|
||||||
|
style = style;
|
||||||
|
}
|
||||||
|
else null;
|
||||||
buffer_close_icon = cfg.bufferCloseIcon;
|
buffer_close_icon = cfg.bufferCloseIcon;
|
||||||
modified_icon = cfg.modifiedIcon;
|
modified_icon = cfg.modifiedIcon;
|
||||||
close_icon = cfg.closeIcon;
|
close_icon = cfg.closeIcon;
|
||||||
|
@ -290,70 +296,74 @@ in
|
||||||
enforce_regular_tabs = cfg.enforceRegularTabs;
|
enforce_regular_tabs = cfg.enforceRegularTabs;
|
||||||
always_show_bufferline = cfg.alwaysShowBufferline;
|
always_show_bufferline = cfg.alwaysShowBufferline;
|
||||||
sort_by = cfg.sortBy;
|
sort_by = cfg.sortBy;
|
||||||
} // cfg.extraOptions;
|
}
|
||||||
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
|
// cfg.extraOptions;
|
||||||
fill = fill;
|
highlights =
|
||||||
background = background;
|
if builtins.isNull cfg.highlights
|
||||||
|
then null
|
||||||
|
else
|
||||||
|
with cfg.highlights; {
|
||||||
|
fill = fill;
|
||||||
|
background = background;
|
||||||
|
|
||||||
tab = tab;
|
tab = tab;
|
||||||
tab_selected = tabSelected;
|
tab_selected = tabSelected;
|
||||||
tab_close = tabClose;
|
tab_close = tabClose;
|
||||||
close_button = closeButton;
|
close_button = closeButton;
|
||||||
close_button_visible = closeButtonVisible;
|
close_button_visible = closeButtonVisible;
|
||||||
close_button_selected = closeButtonSelected;
|
close_button_selected = closeButtonSelected;
|
||||||
|
|
||||||
buffer_visible = bufferVisible;
|
buffer_visible = bufferVisible;
|
||||||
buffer_selected = bufferSelected;
|
buffer_selected = bufferSelected;
|
||||||
|
|
||||||
diagnostic = diagnostic;
|
diagnostic = diagnostic;
|
||||||
diagnostic_visible = diagnosticVisible;
|
diagnostic_visible = diagnosticVisible;
|
||||||
diagnostic_selected = diagnosticSelected;
|
diagnostic_selected = diagnosticSelected;
|
||||||
|
|
||||||
info = info;
|
info = info;
|
||||||
info_visible = infoVisible;
|
info_visible = infoVisible;
|
||||||
info_selected = infoSelected;
|
info_selected = infoSelected;
|
||||||
|
|
||||||
info_diagnostic = infoDiagnostic;
|
info_diagnostic = infoDiagnostic;
|
||||||
info_diagnostic_visible = infoDiagnosticVisible;
|
info_diagnostic_visible = infoDiagnosticVisible;
|
||||||
info_diagnostic_selected = infoDiagnosticSelected;
|
info_diagnostic_selected = infoDiagnosticSelected;
|
||||||
|
|
||||||
warning = warning;
|
warning = warning;
|
||||||
warning_visible = warningVisible;
|
warning_visible = warningVisible;
|
||||||
warning_selected = warningSelected;
|
warning_selected = warningSelected;
|
||||||
|
|
||||||
warning_diagnostic = warningDiagnostic;
|
warning_diagnostic = warningDiagnostic;
|
||||||
warning_diagnostic_visible = warningDiagnosticVisible;
|
warning_diagnostic_visible = warningDiagnosticVisible;
|
||||||
warning_diagnostic_selected = warningDiagnosticSelected;
|
warning_diagnostic_selected = warningDiagnosticSelected;
|
||||||
|
|
||||||
error = error;
|
error = error;
|
||||||
error_visible = errorVisible;
|
error_visible = errorVisible;
|
||||||
error_selected = errorSelected;
|
error_selected = errorSelected;
|
||||||
|
|
||||||
error_dagnostic = errorDiagnostic;
|
error_dagnostic = errorDiagnostic;
|
||||||
error_diagnostic_visible = errorDiagnosticVisible;
|
error_diagnostic_visible = errorDiagnosticVisible;
|
||||||
error_diagnostic_selected = errorDiagnosticSelected;
|
error_diagnostic_selected = errorDiagnosticSelected;
|
||||||
|
|
||||||
modified = modified;
|
modified = modified;
|
||||||
modified_visible = modifiedVisible;
|
modified_visible = modifiedVisible;
|
||||||
modified_selected = modifiedSelected;
|
modified_selected = modifiedSelected;
|
||||||
|
|
||||||
duplicate = duplicate;
|
duplicate = duplicate;
|
||||||
duplicate_visible = duplicateVisible;
|
duplicate_visible = duplicateVisible;
|
||||||
duplicate_selected = duplicateSelected;
|
duplicate_selected = duplicateSelected;
|
||||||
|
|
||||||
separator = separator;
|
separator = separator;
|
||||||
separator_visible = separatorVisible;
|
separator_visible = separatorVisible;
|
||||||
separator_selected = separatorSelected;
|
separator_selected = separatorSelected;
|
||||||
|
|
||||||
indicator_selected = indicatorSelected;
|
indicator_selected = indicatorSelected;
|
||||||
|
|
||||||
pick = pick;
|
pick = pick;
|
||||||
pick_visible = pickVisible;
|
pick_visible = pickVisible;
|
||||||
pick_selected = pickSelected;
|
pick_selected = pickSelected;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.colorschemes.base16;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
themes = import ./base16-list.nix;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.colorschemes.base16;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
themes = import ./base16-list.nix;
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
colorschemes.base16 = {
|
colorschemes.base16 = {
|
||||||
enable = mkEnableOption "base16";
|
enable = mkEnableOption "base16";
|
||||||
|
@ -34,7 +37,7 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "base16-${cfg.colorscheme}";
|
colorscheme = "base16-${cfg.colorscheme}";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
|
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
|
||||||
plugins.lightline.colorscheme = null;
|
plugins.lightline.colorscheme = null;
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.colorschemes.gruvbox;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
colors = types.enum [ "bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4" ];
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.colorschemes.gruvbox;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
colors = types.enum ["bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4"];
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
colorschemes.gruvbox = {
|
colorschemes.gruvbox = {
|
||||||
enable = mkEnableOption "gruvbox";
|
enable = mkEnableOption "gruvbox";
|
||||||
|
@ -18,13 +21,13 @@ in
|
||||||
undercurl = mkEnableOption "undercurled text";
|
undercurl = mkEnableOption "undercurled text";
|
||||||
|
|
||||||
contrastDark = mkOption {
|
contrastDark = mkOption {
|
||||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
type = types.nullOr (types.enum ["soft" "medium" "hard"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Contrast for the dark mode";
|
description = "Contrast for the dark mode";
|
||||||
};
|
};
|
||||||
|
|
||||||
contrastLight = mkOption {
|
contrastLight = mkOption {
|
||||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
type = types.nullOr (types.enum ["soft" "medium" "hard"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Contrast for the light mode";
|
description = "Contrast for the light mode";
|
||||||
};
|
};
|
||||||
|
@ -110,13 +113,12 @@ in
|
||||||
transparentBg = mkEnableOption "transparent background";
|
transparentBg = mkEnableOption "transparent background";
|
||||||
|
|
||||||
trueColor = mkEnableOption "true color support";
|
trueColor = mkEnableOption "true color support";
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "gruvbox";
|
colorscheme = "gruvbox";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
gruvbox_bold = mkIf (!cfg.bold) 0;
|
gruvbox_bold = mkIf (!cfg.bold) 0;
|
||||||
|
|
|
@ -1,29 +1,37 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.colorschemes.nord;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.colorschemes.nord;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
colorschemes.nord = {
|
colorschemes.nord = {
|
||||||
enable = mkEnableOption "nord";
|
enable = mkEnableOption "nord";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim;
|
package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim;
|
||||||
|
|
||||||
contrast = mkEnableOption
|
contrast =
|
||||||
|
mkEnableOption
|
||||||
"Make sidebars and popup menus like nvim-tree and telescope have a different background";
|
"Make sidebars and popup menus like nvim-tree and telescope have a different background";
|
||||||
|
|
||||||
borders = mkEnableOption
|
borders =
|
||||||
|
mkEnableOption
|
||||||
"Enable the border between verticaly split windows visable";
|
"Enable the border between verticaly split windows visable";
|
||||||
|
|
||||||
disable_background = mkEnableOption
|
disable_background =
|
||||||
|
mkEnableOption
|
||||||
"Disable the setting of background color so that NeoVim can use your terminal background";
|
"Disable the setting of background color so that NeoVim can use your terminal background";
|
||||||
|
|
||||||
cursorline_transparent = mkEnableOption
|
cursorline_transparent =
|
||||||
|
mkEnableOption
|
||||||
"Set the cursorline transparent/visible";
|
"Set the cursorline transparent/visible";
|
||||||
|
|
||||||
enable_sidebar_background = mkEnableOption
|
enable_sidebar_background =
|
||||||
|
mkEnableOption
|
||||||
"Re-enables the background of the sidebar if you disabled the background of everything";
|
"Re-enables the background of the sidebar if you disabled the background of everything";
|
||||||
|
|
||||||
italic = mkOption {
|
italic = mkOption {
|
||||||
|
@ -36,7 +44,7 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "nord";
|
colorscheme = "nord";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
nord_contrast = mkIf cfg.contrast 1;
|
nord_contrast = mkIf cfg.contrast 1;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.colorschemes.one;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.colorschemes.one;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
colorschemes.one = {
|
colorschemes.one = {
|
||||||
enable = mkEnableOption "vim-one";
|
enable = mkEnableOption "vim-one";
|
||||||
|
@ -15,7 +18,7 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "one";
|
colorscheme = "one";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
termguicolors = true;
|
termguicolors = true;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.colorschemes.onedark;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.colorschemes.onedark;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
colorschemes.onedark = {
|
colorschemes.onedark = {
|
||||||
enable = mkEnableOption "onedark";
|
enable = mkEnableOption "onedark";
|
||||||
|
@ -15,7 +18,7 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "onedark";
|
colorscheme = "onedark";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
termguicolors = true;
|
termguicolors = true;
|
||||||
|
|
|
@ -1,76 +1,72 @@
|
||||||
{ pkgs
|
{
|
||||||
, config
|
pkgs,
|
||||||
, lib
|
config,
|
||||||
, ...
|
lib,
|
||||||
}@args:
|
...
|
||||||
|
} @ args:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.colorschemes.tokyonight;
|
cfg = config.colorschemes.tokyonight;
|
||||||
helpers = import ../helpers.nix args;
|
helpers = import ../helpers.nix args;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
colorschemes.tokyonight = {
|
colorschemes.tokyonight = {
|
||||||
enable = mkEnableOption "tokyonight";
|
enable = mkEnableOption "tokyonight";
|
||||||
package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
|
package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
|
||||||
style = helpers.defaultNullOpts.mkEnumFirstDefault [ "storm" "night" "day" ] "Theme style";
|
style = helpers.defaultNullOpts.mkEnumFirstDefault ["storm" "night" "day"] "Theme style";
|
||||||
terminalColors =
|
terminalColors =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
"Configure the colors used when opening a :terminal in Neovim";
|
"Configure the colors used when opening a :terminal in Neovim";
|
||||||
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
||||||
styles =
|
styles = let
|
||||||
let
|
mkBackgroundStyle = name:
|
||||||
mkBackgroundStyle = name:
|
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "dark" "transparent" "normal" ]
|
"Background style for ${name}";
|
||||||
"Background style for ${name}";
|
in {
|
||||||
in
|
comments =
|
||||||
{
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||||
comments =
|
"Define comments highlight properties";
|
||||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
keywords =
|
||||||
"Define comments highlight properties";
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||||
keywords =
|
"Define keywords highlight properties";
|
||||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
functions =
|
||||||
"Define keywords highlight properties";
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
||||||
functions =
|
"Define functions highlight properties";
|
||||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
variables =
|
||||||
"Define functions highlight properties";
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
||||||
variables =
|
"Define variables highlight properties";
|
||||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
sidebars = mkBackgroundStyle "sidebars";
|
||||||
"Define variables highlight properties";
|
floats = mkBackgroundStyle "floats";
|
||||||
sidebars = mkBackgroundStyle "sidebars";
|
};
|
||||||
floats = mkBackgroundStyle "floats";
|
|
||||||
};
|
|
||||||
sidebars =
|
sidebars =
|
||||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["qf" "help"]''
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["qf" "help"]''
|
||||||
"Set a darker background on sidebar-like windows";
|
"Set a darker background on sidebar-like windows";
|
||||||
dayBrightness =
|
dayBrightness =
|
||||||
helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3"
|
helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3"
|
||||||
"Adjusts the brightness of the colors of the **Day** style";
|
"Adjusts the brightness of the colors of the **Day** style";
|
||||||
hideInactiveStatusline =
|
hideInactiveStatusline =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"Enabling this option will hide inactive statuslines and replace them with a thin border";
|
"Enabling this option will hide inactive statuslines and replace them with a thin border";
|
||||||
dimInactive = helpers.defaultNullOpts.mkBool false "dims inactive windows";
|
dimInactive = helpers.defaultNullOpts.mkBool false "dims inactive windows";
|
||||||
lualineBold =
|
lualineBold =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"When true, section headers in the lualine theme will be bold";
|
"When true, section headers in the lualine theme will be bold";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
colorscheme = "tokyonight";
|
colorscheme = "tokyonight";
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
options = { termguicolors = true; };
|
options = {termguicolors = true;};
|
||||||
extraConfigLuaPre =
|
extraConfigLuaPre = let
|
||||||
let
|
setupOptions = with cfg; {
|
||||||
setupOptions = with cfg; {
|
inherit (cfg) style transparent styles sidebars;
|
||||||
inherit (cfg) style transparent styles sidebars;
|
terminal_colors = terminalColors;
|
||||||
terminal_colors = terminalColors;
|
hide_inactive_statusline = hideInactiveStatusline;
|
||||||
hide_inactive_statusline = hideInactiveStatusline;
|
dim_inactive = dimInactive;
|
||||||
dim_inactive = dimInactive;
|
lualine_bold = lualineBold;
|
||||||
lualine_bold = lualineBold;
|
day_brightness = dayBrightness;
|
||||||
day_brightness = dayBrightness;
|
};
|
||||||
};
|
in ''
|
||||||
in
|
require("tokyonight").setup(${helpers.toLuaObject setupOptions})
|
||||||
''
|
'';
|
||||||
require("tokyonight").setup(${helpers.toLuaObject setupOptions})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.copilot;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.copilot;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.copilot = {
|
plugins.copilot = {
|
||||||
enable = mkEnableOption "copilot";
|
enable = mkEnableOption "copilot";
|
||||||
|
@ -12,11 +15,11 @@ in
|
||||||
filetypes = mkOption {
|
filetypes = mkOption {
|
||||||
type = types.attrsOf types.bool;
|
type = types.attrsOf types.bool;
|
||||||
description = "A dictionary mapping file types to their enabled status";
|
description = "A dictionary mapping file types to their enabled status";
|
||||||
default = { };
|
default = {};
|
||||||
example = literalExpression ''{
|
example = literalExpression '' {
|
||||||
"*": false,
|
"*": false,
|
||||||
python: true
|
python: true
|
||||||
}'';
|
}'';
|
||||||
};
|
};
|
||||||
proxy = mkOption {
|
proxy = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
@ -27,12 +30,17 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = mkIf cfg.enable {
|
||||||
mkIf cfg.enable {
|
extraPlugins = [cfg.package];
|
||||||
extraPlugins = [ cfg.package ];
|
globals =
|
||||||
globals = {
|
{
|
||||||
copilot_node_command = "${pkgs.nodejs-16_x}/bin/node";
|
copilot_node_command = "${pkgs.nodejs-16_x}/bin/node";
|
||||||
copilot_filetypes = cfg.filetypes;
|
copilot_filetypes = cfg.filetypes;
|
||||||
} // (if cfg.proxy != null then { copilot_proxy = cfg.proxy; } else { });
|
}
|
||||||
};
|
// (
|
||||||
|
if cfg.proxy != null
|
||||||
|
then {copilot_proxy = cfg.proxy;}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
{ pkgs, lib, config, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.coq-nvim;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
plugins = import ../plugin-defs.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.coq-nvim;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.coq-nvim = {
|
plugins.coq-nvim = {
|
||||||
enable = mkEnableOption "coq-nvim";
|
enable = mkEnableOption "coq-nvim";
|
||||||
|
@ -16,7 +18,7 @@ in
|
||||||
installArtifacts = mkEnableOption "Install coq-artifacts";
|
installArtifacts = mkEnableOption "Install coq-artifacts";
|
||||||
|
|
||||||
autoStart = mkOption {
|
autoStart = mkOption {
|
||||||
type = with types; nullOr (oneOf [ bool (enum [ "shut-up" ]) ]);
|
type = with types; nullOr (oneOf [bool (enum ["shut-up"])]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Auto-start or shut up";
|
description = "Auto-start or shut up";
|
||||||
};
|
};
|
||||||
|
@ -28,23 +30,24 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config =
|
config = let
|
||||||
let
|
settings = {
|
||||||
settings = {
|
auto_start = cfg.autoStart;
|
||||||
auto_start = cfg.autoStart;
|
"keymap.recommended" = cfg.recommendedKeymaps;
|
||||||
"keymap.recommended" = cfg.recommendedKeymaps;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [
|
extraPlugins =
|
||||||
cfg.package
|
[
|
||||||
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
|
cfg.package
|
||||||
|
]
|
||||||
|
++ optional cfg.installArtifacts plugins.coq-artifacts;
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
preConfig = ''
|
preConfig = ''
|
||||||
vim.g.coq_settings = ${helpers.toLuaObject settings}
|
vim.g.coq_settings = ${helpers.toLuaObject settings}
|
||||||
local coq = require 'coq'
|
local coq = require 'coq'
|
||||||
'';
|
'';
|
||||||
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
|
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.lspkind;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lspkind;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.lspkind = {
|
options.plugins.lspkind = {
|
||||||
enable = mkEnableOption "lspkind.nvim";
|
enable = mkEnableOption "lspkind.nvim";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = with types; nullOr (enum [ "text" "text_symbol" "symbol_text" "symbol" ]);
|
type = with types; nullOr (enum ["text" "text_symbol" "symbol_text" "symbol"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Defines how annotations are shown";
|
description = "Defines how annotations are shown";
|
||||||
};
|
};
|
||||||
|
|
||||||
preset = mkOption {
|
preset = mkOption {
|
||||||
type = with types; nullOr (enum [ "default" "codicons" ]);
|
type = with types; nullOr (enum ["default" "codicons"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Default symbol map";
|
description = "Default symbol map";
|
||||||
};
|
};
|
||||||
|
@ -61,34 +64,41 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
|
||||||
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
|
options =
|
||||||
options = {
|
{
|
||||||
mode = cfg.mode;
|
mode = cfg.mode;
|
||||||
preset = cfg.preset;
|
preset = cfg.preset;
|
||||||
symbol_map = cfg.symbolMap;
|
symbol_map = cfg.symbolMap;
|
||||||
} // (if doCmp then {
|
}
|
||||||
maxwidth = cfg.cmp.maxWidth;
|
// (
|
||||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
if doCmp
|
||||||
menu = cfg.cmp.menu;
|
then {
|
||||||
} else { });
|
maxwidth = cfg.cmp.maxWidth;
|
||||||
in
|
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||||
|
menu = cfg.cmp.menu;
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = optionalString (!doCmp) ''
|
extraConfigLua = optionalString (!doCmp) ''
|
||||||
require('lspkind').init(${helpers.toLuaObject options})
|
require('lspkind').init(${helpers.toLuaObject options})
|
||||||
'';
|
'';
|
||||||
|
|
||||||
plugins.nvim-cmp.formatting.format =
|
plugins.nvim-cmp.formatting.format =
|
||||||
if cfg.cmp.after != null then ''
|
if cfg.cmp.after != null
|
||||||
|
then ''
|
||||||
function(entry, vim_item)
|
function(entry, vim_item)
|
||||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||||
|
|
||||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||||
end
|
end
|
||||||
'' else ''
|
''
|
||||||
|
else ''
|
||||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,54 +1,64 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
|
||||||
let
|
|
||||||
helpers = import ../../helpers.nix { inherit lib; };
|
|
||||||
in with helpers; with lib;
|
|
||||||
{
|
{
|
||||||
mkCmpSourcePlugin = { name, extraPlugins ? [], useDefaultPackage ? true, ... }: mkPlugin attrs {
|
lib,
|
||||||
inherit name;
|
pkgs,
|
||||||
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
|
...
|
||||||
description = "Enable ${name}";
|
} @ attrs: let
|
||||||
};
|
helpers = import ../../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with helpers;
|
||||||
|
with lib; {
|
||||||
|
mkCmpSourcePlugin = {
|
||||||
|
name,
|
||||||
|
extraPlugins ? [],
|
||||||
|
useDefaultPackage ? true,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
mkPlugin attrs {
|
||||||
|
inherit name;
|
||||||
|
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
|
||||||
|
description = "Enable ${name}";
|
||||||
|
};
|
||||||
|
|
||||||
pluginAndSourceNames = {
|
pluginAndSourceNames = {
|
||||||
"luasnip" = "cmp_luasnip";
|
"luasnip" = "cmp_luasnip";
|
||||||
"snippy" = "cmp-snippy";
|
"snippy" = "cmp-snippy";
|
||||||
"ultisnips" = "cmp-nvim-ultisnips";
|
"ultisnips" = "cmp-nvim-ultisnips";
|
||||||
"vsnip" = "cmp-vsnip";
|
"vsnip" = "cmp-vsnip";
|
||||||
"buffer" = "cmp-buffer";
|
"buffer" = "cmp-buffer";
|
||||||
"calc" = "cmp-calc";
|
"calc" = "cmp-calc";
|
||||||
"dictionary" = "cmp-dictionary";
|
"dictionary" = "cmp-dictionary";
|
||||||
"digraphs" = "cmp-digraphs";
|
"digraphs" = "cmp-digraphs";
|
||||||
"omni" = "cmp-omni";
|
"omni" = "cmp-omni";
|
||||||
"spell" = "cmp-spell";
|
"spell" = "cmp-spell";
|
||||||
"nvim_lsp" = "cmp-nvim-lsp";
|
"nvim_lsp" = "cmp-nvim-lsp";
|
||||||
"nvim_lsp_document_symbol" = "cmp-nvim-lsp-document-symbol";
|
"nvim_lsp_document_symbol" = "cmp-nvim-lsp-document-symbol";
|
||||||
"nvim_lsp_signature_help" = "cmp-nvim-lsp-signature-help";
|
"nvim_lsp_signature_help" = "cmp-nvim-lsp-signature-help";
|
||||||
"vim_lsp" = "cmp-vim-lsp";
|
"vim_lsp" = "cmp-vim-lsp";
|
||||||
"path" = "cmp-path";
|
"path" = "cmp-path";
|
||||||
"git" = "cmp-git";
|
"git" = "cmp-git";
|
||||||
"conventionalcommits" = "cmp-conventionalcommits";
|
"conventionalcommits" = "cmp-conventionalcommits";
|
||||||
"cmdline" = "cmp-cmdline";
|
"cmdline" = "cmp-cmdline";
|
||||||
"cmp-cmdline-history" = "cmp-cmdline-history";
|
"cmp-cmdline-history" = "cmp-cmdline-history";
|
||||||
"fuzzy_buffer" = "cmp-fuzzy-buffer";
|
"fuzzy_buffer" = "cmp-fuzzy-buffer";
|
||||||
"fuzzy_path" = "cmp-fuzzy-path";
|
"fuzzy_path" = "cmp-fuzzy-path";
|
||||||
"rg" = "cmp-rg";
|
"rg" = "cmp-rg";
|
||||||
"fish" = "cmp-fish";
|
"fish" = "cmp-fish";
|
||||||
"tmux" = "cmp-tmux";
|
"tmux" = "cmp-tmux";
|
||||||
"zsh" = "cmp-zsh";
|
"zsh" = "cmp-zsh";
|
||||||
"crates" = "crates-nvim";
|
"crates" = "crates-nvim";
|
||||||
"npm" = "cmp-npm";
|
"npm" = "cmp-npm";
|
||||||
"cmp-clippy" = "cmp-clippy";
|
"cmp-clippy" = "cmp-clippy";
|
||||||
"cmp_tabnine" = "cmp-tabnine";
|
"cmp_tabnine" = "cmp-tabnine";
|
||||||
"copilot" = "cmp-copilot";
|
"copilot" = "cmp-copilot";
|
||||||
"dap" = "cmp-dap";
|
"dap" = "cmp-dap";
|
||||||
"emoji" = "cmp-emoji";
|
"emoji" = "cmp-emoji";
|
||||||
"greek" = "cmp-greek";
|
"greek" = "cmp-greek";
|
||||||
"latex_symbols" = "cmp-latex-symbols";
|
"latex_symbols" = "cmp-latex-symbols";
|
||||||
"look" = "cmp-look";
|
"look" = "cmp-look";
|
||||||
"nvim_lua" = "cmp-nvim-lua";
|
"nvim_lua" = "cmp-nvim-lua";
|
||||||
"pandoc_references" = "cmp-pandoc-references";
|
"pandoc_references" = "cmp-pandoc-references";
|
||||||
"cmp_pandoc" = "cmp-pandoc-nvim";
|
"cmp_pandoc" = "cmp-pandoc-nvim";
|
||||||
"treesitter" = "cmp-treesitter";
|
"treesitter" = "cmp-treesitter";
|
||||||
"vimwiki-tags" = "cmp-vimwiki-tags";
|
"vimwiki-tags" = "cmp-vimwiki-tags";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
{ pkgs, config, lib, ... }@args:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.nvim-cmp;
|
cfg = config.plugins.nvim-cmp;
|
||||||
helpers = import ../../helpers.nix { inherit lib; };
|
helpers = import ../../helpers.nix {inherit lib;};
|
||||||
mkNullOrOption = helpers.mkNullOrOption;
|
mkNullOrOption = helpers.mkNullOrOption;
|
||||||
cmpLib = import ./cmp-helpers.nix args;
|
cmpLib = import ./cmp-helpers.nix args;
|
||||||
# functionName should be a string
|
# functionName should be a string
|
||||||
# parameters should be a list of strings
|
# parameters should be a list of strings
|
||||||
wrapWithFunction = functionName: parameters:
|
wrapWithFunction = functionName: parameters: let
|
||||||
let
|
parameterString = strings.concatStringsSep "," parameters;
|
||||||
parameterString = strings.concatStringsSep "," parameters;
|
in ''${functionName}(${parameterString})'';
|
||||||
in
|
in {
|
||||||
''${functionName}(${parameterString})'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.plugins.nvim-cmp = {
|
options.plugins.nvim-cmp = {
|
||||||
enable = mkEnableOption "nvim-cmp";
|
enable = mkEnableOption "nvim-cmp";
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ in
|
||||||
|
|
||||||
performance = mkOption {
|
performance = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
debounce = mkOption {
|
debounce = mkOption {
|
||||||
type = types.nullOr types.int;
|
type = types.nullOr types.int;
|
||||||
|
@ -36,14 +37,14 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
preselect = mkOption {
|
preselect = mkOption {
|
||||||
type = types.nullOr (types.enum [ "Item" "None" ]);
|
type = types.nullOr (types.enum ["Item" "None"]);
|
||||||
default = null;
|
default = null;
|
||||||
example = ''"Item"'';
|
example = ''"Item"'';
|
||||||
};
|
};
|
||||||
|
|
||||||
snippet = mkOption {
|
snippet = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
expand = mkOption {
|
expand = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
@ -61,7 +62,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
mappingPresets = mkOption {
|
mappingPresets = mkOption {
|
||||||
default = [ ];
|
default = [];
|
||||||
type = types.listOf (types.enum [
|
type = types.listOf (types.enum [
|
||||||
"insert"
|
"insert"
|
||||||
"cmdline"
|
"cmdline"
|
||||||
|
@ -75,7 +76,7 @@ in
|
||||||
|
|
||||||
mapping = mkOption {
|
mapping = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.attrsOf (types.either types.str (types.submodule ({ ... }: {
|
type = types.nullOr (types.attrsOf (types.either types.str (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
action = mkOption {
|
action = mkOption {
|
||||||
type = types.nonEmptyStr;
|
type = types.nonEmptyStr;
|
||||||
|
@ -116,7 +117,7 @@ in
|
||||||
|
|
||||||
completion = mkOption {
|
completion = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
keyword_length = mkOption {
|
keyword_length = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -145,7 +146,7 @@ in
|
||||||
|
|
||||||
confirmation = mkOption {
|
confirmation = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
get_commit_characters = mkOption {
|
get_commit_characters = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -158,7 +159,7 @@ in
|
||||||
|
|
||||||
formatting = mkOption {
|
formatting = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
fields = mkOption {
|
fields = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -176,7 +177,7 @@ in
|
||||||
|
|
||||||
matching = mkOption {
|
matching = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
disallow_fuzzy_matching = mkOption {
|
disallow_fuzzy_matching = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -196,7 +197,7 @@ in
|
||||||
|
|
||||||
sorting = mkOption {
|
sorting = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
priority_weight = mkOption {
|
priority_weight = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -218,54 +219,53 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sources =
|
sources = let
|
||||||
let
|
source_config = types.submodule ({...}: {
|
||||||
source_config = types.submodule ({ ... }: {
|
options = {
|
||||||
options = {
|
name = mkOption {
|
||||||
name = mkOption {
|
type = types.str;
|
||||||
type = types.str;
|
description = "The name of the source.";
|
||||||
description = "The name of the source.";
|
example = ''"buffer"'';
|
||||||
example = ''"buffer"'';
|
|
||||||
};
|
|
||||||
|
|
||||||
option = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = with types; nullOr (attrsOf anything);
|
|
||||||
description = "If direct lua code is needed use helpers.mkRaw";
|
|
||||||
};
|
|
||||||
|
|
||||||
keyword_length = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
};
|
|
||||||
|
|
||||||
keyword_pattern = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
};
|
|
||||||
|
|
||||||
trigger_characters = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = with types; nullOr (listOf str);
|
|
||||||
};
|
|
||||||
|
|
||||||
priority = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
};
|
|
||||||
|
|
||||||
max_item_count = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
};
|
|
||||||
|
|
||||||
group_index = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
in
|
option = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = with types; nullOr (attrsOf anything);
|
||||||
|
description = "If direct lua code is needed use helpers.mkRaw";
|
||||||
|
};
|
||||||
|
|
||||||
|
keyword_length = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
|
keyword_pattern = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
|
trigger_characters = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = with types; nullOr (listOf str);
|
||||||
|
};
|
||||||
|
|
||||||
|
priority = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
|
max_item_count = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
|
group_index = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in
|
||||||
mkOption {
|
mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = with types; nullOr (either (listOf source_config) (listOf (listOf source_config)));
|
type = with types; nullOr (either (listOf source_config) (listOf (listOf source_config)));
|
||||||
|
@ -286,7 +286,7 @@ in
|
||||||
|
|
||||||
view = mkOption {
|
view = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
entries = mkOption {
|
entries = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -296,20 +296,19 @@ in
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
window =
|
window = let
|
||||||
let
|
# Reusable options
|
||||||
# Reusable options
|
border = with types; mkNullOrOption (either str (listOf str)) null;
|
||||||
border = with types; mkNullOrOption (either str (listOf str)) null;
|
winhighlight = mkNullOrOption types.str null;
|
||||||
winhighlight = mkNullOrOption types.str null;
|
zindex = mkNullOrOption types.int null;
|
||||||
zindex = mkNullOrOption types.int null;
|
in
|
||||||
in
|
|
||||||
mkOption {
|
mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
completion = mkOption {
|
completion = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
inherit border winhighlight zindex;
|
inherit border winhighlight zindex;
|
||||||
col_offset = mkNullOrOption types.int "Offsets the completion window relative to the cursor";
|
col_offset = mkNullOrOption types.int "Offsets the completion window relative to the cursor";
|
||||||
|
@ -320,7 +319,7 @@ in
|
||||||
|
|
||||||
documentation = mkOption {
|
documentation = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
inherit border winhighlight zindex;
|
inherit border winhighlight zindex;
|
||||||
max_width = mkNullOrOption types.int "Window's max width";
|
max_width = mkNullOrOption types.int "Window's max width";
|
||||||
|
@ -336,68 +335,99 @@ in
|
||||||
experimental = mkNullOrOption types.attrs "Experimental features";
|
experimental = mkNullOrOption types.attrs "Experimental features";
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
options = {
|
||||||
options = {
|
enabled = cfg.enable;
|
||||||
enabled = cfg.enable;
|
performance = cfg.performance;
|
||||||
performance = cfg.performance;
|
preselect =
|
||||||
preselect = if (isNull cfg.preselect) then null else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
if (isNull cfg.preselect)
|
||||||
|
then null
|
||||||
|
else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
||||||
|
|
||||||
# Not very readable sorry
|
# Not very readable sorry
|
||||||
# If null then null
|
# If null then null
|
||||||
# If an attribute is a string, just treat it as lua code for that mapping
|
# If an attribute is a string, just treat it as lua code for that mapping
|
||||||
# If an attribute is a module, create a mapping with cmp.mapping() using the action as the first input and the modes as the second.
|
# If an attribute is a module, create a mapping with cmp.mapping() using the action as the first input and the modes as the second.
|
||||||
mapping =
|
mapping = let
|
||||||
let
|
mappings =
|
||||||
mappings =
|
if (isNull cfg.mapping)
|
||||||
if (isNull cfg.mapping) then null
|
then null
|
||||||
else
|
else
|
||||||
mapAttrs
|
mapAttrs
|
||||||
(bind: mapping: helpers.mkRaw (if isString mapping then mapping
|
(bind: mapping:
|
||||||
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"))
|
helpers.mkRaw (
|
||||||
cfg.mapping;
|
if isString mapping
|
||||||
luaMappings = (helpers.toLuaObject mappings);
|
then mapping
|
||||||
wrapped = lists.fold (presetName: prevString: ''cmp.mapping.preset.${presetName}(${prevString})'') luaMappings cfg.mappingPresets;
|
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"
|
||||||
in
|
))
|
||||||
helpers.mkRaw wrapped;
|
cfg.mapping;
|
||||||
|
luaMappings = helpers.toLuaObject mappings;
|
||||||
|
wrapped = lists.fold (presetName: prevString: ''cmp.mapping.preset.${presetName}(${prevString})'') luaMappings cfg.mappingPresets;
|
||||||
|
in
|
||||||
|
helpers.mkRaw wrapped;
|
||||||
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = if (isNull cfg.snippet || isNull cfg.snippet.expand) then null else helpers.mkRaw cfg.snippet.expand;
|
expand =
|
||||||
};
|
if (isNull cfg.snippet || isNull cfg.snippet.expand)
|
||||||
|
then null
|
||||||
|
else helpers.mkRaw cfg.snippet.expand;
|
||||||
|
};
|
||||||
|
|
||||||
completion = if (isNull cfg.completion) then null else {
|
completion =
|
||||||
|
if (isNull cfg.completion)
|
||||||
|
then null
|
||||||
|
else {
|
||||||
keyword_length = cfg.completion.keyword_length;
|
keyword_length = cfg.completion.keyword_length;
|
||||||
keyword_pattern = cfg.completion.keyword_pattern;
|
keyword_pattern = cfg.completion.keyword_pattern;
|
||||||
autocomplete = if (isNull cfg.completion.autocomplete) then null else mkRaw cfg.completion.autocomplete;
|
autocomplete =
|
||||||
|
if (isNull cfg.completion.autocomplete)
|
||||||
|
then null
|
||||||
|
else mkRaw cfg.completion.autocomplete;
|
||||||
completeopt = cfg.completion.completeopt;
|
completeopt = cfg.completion.completeopt;
|
||||||
};
|
};
|
||||||
|
|
||||||
confirmation = if (isNull cfg.confirmation) then null else {
|
confirmation =
|
||||||
|
if (isNull cfg.confirmation)
|
||||||
|
then null
|
||||||
|
else {
|
||||||
get_commit_characters =
|
get_commit_characters =
|
||||||
if (isString cfg.confirmation.get_commit_characters) then helpers.mkRaw cfg.confirmation.get_commit_characters
|
if (isString cfg.confirmation.get_commit_characters)
|
||||||
|
then helpers.mkRaw cfg.confirmation.get_commit_characters
|
||||||
else cfg.confirmation.get_commit_characters;
|
else cfg.confirmation.get_commit_characters;
|
||||||
};
|
};
|
||||||
|
|
||||||
formatting = if (isNull cfg.formatting) then null else {
|
formatting =
|
||||||
|
if (isNull cfg.formatting)
|
||||||
|
then null
|
||||||
|
else {
|
||||||
fields = cfg.formatting.fields;
|
fields = cfg.formatting.fields;
|
||||||
format = if (isNull cfg.formatting.format) then null else helpers.mkRaw cfg.formatting.format;
|
format =
|
||||||
|
if (isNull cfg.formatting.format)
|
||||||
|
then null
|
||||||
|
else helpers.mkRaw cfg.formatting.format;
|
||||||
};
|
};
|
||||||
|
|
||||||
matching = cfg.matching;
|
matching = cfg.matching;
|
||||||
|
|
||||||
sorting = if (isNull cfg.sorting) then null else {
|
sorting =
|
||||||
|
if (isNull cfg.sorting)
|
||||||
|
then null
|
||||||
|
else {
|
||||||
priority_weight = cfg.sorting.priority_weight;
|
priority_weight = cfg.sorting.priority_weight;
|
||||||
comparators = if (isNull cfg.sorting.comparators) then null else helpers.mkRaw cfg.sorting.comparators;
|
comparators =
|
||||||
|
if (isNull cfg.sorting.comparators)
|
||||||
|
then null
|
||||||
|
else helpers.mkRaw cfg.sorting.comparators;
|
||||||
};
|
};
|
||||||
|
|
||||||
sources = cfg.sources;
|
sources = cfg.sources;
|
||||||
view = cfg.view;
|
view = cfg.view;
|
||||||
window = cfg.window;
|
window = cfg.window;
|
||||||
experimental = cfg.experimental;
|
experimental = cfg.experimental;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = helpers.wrapDo ''
|
extraConfigLua = helpers.wrapDo ''
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
|
@ -406,21 +436,23 @@ in
|
||||||
|
|
||||||
# If auto_enable_sources is set to true, figure out which are provided by the user
|
# If auto_enable_sources is set to true, figure out which are provided by the user
|
||||||
# and enable the corresponding plugins.
|
# and enable the corresponding plugins.
|
||||||
plugins =
|
plugins = let
|
||||||
let
|
flattened_sources =
|
||||||
flattened_sources = if (isNull cfg.sources) then [ ] else flatten cfg.sources;
|
if (isNull cfg.sources)
|
||||||
# Take only the names from the sources provided by the user
|
then []
|
||||||
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
|
else flatten cfg.sources;
|
||||||
# A list of known source names
|
# Take only the names from the sources provided by the user
|
||||||
known_source_names = attrNames cmpLib.pluginAndSourceNames;
|
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
|
||||||
|
# A list of known source names
|
||||||
|
known_source_names = attrNames cmpLib.pluginAndSourceNames;
|
||||||
|
|
||||||
attrs_enabled = listToAttrs (map
|
attrs_enabled = listToAttrs (map
|
||||||
(name: {
|
(name: {
|
||||||
name = cmpLib.pluginAndSourceNames.${name};
|
name = cmpLib.pluginAndSourceNames.${name};
|
||||||
value.enable = mkIf (elem name found_sources) true;
|
value.enable = mkIf (elem name found_sources) true;
|
||||||
})
|
})
|
||||||
known_source_names);
|
known_source_names);
|
||||||
in
|
in
|
||||||
mkIf cfg.auto_enable_sources attrs_enabled;
|
mkIf cfg.auto_enable_sources attrs_enabled;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
with lib;
|
lib,
|
||||||
let
|
pkgs,
|
||||||
|
...
|
||||||
|
} @ attrs:
|
||||||
|
with lib; let
|
||||||
cmpLib = import ../cmp-helpers.nix attrs;
|
cmpLib = import ../cmp-helpers.nix attrs;
|
||||||
cmpSourcesPluginNames = lib.attrValues cmpLib.pluginAndSourceNames;
|
cmpSourcesPluginNames = lib.attrValues cmpLib.pluginAndSourceNames;
|
||||||
pluginModules = lists.map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
|
pluginModules = lists.map (name: cmpLib.mkCmpSourcePlugin {inherit name;}) cmpSourcesPluginNames;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
# For extra cmp plugins
|
# For extra cmp plugins
|
||||||
imports = [
|
imports =
|
||||||
] ++ pluginModules;
|
[
|
||||||
|
]
|
||||||
|
++ pluginModules;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "fugitive";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable vim-fugitive";
|
in
|
||||||
package = pkgs.vimPlugins.vim-fugitive;
|
with helpers;
|
||||||
extraPackages = [ pkgs.git ];
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "fugitive";
|
||||||
|
description = "Enable vim-fugitive";
|
||||||
|
package = pkgs.vimPlugins.vim-fugitive;
|
||||||
|
extraPackages = [pkgs.git];
|
||||||
|
|
||||||
# In typical tpope fashin, this plugin has no config options
|
# In typical tpope fashin, this plugin has no config options
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.gitgutter;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.gitgutter;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.gitgutter = {
|
plugins.gitgutter = {
|
||||||
enable = mkEnableOption "gitgutter";
|
enable = mkEnableOption "gitgutter";
|
||||||
|
@ -54,14 +57,14 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
signs = mkOption {
|
signs = mkOption {
|
||||||
type =
|
type = let
|
||||||
let
|
signOption = desc:
|
||||||
signOption = desc: mkOption {
|
mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Sign for ${desc}";
|
description = "Sign for ${desc}";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
types.submodule {
|
types.submodule {
|
||||||
options = {
|
options = {
|
||||||
added = signOption "added lines";
|
added = signOption "added lines";
|
||||||
|
@ -73,7 +76,7 @@ in
|
||||||
modifiedRemoved = signOption "modified and removed lines";
|
modifiedRemoved = signOption "modified and removed lines";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
description = "Custom signs for the sign column";
|
description = "Custom signs for the sign column";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,20 +169,25 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
grepPackage =
|
||||||
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
|
if builtins.isAttrs cfg.grep
|
||||||
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
|
then [cfg.grep.package]
|
||||||
in
|
else [];
|
||||||
|
grepCommand =
|
||||||
|
if builtins.isAttrs cfg.grep
|
||||||
|
then cfg.grep.command
|
||||||
|
else cfg.grep;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
options = mkIf cfg.recommendedSettings {
|
options = mkIf cfg.recommendedSettings {
|
||||||
updatetime = 100;
|
updatetime = 100;
|
||||||
foldtext = "gitgutter#fold#foldtext";
|
foldtext = "gitgutter#fold#foldtext";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = [ pkgs.git ] ++ grepPackage;
|
extraPackages = [pkgs.git] ++ grepPackage;
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
gitgutter_max_signs = mkIf (!isNull cfg.maxSigns) cfg.maxSigns;
|
gitgutter_max_signs = mkIf (!isNull cfg.maxSigns) cfg.maxSigns;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{ pkgs
|
{
|
||||||
, lib
|
pkgs,
|
||||||
, config
|
lib,
|
||||||
, ...
|
config,
|
||||||
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib; let
|
with lib; let
|
||||||
helpers = import ../helpers.nix args;
|
helpers = import ../helpers.nix args;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.plugins.gitmessenger = {
|
options.plugins.gitmessenger = {
|
||||||
enable = mkEnableOption "Enable the gitmessenger plugin";
|
enable = mkEnableOption "Enable the gitmessenger plugin";
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ in
|
||||||
A popup window is no longer closed automatically when moving a cursor after the window is
|
A popup window is no longer closed automatically when moving a cursor after the window is
|
||||||
shown up.
|
shown up.
|
||||||
'';
|
'';
|
||||||
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault [ "none" "current" "all" ] ''
|
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "current" "all"] ''
|
||||||
When this value is not set to "none", a popup window includes diff hunks of the commit at
|
When this value is not set to "none", a popup window includes diff hunks of the commit at
|
||||||
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
|
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
|
||||||
all diff hunks in the commit.
|
all diff hunks in the commit.
|
||||||
|
@ -26,10 +26,10 @@ in
|
||||||
'';
|
'';
|
||||||
gitCommand =
|
gitCommand =
|
||||||
helpers.defaultNullOpts.mkStr "git"
|
helpers.defaultNullOpts.mkStr "git"
|
||||||
"git command to retrieve commit messages.";
|
"git command to retrieve commit messages.";
|
||||||
noDefaultMappings =
|
noDefaultMappings =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"When this value is set, it does not define any key mappings";
|
"When this value is set, it does not define any key mappings";
|
||||||
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
|
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
|
||||||
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
|
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
|
||||||
showing a popup does not move the cursor in the window.
|
showing a popup does not move the cursor in the window.
|
||||||
|
@ -91,12 +91,11 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.gitmessenger;
|
||||||
cfg = config.plugins.gitmessenger;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
globals = {
|
globals = {
|
||||||
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
|
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
|
||||||
git_messenger_include_diff = cfg.includeDiff;
|
git_messenger_include_diff = cfg.includeDiff;
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
{ config
|
{
|
||||||
, lib
|
config,
|
||||||
, pkgs
|
lib,
|
||||||
, ...
|
pkgs,
|
||||||
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib; let
|
with lib; let
|
||||||
helpers = import ../helpers.nix args;
|
helpers = import ../helpers.nix args;
|
||||||
signOptions = defaults: {
|
signOptions = defaults: {
|
||||||
hl =
|
hl =
|
||||||
helpers.defaultNullOpts.mkStr defaults.hl
|
helpers.defaultNullOpts.mkStr defaults.hl
|
||||||
"Specifies the highlight group to use for the sign";
|
"Specifies the highlight group to use for the sign";
|
||||||
text =
|
text =
|
||||||
helpers.defaultNullOpts.mkStr defaults.text
|
helpers.defaultNullOpts.mkStr defaults.text
|
||||||
"Specifies the character to use for the sign";
|
"Specifies the character to use for the sign";
|
||||||
numhl =
|
numhl =
|
||||||
helpers.defaultNullOpts.mkStr defaults.numhl
|
helpers.defaultNullOpts.mkStr defaults.numhl
|
||||||
"Specifies the highlight group to use for the number column";
|
"Specifies the highlight group to use for the number column";
|
||||||
linehl =
|
linehl =
|
||||||
helpers.defaultNullOpts.mkStr defaults.linehl
|
helpers.defaultNullOpts.mkStr defaults.linehl
|
||||||
"Specifies the highlight group to use for the line";
|
"Specifies the highlight group to use for the line";
|
||||||
showCount =
|
showCount =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"showing count of hunk, e.g. number of deleted lines";
|
"showing count of hunk, e.g. number of deleted lines";
|
||||||
};
|
};
|
||||||
signSetupOptions = values: {
|
signSetupOptions = values: {
|
||||||
inherit (values) hl text numhl linehl;
|
inherit (values) hl text numhl linehl;
|
||||||
|
@ -33,8 +34,7 @@ with lib; let
|
||||||
description = "Lua function definition";
|
description = "Lua function definition";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.plugins.gitsigns = {
|
options.plugins.gitsigns = {
|
||||||
enable = mkEnableOption "Enable gitsigns plugin";
|
enable = mkEnableOption "Enable gitsigns plugin";
|
||||||
package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim;
|
package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim;
|
||||||
|
@ -76,19 +76,18 @@ in
|
||||||
linehl = "GitSignsAddLn";
|
linehl = "GitSignsAddLn";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
worktrees =
|
worktrees = let
|
||||||
let
|
worktreeModule = {
|
||||||
worktreeModule = {
|
options = {
|
||||||
options = {
|
toplevel = mkOption {
|
||||||
toplevel = mkOption {
|
type = types.str;
|
||||||
type = types.str;
|
};
|
||||||
};
|
gitdir = mkOption {
|
||||||
gitdir = mkOption {
|
type = types.str;
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
|
in
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.nullOr (types.listOf (types.submodule worktreeModule));
|
type = types.nullOr (types.listOf (types.submodule worktreeModule));
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -126,25 +125,25 @@ in
|
||||||
watchGitDir = {
|
watchGitDir = {
|
||||||
enable =
|
enable =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
"Whether the watcher is enabled";
|
"Whether the watcher is enabled";
|
||||||
interval =
|
interval =
|
||||||
helpers.defaultNullOpts.mkInt 1000
|
helpers.defaultNullOpts.mkInt 1000
|
||||||
"Interval the watcher waits between polls of the gitdir in milliseconds";
|
"Interval the watcher waits between polls of the gitdir in milliseconds";
|
||||||
followFiles =
|
followFiles =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
"If a file is moved with `git mv`, switch the buffer to the new location";
|
"If a file is moved with `git mv`, switch the buffer to the new location";
|
||||||
};
|
};
|
||||||
signPriority =
|
signPriority =
|
||||||
helpers.defaultNullOpts.mkInt 6
|
helpers.defaultNullOpts.mkInt 6
|
||||||
"Priority to use for signs";
|
"Priority to use for signs";
|
||||||
signcolumn =
|
signcolumn =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
''
|
''
|
||||||
Enable/disable symbols in the sign column.
|
Enable/disable symbols in the sign column.
|
||||||
|
|
||||||
When enabled the highlights defined in `signs.*.hl` and symbols defined
|
When enabled the highlights defined in `signs.*.hl` and symbols defined
|
||||||
in `signs.*.text` are used.
|
in `signs.*.text` are used.
|
||||||
'';
|
'';
|
||||||
numhl = helpers.defaultNullOpts.mkBool false ''
|
numhl = helpers.defaultNullOpts.mkBool false ''
|
||||||
line number highlights.
|
line number highlights.
|
||||||
|
|
||||||
|
@ -164,33 +163,32 @@ in
|
||||||
|
|
||||||
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||||
'';
|
'';
|
||||||
diffOpts =
|
diffOpts = let
|
||||||
let
|
diffOptModule = {
|
||||||
diffOptModule = {
|
options = {
|
||||||
options = {
|
algorithm =
|
||||||
algorithm =
|
helpers.defaultNullOpts.mkEnumFirstDefault ["myers" "minimal" "patience" "histogram"]
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "myers" "minimal" "patience" "histogram" ]
|
"Diff algorithm to use";
|
||||||
"Diff algorithm to use";
|
internal =
|
||||||
internal =
|
helpers.defaultNullOpts.mkBool false
|
||||||
helpers.defaultNullOpts.mkBool false
|
"Use Neovim's built in xdiff library for running diffs";
|
||||||
"Use Neovim's built in xdiff library for running diffs";
|
indentHeuristic =
|
||||||
indentHeuristic =
|
helpers.defaultNullOpts.mkBool false
|
||||||
helpers.defaultNullOpts.mkBool false
|
"Use the indent heuristic for the internal diff library.";
|
||||||
"Use the indent heuristic for the internal diff library.";
|
vertical =
|
||||||
vertical =
|
helpers.defaultNullOpts.mkBool true
|
||||||
helpers.defaultNullOpts.mkBool true
|
"Start diff mode with vertical splits";
|
||||||
"Start diff mode with vertical splits";
|
linematch = mkOption {
|
||||||
linematch = mkOption {
|
type = types.nullOr types.int;
|
||||||
type = types.nullOr types.int;
|
default = null;
|
||||||
default = null;
|
description = ''
|
||||||
description = ''
|
Enable second-stage diff on hunks to align lines.
|
||||||
Enable second-stage diff on hunks to align lines.
|
Requires `internal=true`.
|
||||||
Requires `internal=true`.
|
'';
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
|
in
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.nullOr (types.submodule diffOptModule);
|
type = types.nullOr (types.submodule diffOptModule);
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -240,7 +238,7 @@ in
|
||||||
'' "Function used to format `b:gitsigns_status`";
|
'' "Function used to format `b:gitsigns_status`";
|
||||||
maxFileLength =
|
maxFileLength =
|
||||||
helpers.defaultNullOpts.mkInt 40000
|
helpers.defaultNullOpts.mkInt 40000
|
||||||
"Max file length (in lines) to attach to";
|
"Max file length (in lines) to attach to";
|
||||||
previewConfig =
|
previewConfig =
|
||||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) ''
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) ''
|
||||||
{
|
{
|
||||||
|
@ -256,34 +254,34 @@ in
|
||||||
'';
|
'';
|
||||||
attachToUntracked =
|
attachToUntracked =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
"Attach to untracked files.";
|
"Attach to untracked files.";
|
||||||
updateDebounce =
|
updateDebounce =
|
||||||
helpers.defaultNullOpts.mkInt 100
|
helpers.defaultNullOpts.mkInt 100
|
||||||
"Debounce time for updates (in milliseconds).";
|
"Debounce time for updates (in milliseconds).";
|
||||||
currentLineBlame = helpers.defaultNullOpts.mkBool false ''
|
currentLineBlame = helpers.defaultNullOpts.mkBool false ''
|
||||||
Adds an unobtrusive and customisable blame annotation at the end of the current line.
|
Adds an unobtrusive and customisable blame annotation at the end of the current line.
|
||||||
'';
|
'';
|
||||||
currentLineBlameOpts = {
|
currentLineBlameOpts = {
|
||||||
virtText =
|
virtText =
|
||||||
helpers.defaultNullOpts.mkBool true
|
helpers.defaultNullOpts.mkBool true
|
||||||
"Whether to show a virtual text blame annotation";
|
"Whether to show a virtual text blame annotation";
|
||||||
virtTextPos =
|
virtTextPos =
|
||||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "eol" "overlay" "right_align" ]
|
helpers.defaultNullOpts.mkEnumFirstDefault ["eol" "overlay" "right_align"]
|
||||||
"Blame annotation position";
|
"Blame annotation position";
|
||||||
delay =
|
delay =
|
||||||
helpers.defaultNullOpts.mkInt 1000
|
helpers.defaultNullOpts.mkInt 1000
|
||||||
"Sets the delay (in milliseconds) before blame virtual text is displayed";
|
"Sets the delay (in milliseconds) before blame virtual text is displayed";
|
||||||
ignoreWhitespace =
|
ignoreWhitespace =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"Ignore whitespace when running blame";
|
"Ignore whitespace when running blame";
|
||||||
virtTextPriority =
|
virtTextPriority =
|
||||||
helpers.defaultNullOpts.mkInt 100
|
helpers.defaultNullOpts.mkInt 100
|
||||||
"Priority of virtual text";
|
"Priority of virtual text";
|
||||||
};
|
};
|
||||||
currentLineBlameFormatter = {
|
currentLineBlameFormatter = {
|
||||||
normal =
|
normal =
|
||||||
helpers.defaultNullOpts.mkNullable (types.either types.str luaFunction)
|
helpers.defaultNullOpts.mkNullable (types.either types.str luaFunction)
|
||||||
''" <author>, <author_time> - <summary>"'' ''
|
''" <author>, <author_time> - <summary>"'' ''
|
||||||
String or function used to format the virtual text of
|
String or function used to format the virtual text of
|
||||||
|gitsigns-config-current_line_blame|.
|
|gitsigns-config-current_line_blame|.
|
||||||
|
|
||||||
|
@ -292,7 +290,7 @@ in
|
||||||
|
|
||||||
nonCommitted =
|
nonCommitted =
|
||||||
helpers.defaultNullOpts.mkNullable (types.either types.str luaFunction)
|
helpers.defaultNullOpts.mkNullable (types.either types.str luaFunction)
|
||||||
''" <author>"'' ''
|
''" <author>"'' ''
|
||||||
String or function used to format the virtual text of
|
String or function used to format the virtual text of
|
||||||
|gitsigns-config-current_line_blame| for lines that aren't committed.
|
|gitsigns-config-current_line_blame| for lines that aren't committed.
|
||||||
'';
|
'';
|
||||||
|
@ -316,89 +314,83 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.gitsigns;
|
||||||
cfg = config.plugins.gitsigns;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua =
|
extraConfigLua = let
|
||||||
let
|
luaFnOrStrToObj = val:
|
||||||
luaFnOrStrToObj = val:
|
if val == null
|
||||||
if val == null
|
then null
|
||||||
then null
|
else if builtins.isString val
|
||||||
else if builtins.isString val
|
then val
|
||||||
then val
|
else {__raw = val.function;};
|
||||||
else { __raw = val.function; };
|
setupOptions = {
|
||||||
setupOptions = {
|
inherit (cfg) worktrees signcolumn numhl linehl trouble yadm;
|
||||||
inherit (cfg) worktrees signcolumn numhl linehl trouble yadm;
|
signs = mapAttrs (_: signSetupOptions) cfg.signs;
|
||||||
signs = mapAttrs (_: signSetupOptions) cfg.signs;
|
on_attach =
|
||||||
on_attach =
|
if cfg.onAttach != null
|
||||||
if cfg.onAttach != null
|
then {__raw = cfg.onAttach.function;}
|
||||||
then { __raw = cfg.onAttach.function; }
|
else null;
|
||||||
else null;
|
watch_gitdir = {
|
||||||
watch_gitdir = {
|
inherit (cfg.watchGitDir) enable interval;
|
||||||
inherit (cfg.watchGitDir) enable interval;
|
follow_files = cfg.watchGitDir.followFiles;
|
||||||
follow_files = cfg.watchGitDir.followFiles;
|
|
||||||
};
|
|
||||||
sign_priority = cfg.signPriority;
|
|
||||||
show_deleted = cfg.showDeleted;
|
|
||||||
diff_opts =
|
|
||||||
if cfg.diffOpts == null
|
|
||||||
then null
|
|
||||||
else {
|
|
||||||
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
|
||||||
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
|
||||||
};
|
|
||||||
count_chars =
|
|
||||||
let
|
|
||||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
|
||||||
in
|
|
||||||
if cfg.countChars != null
|
|
||||||
then {
|
|
||||||
__raw =
|
|
||||||
"{"
|
|
||||||
+ (concatStringsSep "," (
|
|
||||||
lib.mapAttrsToList
|
|
||||||
(
|
|
||||||
name: value:
|
|
||||||
if isStrInt name
|
|
||||||
then "[${name}] = ${helpers.toLuaObject value}"
|
|
||||||
else "[${helpers.toLuaObject name}] = ${helpers.toLuaObject value}"
|
|
||||||
)
|
|
||||||
cfg.countChars
|
|
||||||
))
|
|
||||||
+ "}";
|
|
||||||
}
|
|
||||||
else null;
|
|
||||||
status_formatter =
|
|
||||||
if cfg.statusFormatter != null
|
|
||||||
then { __raw = cfg.statusFormatter.function; }
|
|
||||||
else null;
|
|
||||||
max_file_length = cfg.maxFileLength;
|
|
||||||
preview_config = cfg.previewConfig;
|
|
||||||
attach_to_untracked = cfg.attachToUntracked;
|
|
||||||
update_debounce = cfg.updateDebounce;
|
|
||||||
current_line_blame = cfg.currentLineBlame;
|
|
||||||
current_line_blame_opts =
|
|
||||||
let
|
|
||||||
cfgCl = cfg.currentLineBlameOpts;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit (cfgCl) delay;
|
|
||||||
virt_text = cfgCl.virtText;
|
|
||||||
virt_text_pos = cfgCl.virtTextPos;
|
|
||||||
ignore_whitespace = cfgCl.ignoreWhitespace;
|
|
||||||
virt_text_priority = cfgCl.virtTextPriority;
|
|
||||||
};
|
|
||||||
current_line_blame_formatter = luaFnOrStrToObj cfg.currentLineBlameFormatter.normal;
|
|
||||||
current_line_blame_formatter_nc = luaFnOrStrToObj cfg.currentLineBlameFormatter.nonCommitted;
|
|
||||||
word_diff = cfg.wordDiff;
|
|
||||||
debug_mode = cfg.debugMode;
|
|
||||||
};
|
};
|
||||||
in
|
sign_priority = cfg.signPriority;
|
||||||
''
|
show_deleted = cfg.showDeleted;
|
||||||
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
diff_opts =
|
||||||
'';
|
if cfg.diffOpts == null
|
||||||
|
then null
|
||||||
|
else {
|
||||||
|
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||||
|
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||||
|
};
|
||||||
|
count_chars = let
|
||||||
|
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||||
|
in
|
||||||
|
if cfg.countChars != null
|
||||||
|
then {
|
||||||
|
__raw =
|
||||||
|
"{"
|
||||||
|
+ (concatStringsSep "," (
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(
|
||||||
|
name: value:
|
||||||
|
if isStrInt name
|
||||||
|
then "[${name}] = ${helpers.toLuaObject value}"
|
||||||
|
else "[${helpers.toLuaObject name}] = ${helpers.toLuaObject value}"
|
||||||
|
)
|
||||||
|
cfg.countChars
|
||||||
|
))
|
||||||
|
+ "}";
|
||||||
|
}
|
||||||
|
else null;
|
||||||
|
status_formatter =
|
||||||
|
if cfg.statusFormatter != null
|
||||||
|
then {__raw = cfg.statusFormatter.function;}
|
||||||
|
else null;
|
||||||
|
max_file_length = cfg.maxFileLength;
|
||||||
|
preview_config = cfg.previewConfig;
|
||||||
|
attach_to_untracked = cfg.attachToUntracked;
|
||||||
|
update_debounce = cfg.updateDebounce;
|
||||||
|
current_line_blame = cfg.currentLineBlame;
|
||||||
|
current_line_blame_opts = let
|
||||||
|
cfgCl = cfg.currentLineBlameOpts;
|
||||||
|
in {
|
||||||
|
inherit (cfgCl) delay;
|
||||||
|
virt_text = cfgCl.virtText;
|
||||||
|
virt_text_pos = cfgCl.virtTextPos;
|
||||||
|
ignore_whitespace = cfgCl.ignoreWhitespace;
|
||||||
|
virt_text_priority = cfgCl.virtTextPriority;
|
||||||
|
};
|
||||||
|
current_line_blame_formatter = luaFnOrStrToObj cfg.currentLineBlameFormatter.normal;
|
||||||
|
current_line_blame_formatter_nc = luaFnOrStrToObj cfg.currentLineBlameFormatter.nonCommitted;
|
||||||
|
word_diff = cfg.wordDiff;
|
||||||
|
debug_mode = cfg.debugMode;
|
||||||
|
};
|
||||||
|
in ''
|
||||||
|
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
with lib;
|
config,
|
||||||
let
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.neogit;
|
cfg = config.plugins.neogit;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
|
||||||
sectionDefaultsModule = types.submodule {
|
sectionDefaultsModule = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -12,8 +16,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
plugins.neogit = {
|
plugins.neogit = {
|
||||||
enable = mkEnableOption "neogit";
|
enable = mkEnableOption "neogit";
|
||||||
|
@ -72,7 +75,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
kind = mkOption {
|
kind = mkOption {
|
||||||
|
@ -104,7 +107,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
integrations = mkOption {
|
integrations = mkOption {
|
||||||
|
@ -118,7 +121,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
sections = mkOption {
|
sections = mkOption {
|
||||||
|
@ -162,7 +165,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = mkOption {
|
mappings = mkOption {
|
||||||
|
@ -198,14 +201,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
setupOptions = with cfg;
|
||||||
setupOptions = with cfg; helpers.toLuaObject {
|
helpers.toLuaObject {
|
||||||
inherit kind integrations signs sections mappings;
|
inherit kind integrations signs sections mappings;
|
||||||
disable_signs = disableSigns;
|
disable_signs = disableSigns;
|
||||||
disable_hint = disableHint;
|
disable_hint = disableHint;
|
||||||
|
@ -216,14 +219,16 @@ in
|
||||||
use_magit_keybindings = useMagitKeybindings;
|
use_magit_keybindings = useMagitKeybindings;
|
||||||
commit_popup = commitPopup;
|
commit_popup = commitPopup;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins;
|
||||||
cfg.package
|
[
|
||||||
plenary-nvim
|
cfg.package
|
||||||
] ++ optional cfg.integrations.diffview diffview-nvim;
|
plenary-nvim
|
||||||
|
]
|
||||||
|
++ optional cfg.integrations.diffview diffview-nvim;
|
||||||
|
|
||||||
extraPackages = [ pkgs.git ];
|
extraPackages = [pkgs.git];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('neogit').setup(${setupOptions})
|
require('neogit').setup(${setupOptions})
|
||||||
|
|
|
@ -17,7 +17,7 @@ in
|
||||||
options.plugins.clangd-extensions = {
|
options.plugins.clangd-extensions = {
|
||||||
enable = mkEnableOption "clangd_extensions, plugin implementing clangd LSP extensions";
|
enable = mkEnableOption "clangd_extensions, plugin implementing clangd LSP extensions";
|
||||||
|
|
||||||
package =
|
package =
|
||||||
helpers.mkPackageOption "clangd_extensions.nvim" pkgs.vimPlugins.clangd_extensions-nvim;
|
helpers.mkPackageOption "clangd_extensions.nvim" pkgs.vimPlugins.clangd_extensions-nvim;
|
||||||
|
|
||||||
enableOffsetEncodingWorkaround = mkEnableOption ''
|
enableOffsetEncodingWorkaround = mkEnableOption ''
|
||||||
|
|
|
@ -1,33 +1,38 @@
|
||||||
{ pkgs, lib, ... }@args:
|
{
|
||||||
with lib; with import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
mkPlugin args {
|
lib,
|
||||||
name = "ledger";
|
...
|
||||||
description = "Enable ledger language features";
|
} @ args:
|
||||||
package = pkgs.vimPlugins.vim-ledger;
|
with lib;
|
||||||
|
with import ../helpers.nix {inherit lib;};
|
||||||
|
mkPlugin args {
|
||||||
|
name = "ledger";
|
||||||
|
description = "Enable ledger language features";
|
||||||
|
package = pkgs.vimPlugins.vim-ledger;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
maxWidth = mkDefaultOpt {
|
maxWidth = mkDefaultOpt {
|
||||||
global = "ledger_maxwidth";
|
global = "ledger_maxwidth";
|
||||||
description = "Number of columns to display foldtext";
|
description = "Number of columns to display foldtext";
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
fillString = mkDefaultOpt {
|
fillString = mkDefaultOpt {
|
||||||
global = "ledger_fillstring";
|
global = "ledger_fillstring";
|
||||||
description = "String used to fill the space between account name and amount in the foldtext";
|
description = "String used to fill the space between account name and amount in the foldtext";
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
detailedFirst = mkDefaultOpt {
|
detailedFirst = mkDefaultOpt {
|
||||||
global = "ledger_detailed_first";
|
global = "ledger_detailed_first";
|
||||||
description = "Account completion sorted by depth instead of alphabetically";
|
description = "Account completion sorted by depth instead of alphabetically";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
foldBlanks = mkDefaultOpt {
|
foldBlanks = mkDefaultOpt {
|
||||||
global = "ledger_fold_blanks";
|
global = "ledger_fold_blanks";
|
||||||
description = "Hide blank lines following a transaction on a fold";
|
description = "Hide blank lines following a transaction on a fold";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.markdown-preview;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.markdown-preview;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.markdown-preview = {
|
plugins.markdown-preview = {
|
||||||
enable = mkEnableOption "markdown-preview";
|
enable = mkEnableOption "markdown-preview";
|
||||||
|
@ -54,7 +57,7 @@ in
|
||||||
uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options";
|
uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options";
|
||||||
maid = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "mermaid options";
|
maid = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "mermaid options";
|
||||||
disable_sync_scroll = helpers.defaultNullOpts.mkBool false "Disable sync scroll";
|
disable_sync_scroll = helpers.defaultNullOpts.mkBool false "Disable sync scroll";
|
||||||
sync_scroll_type = helpers.defaultNullOpts.mkNullable (types.enum [ "middle" "top" "relative" ]) "middle" ''
|
sync_scroll_type = helpers.defaultNullOpts.mkNullable (types.enum ["middle" "top" "relative"]) "middle" ''
|
||||||
Scroll type:
|
Scroll type:
|
||||||
- "middle": The cursor position is always shown at the middle of the preview page.
|
- "middle": The cursor position is always shown at the middle of the preview page.
|
||||||
- "top": The vim top viewport is always shown at the top of the preview page.
|
- "top": The vim top viewport is always shown at the top of the preview page.
|
||||||
|
@ -86,18 +89,17 @@ in
|
||||||
Recognized filetypes. These filetypes will have MarkdownPreview... commands.
|
Recognized filetypes. These filetypes will have MarkdownPreview... commands.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
theme = helpers.defaultNullOpts.mkNullable (types.enum [ "dark" "light" ]) "dark" ''
|
theme = helpers.defaultNullOpts.mkNullable (types.enum ["dark" "light"]) "dark" ''
|
||||||
Default theme (dark or light). By default the theme is define according to the preferences of the system.
|
Default theme (dark or light). By default the theme is define according to the preferences of the system.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
previewOptions = mapAttrs (name: value: cfg.previewOptions.${name}) cfg.previewOptions;
|
||||||
previewOptions = mapAttrs (name: value: cfg.previewOptions.${name}) cfg.previewOptions;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart;
|
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart;
|
||||||
|
@ -109,7 +111,7 @@ in
|
||||||
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser;
|
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser;
|
||||||
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl;
|
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl;
|
||||||
mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc;
|
mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc;
|
||||||
mkdp_preview_options = mkIf (cfg.previewOptions != { }) previewOptions;
|
mkdp_preview_options = mkIf (cfg.previewOptions != {}) previewOptions;
|
||||||
mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss;
|
mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss;
|
||||||
mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss;
|
mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss;
|
||||||
mkdp_port = mkIf (!isNull cfg.port) cfg.port;
|
mkdp_port = mkIf (!isNull cfg.port) cfg.port;
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "nix";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable nix";
|
in
|
||||||
package = pkgs.vimPlugins.vim-nix;
|
with helpers;
|
||||||
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "nix";
|
||||||
|
description = "Enable nix";
|
||||||
|
package = pkgs.vimPlugins.vim-nix;
|
||||||
|
|
||||||
# Possibly add option to disable Treesitter highlighting if this is installed
|
# Possibly add option to disable Treesitter highlighting if this is installed
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{ pkgs
|
{
|
||||||
, lib
|
pkgs,
|
||||||
, config
|
lib,
|
||||||
, ...
|
config,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib; let
|
||||||
let
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in {
|
in {
|
||||||
options.plugins.plantuml-syntax = {
|
options.plugins.plantuml-syntax = {
|
||||||
enable = mkEnableOption "plantuml syntax support";
|
enable = mkEnableOption "plantuml syntax support";
|
||||||
|
@ -24,12 +24,11 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.plantuml-syntax;
|
||||||
cfg = config.plugins.plantuml-syntax;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
plantuml_set_makeprg = cfg.setMakeprg;
|
plantuml_set_makeprg = cfg.setMakeprg;
|
||||||
|
|
|
@ -1,233 +1,221 @@
|
||||||
{ pkgs
|
{
|
||||||
, config
|
pkgs,
|
||||||
, lib
|
config,
|
||||||
, ...
|
lib,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib; let
|
||||||
let
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in {
|
in {
|
||||||
options.plugins.rust-tools =
|
options.plugins.rust-tools = let
|
||||||
let
|
mkNullableOptionWithDefault = {
|
||||||
mkNullableOptionWithDefault =
|
type,
|
||||||
{ type
|
description,
|
||||||
, description
|
default,
|
||||||
, default
|
}:
|
||||||
,
|
mkOption {
|
||||||
}:
|
type = types.nullOr type;
|
||||||
mkOption {
|
|
||||||
type = types.nullOr type;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
${description}
|
|
||||||
|
|
||||||
default: `${default}`
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
mkNullableBoolDefault = default: description:
|
|
||||||
mkNullableOptionWithDefault {
|
|
||||||
inherit description;
|
|
||||||
type = types.bool;
|
|
||||||
default = toString default;
|
|
||||||
};
|
|
||||||
|
|
||||||
mkNullableStrDefault = default: description:
|
|
||||||
mkNullableOptionWithDefault {
|
|
||||||
inherit description;
|
|
||||||
type = types.str;
|
|
||||||
default = ''"${default}"'';
|
|
||||||
};
|
|
||||||
|
|
||||||
mkNullableIntDefault = default: description:
|
|
||||||
mkNullableOptionWithDefault {
|
|
||||||
inherit description;
|
|
||||||
type = types.int;
|
|
||||||
default = toString default;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
enable = mkEnableOption "rust tools plugins";
|
|
||||||
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
|
|
||||||
serverPackage = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.rust-analyzer;
|
|
||||||
description = "Package to use for rust-analyzer";
|
|
||||||
};
|
|
||||||
|
|
||||||
executor = mkNullableOptionWithDefault {
|
|
||||||
type = types.enum [ "termopen" "quickfix" ];
|
|
||||||
default = ''"termopen"'';
|
|
||||||
description = "how to execute terminal commands";
|
|
||||||
};
|
|
||||||
|
|
||||||
onIntialized = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Callback to execute once rust-analyzer is done initializing the workspace
|
${description}
|
||||||
The callback receives one parameter indicating the `health` of the server:
|
|
||||||
"ok" | "warning" | "error"
|
default: `${default}`
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
reloadWorkspaceFromCargoToml = mkNullableBoolDefault true ''
|
mkNullableBoolDefault = default: description:
|
||||||
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
mkNullableOptionWithDefault {
|
||||||
|
inherit description;
|
||||||
|
type = types.bool;
|
||||||
|
default = toString default;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkNullableStrDefault = default: description:
|
||||||
|
mkNullableOptionWithDefault {
|
||||||
|
inherit description;
|
||||||
|
type = types.str;
|
||||||
|
default = ''"${default}"'';
|
||||||
|
};
|
||||||
|
|
||||||
|
mkNullableIntDefault = default: description:
|
||||||
|
mkNullableOptionWithDefault {
|
||||||
|
inherit description;
|
||||||
|
type = types.int;
|
||||||
|
default = toString default;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
enable = mkEnableOption "rust tools plugins";
|
||||||
|
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
|
||||||
|
serverPackage = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.rust-analyzer;
|
||||||
|
description = "Package to use for rust-analyzer";
|
||||||
|
};
|
||||||
|
|
||||||
|
executor = mkNullableOptionWithDefault {
|
||||||
|
type = types.enum ["termopen" "quickfix"];
|
||||||
|
default = ''"termopen"'';
|
||||||
|
description = "how to execute terminal commands";
|
||||||
|
};
|
||||||
|
|
||||||
|
onIntialized = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Callback to execute once rust-analyzer is done initializing the workspace
|
||||||
|
The callback receives one parameter indicating the `health` of the server:
|
||||||
|
"ok" | "warning" | "error"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
reloadWorkspaceFromCargoToml = mkNullableBoolDefault true ''
|
||||||
|
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
|
'';
|
||||||
|
|
||||||
|
inlayHints = {
|
||||||
|
auto = mkNullableBoolDefault true "automatically set inlay hints (type hints)";
|
||||||
|
|
||||||
|
onlyCurrentLine = mkNullableBoolDefault false "Only show for current line";
|
||||||
|
|
||||||
|
showParameterHints =
|
||||||
|
mkNullableBoolDefault true
|
||||||
|
"whether to show parameter hints with the inlay hints or not";
|
||||||
|
|
||||||
|
parameterHintsPrefix = mkNullableStrDefault "<- " "prefix for parameter hints";
|
||||||
|
otherHintsPrefix = mkNullableStrDefault "=> " "prefix for all the other hints (type, chaining)";
|
||||||
|
|
||||||
|
maxLenAlign =
|
||||||
|
mkNullableBoolDefault false
|
||||||
|
"whether to align to the length of the longest line in the file";
|
||||||
|
|
||||||
|
maxLenAlignPadding = mkNullableIntDefault 1 "padding from the left if max_len_align is true";
|
||||||
|
|
||||||
|
rightAlign = mkNullableBoolDefault false "whether to align to the extreme right or not";
|
||||||
|
rightAlignPadding = mkNullableIntDefault 7 "padding from the right if right_align is true";
|
||||||
|
|
||||||
|
highlight = mkNullableStrDefault "Comment" "The color of the hints";
|
||||||
|
};
|
||||||
|
|
||||||
|
hoverActions = {
|
||||||
|
border = mkOption {
|
||||||
|
type = types.nullOr types.anything;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
the border that is used for the hover window. see vim.api.nvim_open_win()
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
maxWidth = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = "Maximal width of the hover window. Nil means no max.";
|
||||||
|
};
|
||||||
|
maxHeight = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = "Maximal height of the hover window. Nil means no max.";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoFocus = mkNullableBoolDefault false "whether the hover action window gets automatically focused";
|
||||||
|
};
|
||||||
|
|
||||||
|
crateGraph = {
|
||||||
|
backend = mkNullableStrDefault "x11" ''
|
||||||
|
Backend used for displaying the graph
|
||||||
|
see: https://graphviz.org/docs/outputs/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inlayHints = {
|
output = mkOption {
|
||||||
auto = mkNullableBoolDefault true "automatically set inlay hints (type hints)";
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
onlyCurrentLine = mkNullableBoolDefault false "Only show for current line";
|
description = "where to store the output, nil for no output stored";
|
||||||
|
|
||||||
showParameterHints =
|
|
||||||
mkNullableBoolDefault true
|
|
||||||
"whether to show parameter hints with the inlay hints or not";
|
|
||||||
|
|
||||||
parameterHintsPrefix = mkNullableStrDefault "<- " "prefix for parameter hints";
|
|
||||||
otherHintsPrefix = mkNullableStrDefault "=> " "prefix for all the other hints (type, chaining)";
|
|
||||||
|
|
||||||
maxLenAlign =
|
|
||||||
mkNullableBoolDefault false
|
|
||||||
"whether to align to the length of the longest line in the file";
|
|
||||||
|
|
||||||
maxLenAlignPadding = mkNullableIntDefault 1 "padding from the left if max_len_align is true";
|
|
||||||
|
|
||||||
rightAlign = mkNullableBoolDefault false "whether to align to the extreme right or not";
|
|
||||||
rightAlignPadding = mkNullableIntDefault 7 "padding from the right if right_align is true";
|
|
||||||
|
|
||||||
highlight = mkNullableStrDefault "Comment" "The color of the hints";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hoverActions = {
|
full = mkNullableBoolDefault true ''
|
||||||
border = mkOption {
|
true for all crates.io and external crates, false only the local crates
|
||||||
type = types.nullOr types.anything;
|
'';
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
the border that is used for the hover window. see vim.api.nvim_open_win()
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
maxWidth = mkOption {
|
enabledGraphvizBackends = mkOption {
|
||||||
type = types.nullOr types.int;
|
type = types.nullOr (types.listOf types.str);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Maximal width of the hover window. Nil means no max.";
|
description = ''
|
||||||
};
|
List of backends found on: https://graphviz.org/docs/outputs/
|
||||||
maxHeight = mkOption {
|
Is used for input validation and autocompletion
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
description = "Maximal height of the hover window. Nil means no max.";
|
|
||||||
};
|
|
||||||
|
|
||||||
autoFocus = mkNullableBoolDefault false "whether the hover action window gets automatically focused";
|
|
||||||
};
|
|
||||||
|
|
||||||
crateGraph = {
|
|
||||||
backend = mkNullableStrDefault "x11" ''
|
|
||||||
Backend used for displaying the graph
|
|
||||||
see: https://graphviz.org/docs/outputs/
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
output = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
description = "where to store the output, nil for no output stored";
|
|
||||||
};
|
|
||||||
|
|
||||||
full = mkNullableBoolDefault true ''
|
|
||||||
true for all crates.io and external crates, false only the local crates
|
|
||||||
'';
|
|
||||||
|
|
||||||
enabledGraphvizBackends = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
List of backends found on: https://graphviz.org/docs/outputs/
|
|
||||||
Is used for input validation and autocompletion
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
server =
|
|
||||||
{
|
|
||||||
standalone = mkNullableBoolDefault true ''
|
|
||||||
standalone file support
|
|
||||||
setting it to false may improve startup time
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
|
||||||
};
|
};
|
||||||
config =
|
|
||||||
let
|
server =
|
||||||
cfg = config.plugins.rust-tools;
|
{
|
||||||
in
|
standalone = mkNullableBoolDefault true ''
|
||||||
|
standalone file support
|
||||||
|
setting it to false may improve startup time
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
||||||
|
};
|
||||||
|
config = let
|
||||||
|
cfg = config.plugins.rust-tools;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [ nvim-lspconfig cfg.package ];
|
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
|
||||||
extraPackages = [ cfg.serverPackage ];
|
extraPackages = [cfg.serverPackage];
|
||||||
|
|
||||||
plugins.lsp.postConfig =
|
plugins.lsp.postConfig = let
|
||||||
let
|
setupOptions = {
|
||||||
setupOptions = {
|
tools = {
|
||||||
tools = {
|
executor =
|
||||||
executor =
|
if cfg.executor != null
|
||||||
if cfg.executor != null
|
then {__raw = ''require("rust-tools.executors").${cfg.executor}'';}
|
||||||
then { __raw = ''require("rust-tools.executors").${cfg.executor}''; }
|
else null;
|
||||||
else null;
|
|
||||||
|
|
||||||
on_initialized =
|
on_initialized =
|
||||||
if cfg.onIntialized != null
|
if cfg.onIntialized != null
|
||||||
then { __raw = cfg.onIntialized; }
|
then {__raw = cfg.onIntialized;}
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||||
inlay_hints =
|
inlay_hints = let
|
||||||
let
|
cfgIH = cfg.inlayHints;
|
||||||
cfgIH = cfg.inlayHints;
|
in {
|
||||||
in
|
auto = cfgIH.auto;
|
||||||
{
|
only_current_line = cfgIH.onlyCurrentLine;
|
||||||
auto = cfgIH.auto;
|
show_parameter_hints = cfgIH.showParameterHints;
|
||||||
only_current_line = cfgIH.onlyCurrentLine;
|
parameter_hints_prefix = cfgIH.parameterHintsPrefix;
|
||||||
show_parameter_hints = cfgIH.showParameterHints;
|
other_hints_prefix = cfgIH.otherHintsPrefix;
|
||||||
parameter_hints_prefix = cfgIH.parameterHintsPrefix;
|
max_len_align = cfgIH.maxLenAlign;
|
||||||
other_hints_prefix = cfgIH.otherHintsPrefix;
|
max_len_align_padding = cfgIH.maxLenAlignPadding;
|
||||||
max_len_align = cfgIH.maxLenAlign;
|
right_align = cfgIH.rightAlign;
|
||||||
max_len_align_padding = cfgIH.maxLenAlignPadding;
|
right_align_padding = cfgIH.rightAlignPadding;
|
||||||
right_align = cfgIH.rightAlign;
|
highlight = cfgIH.highlight;
|
||||||
right_align_padding = cfgIH.rightAlignPadding;
|
|
||||||
highlight = cfgIH.highlight;
|
|
||||||
};
|
|
||||||
|
|
||||||
hover_actions =
|
|
||||||
let
|
|
||||||
cfgHA = cfg.hoverActions;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
border = cfgHA.border;
|
|
||||||
max_width = cfgHA.maxWidth;
|
|
||||||
max_height = cfgHA.maxHeight;
|
|
||||||
auto_focus = cfgHA.autoFocus;
|
|
||||||
};
|
|
||||||
|
|
||||||
crate_graph =
|
|
||||||
let
|
|
||||||
cfgCG = cfg.crateGraph;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
backend = cfgCG.backend;
|
|
||||||
output = cfgCG.output;
|
|
||||||
full = cfgCG.full;
|
|
||||||
enabled_graphviz_backends = cfgCG.enabledGraphvizBackends;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
server = {
|
|
||||||
standalone = cfg.server.standalone;
|
hover_actions = let
|
||||||
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
cfgHA = cfg.hoverActions;
|
||||||
on_attach = { __raw = "__lspOnAttach"; };
|
in {
|
||||||
|
border = cfgHA.border;
|
||||||
|
max_width = cfgHA.maxWidth;
|
||||||
|
max_height = cfgHA.maxHeight;
|
||||||
|
auto_focus = cfgHA.autoFocus;
|
||||||
|
};
|
||||||
|
|
||||||
|
crate_graph = let
|
||||||
|
cfgCG = cfg.crateGraph;
|
||||||
|
in {
|
||||||
|
backend = cfgCG.backend;
|
||||||
|
output = cfgCG.output;
|
||||||
|
full = cfgCG.full;
|
||||||
|
enabled_graphviz_backends = cfgCG.enabledGraphvizBackends;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
server = {
|
||||||
''
|
standalone = cfg.server.standalone;
|
||||||
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
||||||
'';
|
on_attach = {__raw = "__lspOnAttach";};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in ''
|
||||||
|
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,32 @@
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, config
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.plugins.tagbar;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
{
|
{
|
||||||
options.plugins.tagbar = {
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.tagbar;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with lib; {
|
||||||
|
options.plugins.tagbar = {
|
||||||
|
enable = mkEnableOption "tagbar";
|
||||||
|
|
||||||
enable = mkEnableOption "tagbar";
|
package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar;
|
||||||
|
|
||||||
package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar;
|
extraConfig = helpers.mkNullOrOption types.attrs ''
|
||||||
|
The configuration options for tagbar without the 'tagbar_' prefix.
|
||||||
|
Example: To set 'tagbar_show_tag_count' to 1, write
|
||||||
|
extraConfig = {
|
||||||
|
show_tag_count= true;
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = helpers.mkNullOrOption types.attrs ''
|
config = mkIf cfg.enable {
|
||||||
The configuration options for tagbar without the 'tagbar_' prefix.
|
extraPlugins = [cfg.package];
|
||||||
Example: To set 'tagbar_show_tag_count' to 1, write
|
|
||||||
extraConfig = {
|
|
||||||
show_tag_count= true;
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
extraPackages = [pkgs.ctags];
|
||||||
|
|
||||||
extraPlugins = [ cfg.package ];
|
globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig;
|
||||||
|
};
|
||||||
extraPackages = [ pkgs.ctags ];
|
}
|
||||||
|
|
||||||
globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{ pkgs
|
{
|
||||||
, lib
|
pkgs,
|
||||||
, config
|
lib,
|
||||||
, ...
|
config,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib; let
|
||||||
let
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in {
|
in {
|
||||||
options.plugins.treesitter-context = {
|
options.plugins.treesitter-context = {
|
||||||
enable = mkEnableOption "nvim-treesitter-context";
|
enable = mkEnableOption "nvim-treesitter-context";
|
||||||
|
@ -19,7 +19,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
trimScope = mkOption {
|
trimScope = mkOption {
|
||||||
type = types.enum [ "outer" "inner" ];
|
type = types.enum ["outer" "inner"];
|
||||||
default = "outer";
|
default = "outer";
|
||||||
description = "Which context lines to discard if `max_lines` is exceeded";
|
description = "Which context lines to discard if `max_lines` is exceeded";
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ in {
|
||||||
|
|
||||||
patterns = mkOption {
|
patterns = mkOption {
|
||||||
type = types.attrsOf (types.listOf types.str);
|
type = types.attrsOf (types.listOf types.str);
|
||||||
default = { };
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Patterns to use for context delimitation. The 'default' key matches all filetypes
|
Patterns to use for context delimitation. The 'default' key matches all filetypes
|
||||||
'';
|
'';
|
||||||
|
@ -40,17 +40,16 @@ in {
|
||||||
|
|
||||||
exactPatterns = mkOption {
|
exactPatterns = mkOption {
|
||||||
type = types.attrsOf types.bool;
|
type = types.attrsOf types.bool;
|
||||||
default = { };
|
default = {};
|
||||||
description = "Treat the coresponding entry in patterns as an exact match";
|
description = "Treat the coresponding entry in patterns as an exact match";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.treesitter-context;
|
||||||
cfg = config.plugins.treesitter-context;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
plugins.treesitter.moduleConfig.context = {
|
plugins.treesitter.moduleConfig.context = {
|
||||||
max_lines = cfg.maxLines;
|
max_lines = cfg.maxLines;
|
||||||
|
|
|
@ -1,114 +1,110 @@
|
||||||
{ pkgs
|
|
||||||
, config
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.plugins.treesitter-refactor =
|
pkgs,
|
||||||
let
|
config,
|
||||||
disable = mkOption {
|
lib,
|
||||||
type = types.listOf types.str;
|
...
|
||||||
default = [ ];
|
}:
|
||||||
description = "List of languages to disable the module on";
|
with lib; let
|
||||||
};
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in {
|
||||||
{
|
options.plugins.treesitter-refactor = let
|
||||||
|
disable = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = "List of languages to disable the module on";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
enable =
|
||||||
|
mkEnableOption
|
||||||
|
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor;
|
||||||
|
|
||||||
|
highlightDefinitions = {
|
||||||
|
inherit disable;
|
||||||
enable =
|
enable =
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
"Highlights definition and usages of the current symbol under the cursor.";
|
||||||
|
clearOnCursorMove = mkOption {
|
||||||
package = helpers.mkPackageOption "treesitter-refactor" pkgs.vimPlugins.nvim-treesitter-refactor;
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
highlightDefinitions = {
|
description = ''
|
||||||
inherit disable;
|
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
|
||||||
enable =
|
is around `100` you can set this to false to have a less laggy experience.
|
||||||
mkEnableOption
|
|
||||||
"Highlights definition and usages of the current symbol under the cursor.";
|
|
||||||
clearOnCursorMove = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Controls if highlights should be cleared when the cursor is moved. If your 'updatetime'
|
|
||||||
is around `100` you can set this to false to have a less laggy experience.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
highlightCurrentScope = {
|
|
||||||
inherit disable;
|
|
||||||
enable = mkEnableOption "highlights the block from the current scope where the cursor is.";
|
|
||||||
};
|
|
||||||
smartRename = {
|
|
||||||
inherit disable;
|
|
||||||
enable =
|
|
||||||
mkEnableOption
|
|
||||||
"Renames the symbol under the cursor within the current scope (and current file).";
|
|
||||||
keymaps = {
|
|
||||||
smartRename = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = "grr";
|
|
||||||
description = "rename symbol under the cursor";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
navigation = {
|
|
||||||
inherit disable;
|
|
||||||
enable = mkEnableOption ''
|
|
||||||
Provides "go to definition" for the symbol under the cursor,
|
|
||||||
and lists the definitions from the current file.
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
keymaps = {
|
};
|
||||||
gotoDefinition = mkOption {
|
highlightCurrentScope = {
|
||||||
type = types.nullOr types.str;
|
inherit disable;
|
||||||
default = "gnd";
|
enable = mkEnableOption "highlights the block from the current scope where the cursor is.";
|
||||||
description = "go to the definition of the symbol under the cursor";
|
};
|
||||||
};
|
smartRename = {
|
||||||
gotoDefinitionLspFallback = mkOption {
|
inherit disable;
|
||||||
type = types.nullOr types.str;
|
enable =
|
||||||
default = null;
|
mkEnableOption
|
||||||
description = ''
|
"Renames the symbol under the cursor within the current scope (and current file).";
|
||||||
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
|
keymaps = {
|
||||||
the symbol can not be resolved. You can use your own fallback function if create a
|
smartRename = mkOption {
|
||||||
mapping fo `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
|
type = types.nullOr types.str;
|
||||||
'';
|
default = "grr";
|
||||||
};
|
description = "rename symbol under the cursor";
|
||||||
listDefinitons = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = "gnD";
|
|
||||||
description = "list all definitions from the current file";
|
|
||||||
};
|
|
||||||
listDefinitonsToc = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = "gO";
|
|
||||||
description = ''
|
|
||||||
list all definitions from the current file like a table of contents (similar to the one
|
|
||||||
you see when pressing |gO| in help files).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
gotoNextUsage = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = "<a-*>";
|
|
||||||
description = "go to next usage of identifier under the cursor";
|
|
||||||
};
|
|
||||||
gotoPreviousUsage = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = "<a-#>";
|
|
||||||
description = "go to previous usage of identifier";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
navigation = {
|
||||||
|
inherit disable;
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
Provides "go to definition" for the symbol under the cursor,
|
||||||
|
and lists the definitions from the current file.
|
||||||
|
'';
|
||||||
|
|
||||||
config =
|
keymaps = {
|
||||||
let
|
gotoDefinition = mkOption {
|
||||||
cfg = config.plugins.treesitter-refactor;
|
type = types.nullOr types.str;
|
||||||
in
|
default = "gnd";
|
||||||
|
description = "go to the definition of the symbol under the cursor";
|
||||||
|
};
|
||||||
|
gotoDefinitionLspFallback = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
go to the definition of the symbol under the cursor or use vim.lsp.buf.definition if
|
||||||
|
the symbol can not be resolved. You can use your own fallback function if create a
|
||||||
|
mapping fo `lua require'nvim-treesitter.refactor.navigation(nil, fallback_function)<cr>`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
listDefinitons = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = "gnD";
|
||||||
|
description = "list all definitions from the current file";
|
||||||
|
};
|
||||||
|
listDefinitonsToc = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = "gO";
|
||||||
|
description = ''
|
||||||
|
list all definitions from the current file like a table of contents (similar to the one
|
||||||
|
you see when pressing |gO| in help files).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
gotoNextUsage = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = "<a-*>";
|
||||||
|
description = "go to next usage of identifier under the cursor";
|
||||||
|
};
|
||||||
|
gotoPreviousUsage = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = "<a-#>";
|
||||||
|
description = "go to previous usage of identifier";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
cfg = config.plugins.treesitter-refactor;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
plugins.treesitter.moduleConfig.refactor = {
|
plugins.treesitter.moduleConfig.refactor = {
|
||||||
highlight_definitions = {
|
highlight_definitions = {
|
||||||
|
@ -118,22 +114,20 @@ in
|
||||||
highlight_current_scope = cfg.highlightCurrentScope;
|
highlight_current_scope = cfg.highlightCurrentScope;
|
||||||
smart_rename = {
|
smart_rename = {
|
||||||
inherit (cfg.smartRename) enable disable;
|
inherit (cfg.smartRename) enable disable;
|
||||||
keymaps = { smart_rename = cfg.smartRename.keymaps.smartRename; };
|
keymaps = {smart_rename = cfg.smartRename.keymaps.smartRename;};
|
||||||
};
|
};
|
||||||
navigation = {
|
navigation = {
|
||||||
inherit (cfg.navigation) enable disable;
|
inherit (cfg.navigation) enable disable;
|
||||||
keymaps =
|
keymaps = let
|
||||||
let
|
cfgK = cfg.navigation.keymaps;
|
||||||
cfgK = cfg.navigation.keymaps;
|
in {
|
||||||
in
|
goto_definition = cfgK.gotoDefinition;
|
||||||
{
|
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
||||||
goto_definition = cfgK.gotoDefinition;
|
list_definitions = cfgK.listDefinitons;
|
||||||
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
list_definitions_toc = cfgK.listDefinitonsToc;
|
||||||
list_definitions = cfgK.listDefinitons;
|
goto_next_usage = cfgK.gotoNextUsage;
|
||||||
list_definitions_toc = cfgK.listDefinitonsToc;
|
goto_previous_usage = cfgK.gotoPreviousUsage;
|
||||||
goto_next_usage = cfgK.gotoNextUsage;
|
};
|
||||||
goto_previous_usage = cfgK.gotoPreviousUsage;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, lib, config, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.treesitter;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.treesitter;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.treesitter = {
|
plugins.treesitter = {
|
||||||
enable = mkEnableOption "tree-sitter syntax highlighting";
|
enable = mkEnableOption "tree-sitter syntax highlighting";
|
||||||
|
@ -22,7 +25,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
ensureInstalled = mkOption {
|
ensureInstalled = mkOption {
|
||||||
type = with types; oneOf [ (enum [ "all" ]) (listOf str) ];
|
type = with types; oneOf [(enum ["all"]) (listOf str)];
|
||||||
default = "all";
|
default = "all";
|
||||||
description = "Either \"all\" or a list of languages";
|
description = "Either \"all\" or a list of languages";
|
||||||
};
|
};
|
||||||
|
@ -32,8 +35,7 @@ in
|
||||||
default =
|
default =
|
||||||
if cfg.nixGrammars
|
if cfg.nixGrammars
|
||||||
then null
|
then null
|
||||||
else "$XDG_DATA_HOME/nvim/treesitter"
|
else "$XDG_DATA_HOME/nvim/treesitter";
|
||||||
;
|
|
||||||
description = ''
|
description = ''
|
||||||
Location of the parsers to be installed by the plugin (only needed when nixGrammars is disabled).
|
Location of the parsers to be installed by the plugin (only needed when nixGrammars is disabled).
|
||||||
This default might not work on your own install, please make sure that $XDG_DATA_HOME is set if you want to use the default. Otherwise, change it to something that will work for you!
|
This default might not work on your own install, please make sure that $XDG_DATA_HOME is set if you want to use the default. Otherwise, change it to something that will work for you!
|
||||||
|
@ -42,38 +44,37 @@ in
|
||||||
|
|
||||||
ignoreInstall = mkOption {
|
ignoreInstall = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "List of parsers to ignore installing (for \"all\")";
|
description = "List of parsers to ignore installing (for \"all\")";
|
||||||
};
|
};
|
||||||
|
|
||||||
disabledLanguages = mkOption {
|
disabledLanguages = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "A list of languages to disable";
|
description = "A list of languages to disable";
|
||||||
};
|
};
|
||||||
|
|
||||||
customCaptures = mkOption {
|
customCaptures = mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
default = { };
|
default = {};
|
||||||
description = "Custom capture group highlighting";
|
description = "Custom capture group highlighting";
|
||||||
};
|
};
|
||||||
|
|
||||||
incrementalSelection =
|
incrementalSelection = let
|
||||||
let
|
keymap = default:
|
||||||
keymap = default: mkOption {
|
mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
inherit default;
|
inherit default;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
||||||
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
keymaps = {
|
||||||
keymaps = {
|
initSelection = keymap "gnn";
|
||||||
initSelection = keymap "gnn";
|
nodeIncremental = keymap "grn";
|
||||||
nodeIncremental = keymap "grn";
|
scopeIncremental = keymap "grc";
|
||||||
scopeIncremental = keymap "grc";
|
nodeDecremental = keymap "grm";
|
||||||
nodeDecremental = keymap "grm";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
indent = mkEnableOption "tree-sitter based indentation";
|
indent = mkEnableOption "tree-sitter based indentation";
|
||||||
|
|
||||||
|
@ -87,24 +88,31 @@ in
|
||||||
|
|
||||||
moduleConfig = mkOption {
|
moduleConfig = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
default = { };
|
default = {};
|
||||||
description = "This is the configuration for extra modules. It should not be used directly";
|
description = "This is the configuration for extra modules. It should not be used directly";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
tsOptions =
|
||||||
tsOptions = {
|
{
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = cfg.enable;
|
enable = cfg.enable;
|
||||||
disable = if (cfg.disabledLanguages != [ ]) then cfg.disabledLanguages else null;
|
disable =
|
||||||
|
if (cfg.disabledLanguages != [])
|
||||||
|
then cfg.disabledLanguages
|
||||||
|
else null;
|
||||||
|
|
||||||
custom_captures = if (cfg.customCaptures != { }) then cfg.customCaptures else null;
|
custom_captures =
|
||||||
|
if (cfg.customCaptures != {})
|
||||||
|
then cfg.customCaptures
|
||||||
|
else null;
|
||||||
};
|
};
|
||||||
|
|
||||||
incremental_selection =
|
incremental_selection =
|
||||||
if cfg.incrementalSelection.enable then {
|
if cfg.incrementalSelection.enable
|
||||||
|
then {
|
||||||
enable = true;
|
enable = true;
|
||||||
keymaps = {
|
keymaps = {
|
||||||
init_selection = cfg.incrementalSelection.keymaps.initSelection;
|
init_selection = cfg.incrementalSelection.keymaps.initSelection;
|
||||||
|
@ -112,29 +120,39 @@ in
|
||||||
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
|
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
|
||||||
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
|
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
|
||||||
};
|
};
|
||||||
} else null;
|
}
|
||||||
|
else null;
|
||||||
|
|
||||||
indent =
|
indent =
|
||||||
if cfg.indent then {
|
if cfg.indent
|
||||||
|
then {
|
||||||
enable = true;
|
enable = true;
|
||||||
} else null;
|
}
|
||||||
|
else null;
|
||||||
|
|
||||||
ensure_installed = if cfg.nixGrammars then [ ] else cfg.ensureInstalled;
|
ensure_installed =
|
||||||
|
if cfg.nixGrammars
|
||||||
|
then []
|
||||||
|
else cfg.ensureInstalled;
|
||||||
ignore_install = cfg.ignoreInstall;
|
ignore_install = cfg.ignoreInstall;
|
||||||
parser_install_dir = cfg.parserInstallDir;
|
parser_install_dir = cfg.parserInstallDir;
|
||||||
} // cfg.moduleConfig;
|
}
|
||||||
in
|
// cfg.moduleConfig;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraConfigLua = (optionalString (cfg.parserInstallDir != null) ''
|
extraConfigLua =
|
||||||
vim.opt.runtimepath:append("${cfg.parserInstallDir}")
|
(optionalString (cfg.parserInstallDir != null) ''
|
||||||
'') + ''
|
vim.opt.runtimepath:append("${cfg.parserInstallDir}")
|
||||||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
'')
|
||||||
'';
|
+ ''
|
||||||
|
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||||
|
'';
|
||||||
|
|
||||||
extraPlugins = with pkgs; if cfg.nixGrammars then
|
extraPlugins = with pkgs;
|
||||||
[ (cfg.package.withPlugins (_: cfg.grammarPackages)) ]
|
if cfg.nixGrammars
|
||||||
else [ cfg.package ];
|
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
||||||
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
|
else [cfg.package];
|
||||||
|
extraPackages = [pkgs.tree-sitter pkgs.nodejs];
|
||||||
|
|
||||||
options = mkIf cfg.folding {
|
options = mkIf cfg.folding {
|
||||||
foldmethod = "expr";
|
foldmethod = "expr";
|
||||||
|
@ -142,4 +160,3 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,40 @@
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, config
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.plugins.vimtex;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
{
|
{
|
||||||
options.plugins.vimtex = {
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.vimtex;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with lib; {
|
||||||
|
options.plugins.vimtex = {
|
||||||
|
enable = mkEnableOption "vimtex";
|
||||||
|
|
||||||
enable = mkEnableOption "vimtex";
|
package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex;
|
||||||
|
|
||||||
package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex;
|
extraConfig = helpers.mkNullOrOption types.attrs ''
|
||||||
|
The configuration options for vimtex without the 'vimtex_' prefix.
|
||||||
extraConfig = helpers.mkNullOrOption types.attrs ''
|
Example: To set 'vimtex_compiler_enabled' to 1, write
|
||||||
The configuration options for vimtex without the 'vimtex_' prefix.
|
extraConfig = {
|
||||||
Example: To set 'vimtex_compiler_enabled' to 1, write
|
compiler_enabled = true;
|
||||||
extraConfig = {
|
};
|
||||||
compiler_enabled = true;
|
'';
|
||||||
};
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
globals = {
|
|
||||||
enabled = cfg.enable;
|
|
||||||
} // cfg.extraConfig;
|
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
|
||||||
|
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
|
|
||||||
# Usefull for inverse search
|
|
||||||
extraPackages = with pkgs; [ pstree xdotool ];
|
|
||||||
|
|
||||||
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals;
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
config = let
|
||||||
|
globals =
|
||||||
|
{
|
||||||
|
enabled = cfg.enable;
|
||||||
|
}
|
||||||
|
// cfg.extraConfig;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
|
# Usefull for inverse search
|
||||||
|
extraPackages = with pkgs; [pstree xdotool];
|
||||||
|
|
||||||
|
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "zig";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable zig";
|
in
|
||||||
package = pkgs.vimPlugins.zig-vim;
|
with helpers;
|
||||||
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "zig";
|
||||||
|
description = "Enable zig";
|
||||||
|
package = pkgs.vimPlugins.zig-vim;
|
||||||
|
|
||||||
# Possibly add option to disable Treesitter highlighting if this is installed
|
# Possibly add option to disable Treesitter highlighting if this is installed
|
||||||
options = {
|
options = {
|
||||||
formatOnSave = mkDefaultOpt {
|
formatOnSave = mkDefaultOpt {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
global = "zig_fmt_autosave";
|
global = "zig_fmt_autosave";
|
||||||
description = "Run zig fmt on save";
|
description = "Run zig fmt on save";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.null-ls;
|
|
||||||
helpers = (import ../helpers.nix { inherit lib; });
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.null-ls;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./servers.nix
|
./servers.nix
|
||||||
];
|
];
|
||||||
|
@ -36,15 +39,14 @@ in
|
||||||
# };
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
options = {
|
||||||
options = {
|
debug = cfg.debug;
|
||||||
debug = cfg.debug;
|
sources = cfg.sourcesItems;
|
||||||
sources = cfg.sourcesItems;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require("null-ls").setup(${helpers.toLuaObject options})
|
require("null-ls").setup(${helpers.toLuaObject options})
|
||||||
|
|
|
@ -1,30 +1,41 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
{
|
{
|
||||||
mkServer =
|
pkgs,
|
||||||
{ name
|
config,
|
||||||
, sourceType
|
lib,
|
||||||
, description ? "${name} source, for null-ls."
|
...
|
||||||
, package ? null
|
}: {
|
||||||
, extraPackages ? [ ]
|
mkServer = {
|
||||||
, ...
|
name,
|
||||||
}:
|
sourceType,
|
||||||
# returns a module
|
description ? "${name} source, for null-ls.",
|
||||||
{ pkgs, config, lib, ... }@args:
|
package ? null,
|
||||||
with lib;
|
extraPackages ? [],
|
||||||
let
|
...
|
||||||
helpers = import ../helpers.nix args;
|
}:
|
||||||
cfg = config.plugins.null-ls.sources.${sourceType}.${name};
|
# returns a module
|
||||||
# does this evaluate package?
|
{
|
||||||
packageOption = if package == null then { } else {
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../helpers.nix args;
|
||||||
|
cfg = config.plugins.null-ls.sources.${sourceType}.${name};
|
||||||
|
# does this evaluate package?
|
||||||
|
packageOption =
|
||||||
|
if package == null
|
||||||
|
then {}
|
||||||
|
else {
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = package;
|
default = package;
|
||||||
description = "Package to use for ${name} by null-ls";
|
description = "Package to use for ${name} by null-ls";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
options.plugins.null-ls.sources.${sourceType}.${name} =
|
||||||
options.plugins.null-ls.sources.${sourceType}.${name} = {
|
{
|
||||||
enable = mkEnableOption description;
|
enable = mkEnableOption description;
|
||||||
|
|
||||||
# TODO: withArgs can exist outside of the module in a generalized manner
|
# TODO: withArgs can exist outside of the module in a generalized manner
|
||||||
|
@ -37,20 +48,22 @@
|
||||||
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
|
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
|
||||||
# '';
|
# '';
|
||||||
};
|
};
|
||||||
} // packageOption;
|
}
|
||||||
|
// packageOption;
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# Does this evaluate package?
|
# Does this evaluate package?
|
||||||
extraPackages = extraPackages ++ optional (package != null) cfg.package;
|
extraPackages = extraPackages ++ optional (package != null) cfg.package;
|
||||||
|
|
||||||
# Add source to list of sources
|
# Add source to list of sources
|
||||||
plugins.null-ls.sourcesItems =
|
plugins.null-ls.sourcesItems = let
|
||||||
let
|
sourceItem = "${sourceType}.${name}";
|
||||||
sourceItem = "${sourceType}.${name}";
|
withArgs =
|
||||||
withArgs = if (isNull cfg.withArgs) then sourceItem else "${sourceItem}.with ${cfg.withArgs}";
|
if (isNull cfg.withArgs)
|
||||||
finalString = ''require("null-ls").builtins.${withArgs}'';
|
then sourceItem
|
||||||
in
|
else "${sourceItem}.with ${cfg.withArgs}";
|
||||||
[ (helpers.mkRaw finalString) ];
|
finalString = ''require("null-ls").builtins.${withArgs}'';
|
||||||
};
|
in [(helpers.mkRaw finalString)];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
{ pkgs, config, lib, ... }@args:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
helpers = import ./helpers.nix args;
|
helpers = import ./helpers.nix args;
|
||||||
serverData = {
|
serverData = {
|
||||||
code_actions = {
|
code_actions = {
|
||||||
gitsigns = { };
|
gitsigns = {};
|
||||||
shellcheck = {
|
shellcheck = {
|
||||||
package = pkgs.shellcheck;
|
package = pkgs.shellcheck;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
completion = { };
|
completion = {};
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
flake8 = {
|
flake8 = {
|
||||||
package = pkgs.python3Packages.flake8;
|
package = pkgs.python3Packages.flake8;
|
||||||
|
@ -65,20 +69,20 @@ let
|
||||||
# sourceType = "formatting";
|
# sourceType = "formatting";
|
||||||
# packages = [...];
|
# packages = [...];
|
||||||
# }]
|
# }]
|
||||||
serverDataFormatted = lib.mapAttrsToList
|
serverDataFormatted =
|
||||||
(sourceType: sourceSet:
|
lib.mapAttrsToList
|
||||||
lib.mapAttrsToList (name: attrs: attrs // { inherit sourceType name; }) sourceSet
|
(
|
||||||
|
sourceType: sourceSet:
|
||||||
|
lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet
|
||||||
)
|
)
|
||||||
serverData;
|
serverData;
|
||||||
dataFlattened = lib.flatten serverDataFormatted;
|
dataFlattened = lib.flatten serverDataFormatted;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = lib.lists.map (helpers.mkServer) dataFlattened;
|
imports = lib.lists.map (helpers.mkServer) dataFlattened;
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.null-ls;
|
||||||
cfg = config.plugins.null-ls;
|
in
|
||||||
in
|
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
plugins.gitsigns.enable = lib.mkIf (cfg.sources.code_actions.gitsigns.enable) true;
|
plugins.gitsigns.enable = lib.mkIf (cfg.sources.code_actions.gitsigns.enable) true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
{ pkgs, config, lib, ... }@args:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
helpers = import ./helpers.nix args;
|
helpers = import ./helpers.nix args;
|
||||||
servers = [
|
servers = [
|
||||||
{
|
{
|
||||||
name = "astro";
|
name = "astro";
|
||||||
description = "Enable astrols, for Astro";
|
description = "Enable astrols, for Astro";
|
||||||
package = pkgs.nodePackages."@astrojs/language-server";
|
package = pkgs.nodePackages."@astrojs/language-server";
|
||||||
cmd = cfg: [ "${cfg.package}/bin/astro-ls" "--stdio" ];
|
cmd = cfg: ["${cfg.package}/bin/astro-ls" "--stdio"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "bashls";
|
name = "bashls";
|
||||||
|
@ -23,7 +27,7 @@ let
|
||||||
name = "cssls";
|
name = "cssls";
|
||||||
description = "Enable cssls, for CSS";
|
description = "Enable cssls, for CSS";
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/vscode-css-language-server" "--stdio" ];
|
cmd = cfg: ["${cfg.package}/bin/vscode-css-language-server" "--stdio"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "dartls";
|
name = "dartls";
|
||||||
|
@ -70,7 +74,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
renameFilesWithClasses = mkOption {
|
renameFilesWithClasses = mkOption {
|
||||||
type = types.nullOr (types.enum [ "always" "prompt" ]);
|
type = types.nullOr (types.enum ["always" "prompt"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
When set to "always", will include edits to rename files when classes are renamed if the
|
When set to "always", will include edits to rename files when classes are renamed if the
|
||||||
|
@ -98,7 +102,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
documentation = mkOption {
|
documentation = mkOption {
|
||||||
type = types.nullOr (types.enum [ "none" "summary" "full" ]);
|
type = types.nullOr (types.enum ["none" "summary" "full"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other
|
The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other
|
||||||
|
@ -114,7 +118,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
settings = cfg: { dart = cfg; };
|
settings = cfg: {dart = cfg;};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "denols";
|
name = "denols";
|
||||||
|
@ -125,13 +129,13 @@ let
|
||||||
name = "eslint";
|
name = "eslint";
|
||||||
description = "Enable eslint";
|
description = "Enable eslint";
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/vscode-eslint-language-server" "--stdio" ];
|
cmd = cfg: ["${cfg.package}/bin/vscode-eslint-language-server" "--stdio"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "elixirls";
|
name = "elixirls";
|
||||||
description = "Enable elixirls";
|
description = "Enable elixirls";
|
||||||
package = pkgs.elixir_ls;
|
package = pkgs.elixir_ls;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/elixir-ls" ];
|
cmd = cfg: ["${cfg.package}/bin/elixir-ls"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "gdscript";
|
name = "gdscript";
|
||||||
|
@ -146,13 +150,13 @@ let
|
||||||
name = "html";
|
name = "html";
|
||||||
description = "Enable html, for HTML";
|
description = "Enable html, for HTML";
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/vscode-html-language-server" "--stdio" ];
|
cmd = cfg: ["${cfg.package}/bin/vscode-html-language-server" "--stdio"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "jsonls";
|
name = "jsonls";
|
||||||
description = "Enable jsonls, for JSON";
|
description = "Enable jsonls, for JSON";
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/vscode-json-language-server" "--stdio" ];
|
cmd = cfg: ["${cfg.package}/bin/vscode-json-language-server" "--stdio"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "nil_ls";
|
name = "nil_ls";
|
||||||
|
@ -170,7 +174,7 @@ let
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
ignored = mkOption {
|
ignored = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
Ignored diagnostic kinds.
|
Ignored diagnostic kinds.
|
||||||
The kind identifier is a snake_cased_string usually shown together
|
The kind identifier is a snake_cased_string usually shown together
|
||||||
|
@ -179,7 +183,7 @@ let
|
||||||
};
|
};
|
||||||
excludedFiles = mkOption {
|
excludedFiles = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
Files to exclude from showing diagnostics. Useful for generated files.
|
Files to exclude from showing diagnostics. Useful for generated files.
|
||||||
It accepts an array of paths. Relative paths are joint to the workspace root.
|
It accepts an array of paths. Relative paths are joint to the workspace root.
|
||||||
|
@ -188,7 +192,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
settings = cfg: { nil = { inherit (cfg) formatting diagnostics; }; };
|
settings = cfg: {nil = {inherit (cfg) formatting diagnostics;};};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "pyright";
|
name = "pyright";
|
||||||
|
@ -205,7 +209,7 @@ let
|
||||||
serverName = "rust_analyzer";
|
serverName = "rust_analyzer";
|
||||||
|
|
||||||
settingsOptions = import ./rust-analyzer-config.nix lib;
|
settingsOptions = import ./rust-analyzer-config.nix lib;
|
||||||
settings = cfg: { rust-analyzer = cfg; };
|
settings = cfg: {rust-analyzer = cfg;};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "sumneko-lua";
|
name = "sumneko-lua";
|
||||||
|
@ -240,10 +244,9 @@ let
|
||||||
name = "hls";
|
name = "hls";
|
||||||
description = "Enable haskell language server";
|
description = "Enable haskell language server";
|
||||||
package = pkgs.haskell-language-server;
|
package = pkgs.haskell-language-server;
|
||||||
cmd = cfg: [ "haskell-language-server-wrapper" ];
|
cmd = cfg: ["haskell-language-server-wrapper"];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = lib.lists.map (helpers.mkLsp) servers;
|
imports = lib.lists.map (helpers.mkLsp) servers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.lsp;
|
|
||||||
helpers = (import ../helpers.nix { inherit lib; });
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lsp;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./basic-servers.nix
|
./basic-servers.nix
|
||||||
];
|
];
|
||||||
|
@ -14,24 +17,25 @@ in
|
||||||
enable = mkEnableOption "neovim's built-in LSP";
|
enable = mkEnableOption "neovim's built-in LSP";
|
||||||
|
|
||||||
enabledServers = mkOption {
|
enabledServers = mkOption {
|
||||||
type = with types; listOf (oneOf [
|
type = with types;
|
||||||
str
|
listOf (oneOf [
|
||||||
(submodule {
|
str
|
||||||
options = {
|
(submodule {
|
||||||
name = mkOption {
|
options = {
|
||||||
type = str;
|
name = mkOption {
|
||||||
description = "The server's name";
|
type = str;
|
||||||
};
|
description = "The server's name";
|
||||||
|
};
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
description = "Extra options for the server";
|
description = "Extra options for the server";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
})
|
]);
|
||||||
]);
|
|
||||||
description = "A list of enabled LSP servers. Don't use this directly.";
|
description = "A list of enabled LSP servers. Don't use this directly.";
|
||||||
default = [ ];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
onAttach = mkOption {
|
onAttach = mkOption {
|
||||||
|
@ -43,7 +47,7 @@ in
|
||||||
setupWrappers = mkOption {
|
setupWrappers = mkOption {
|
||||||
type = with types; listOf (functionTo str);
|
type = with types; listOf (functionTo str);
|
||||||
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
||||||
default = [ ];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
preConfig = mkOption {
|
preConfig = mkOption {
|
||||||
|
@ -60,14 +64,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
runWrappers = wrappers: s:
|
||||||
runWrappers = wrappers: s:
|
if wrappers == []
|
||||||
if wrappers == [ ] then s
|
then s
|
||||||
else (head wrappers) (runWrappers (tail wrappers) s);
|
else (head wrappers) (runWrappers (tail wrappers) s);
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ pkgs.vimPlugins.nvim-lspconfig ];
|
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
||||||
|
|
||||||
# Enable all LSP servers
|
# Enable all LSP servers
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
|
|
|
@ -1,51 +1,65 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
mkLsp =
|
pkgs,
|
||||||
{ name
|
config,
|
||||||
, description ? "Enable ${name}."
|
lib,
|
||||||
, serverName ? name
|
...
|
||||||
, package ? pkgs.${name}
|
}: {
|
||||||
, extraPackages ? { }
|
mkLsp = {
|
||||||
, cmd ? (cfg: null)
|
name,
|
||||||
, settings ? (cfg: { })
|
description ? "Enable ${name}.",
|
||||||
, settingsOptions ? { }
|
serverName ? name,
|
||||||
, ...
|
package ? pkgs.${name},
|
||||||
}:
|
extraPackages ? {},
|
||||||
# returns a module
|
cmd ? (cfg: null),
|
||||||
{ pkgs, config, lib, ... }:
|
settings ? (cfg: {}),
|
||||||
with lib;
|
settingsOptions ? {},
|
||||||
let
|
...
|
||||||
cfg = config.plugins.lsp.servers.${name};
|
}:
|
||||||
|
# returns a module
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lsp.servers.${name};
|
||||||
|
|
||||||
packageOption =
|
packageOption =
|
||||||
if package != null then {
|
if package != null
|
||||||
package = mkOption {
|
then {
|
||||||
default = package;
|
package = mkOption {
|
||||||
type = types.nullOr types.package;
|
default = package;
|
||||||
};
|
type = types.nullOr types.package;
|
||||||
} else { };
|
};
|
||||||
in
|
}
|
||||||
{
|
else {};
|
||||||
options = {
|
in {
|
||||||
plugins.lsp.servers.${name} = {
|
options = {
|
||||||
|
plugins.lsp.servers.${name} =
|
||||||
|
{
|
||||||
enable = mkEnableOption description;
|
enable = mkEnableOption description;
|
||||||
settings = settingsOptions;
|
settings = settingsOptions;
|
||||||
} // packageOption;
|
}
|
||||||
};
|
// packageOption;
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config =
|
||||||
{
|
mkIf cfg.enable
|
||||||
extraPackages = (optional (package != null) cfg.package) ++
|
{
|
||||||
(mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
|
extraPackages =
|
||||||
|
(optional (package != null) cfg.package)
|
||||||
|
++ (mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
|
||||||
|
|
||||||
plugins.lsp.enabledServers = [{
|
plugins.lsp.enabledServers = [
|
||||||
|
{
|
||||||
name = serverName;
|
name = serverName;
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
cmd = cmd cfg;
|
cmd = cmd cfg;
|
||||||
settings = settings cfg.settings;
|
settings = settings cfg.settings;
|
||||||
};
|
};
|
||||||
}];
|
}
|
||||||
};
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, lib, config, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.lsp-lines;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lsp-lines;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.lsp-lines = {
|
plugins.lsp-lines = {
|
||||||
enable = mkEnableOption "lsp_lines.nvim";
|
enable = mkEnableOption "lsp_lines.nvim";
|
||||||
|
@ -19,24 +22,25 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
diagnosticConfig = {
|
||||||
diagnosticConfig = {
|
virtual_text = false;
|
||||||
virtual_text = false;
|
virtual_lines =
|
||||||
virtual_lines =
|
if cfg.currentLine
|
||||||
if cfg.currentLine then {
|
then {
|
||||||
only_current_line = true;
|
only_current_line = true;
|
||||||
} else true;
|
}
|
||||||
};
|
else true;
|
||||||
in
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
do
|
do
|
||||||
require("lsp_lines").setup()
|
require("lsp_lines").setup()
|
||||||
|
|
||||||
vim.diagnostic.config(${ helpers.toLuaObject diagnosticConfig })
|
vim.diagnostic.config(${helpers.toLuaObject diagnosticConfig})
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, lib, config, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.lspsaga;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lspsaga;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.lspsaga = {
|
plugins.lspsaga = {
|
||||||
enable = mkEnableOption "lspsaga.nvim";
|
enable = mkEnableOption "lspsaga.nvim";
|
||||||
|
@ -107,32 +110,31 @@ in
|
||||||
description = "Maximum finder preview lines";
|
description = "Maximum finder preview lines";
|
||||||
};
|
};
|
||||||
|
|
||||||
keys =
|
keys = let
|
||||||
let
|
defaultKeyOpt = desc:
|
||||||
defaultKeyOpt = desc: mkOption {
|
mkOption {
|
||||||
description = desc;
|
description = desc;
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
finderAction = {
|
||||||
finderAction = {
|
open = defaultKeyOpt "Open from finder";
|
||||||
open = defaultKeyOpt "Open from finder";
|
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
split = defaultKeyOpt "Horizontal split in finder";
|
||||||
split = defaultKeyOpt "Horizontal split in finder";
|
quit = defaultKeyOpt "Quit finder";
|
||||||
quit = defaultKeyOpt "Quit finder";
|
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
|
||||||
};
|
|
||||||
|
|
||||||
codeAction = {
|
|
||||||
quit = defaultKeyOpt "Quit code actions menu";
|
|
||||||
exec = defaultKeyOpt "Execute code action";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
codeAction = {
|
||||||
|
quit = defaultKeyOpt "Quit code actions menu";
|
||||||
|
exec = defaultKeyOpt "Execute code action";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
borderStyle = mkOption {
|
borderStyle = mkOption {
|
||||||
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
type = types.nullOr (types.enum ["thin" "rounded" "thick"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Border style";
|
description = "Border style";
|
||||||
};
|
};
|
||||||
|
@ -145,71 +147,75 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
notDefault = default: opt:
|
||||||
notDefault = default: opt: if (opt != default) then opt else null;
|
if (opt != default)
|
||||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != { }) then opt else null;
|
then opt
|
||||||
notNull = opt: opt;
|
else null;
|
||||||
lspsagaConfig = {
|
notEmpty = opt:
|
||||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
if ((filterAttrs (_: v: v != null) opt) != {})
|
||||||
error_sign = notNull cfg.signs.error;
|
then opt
|
||||||
warn_sign = notNull cfg.signs.warning;
|
else null;
|
||||||
hint_sign = notNull cfg.signs.hint;
|
notNull = opt: opt;
|
||||||
infor_sign = notNull cfg.signs.info;
|
lspsagaConfig = {
|
||||||
|
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||||
|
error_sign = notNull cfg.signs.error;
|
||||||
|
warn_sign = notNull cfg.signs.warning;
|
||||||
|
hint_sign = notNull cfg.signs.hint;
|
||||||
|
infor_sign = notNull cfg.signs.info;
|
||||||
|
|
||||||
# TODO Fix this!
|
# TODO Fix this!
|
||||||
# error_header = notNull cfg.headers.error;
|
# error_header = notNull cfg.headers.error;
|
||||||
# warn_header = notNull cfg.headers.warning;
|
# warn_header = notNull cfg.headers.warning;
|
||||||
# hint_header = notNull cfg.headers.hint;
|
# hint_header = notNull cfg.headers.hint;
|
||||||
# infor_header = notNull cfg.headers.info;
|
# infor_header = notNull cfg.headers.info;
|
||||||
|
|
||||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||||
|
|
||||||
code_action_icon = notNull cfg.icons.codeAction;
|
code_action_icon = notNull cfg.icons.codeAction;
|
||||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||||
finder_reference_icon = notNull cfg.icons.findReference;
|
finder_reference_icon = notNull cfg.icons.findReference;
|
||||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||||
|
|
||||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||||
|
|
||||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||||
|
|
||||||
border_style =
|
border_style = let
|
||||||
let
|
borderStyle =
|
||||||
borderStyle =
|
if cfg.borderStyle == "thin"
|
||||||
if cfg.borderStyle == "thin" then 1
|
then 1
|
||||||
else if cfg.borderStyle == "rounded" then 2
|
else if cfg.borderStyle == "rounded"
|
||||||
else if cfg.borderStyle == "thick" then 3
|
then 2
|
||||||
else null;
|
else if cfg.borderStyle == "thick"
|
||||||
in
|
then 3
|
||||||
borderStyle;
|
else null;
|
||||||
|
in
|
||||||
|
borderStyle;
|
||||||
|
|
||||||
finder_action_keys =
|
finder_action_keys = let
|
||||||
let
|
keys = {
|
||||||
keys = {
|
open = notNull cfg.keys.finderAction.open;
|
||||||
open = notNull cfg.keys.finderAction.open;
|
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
split = notNull cfg.keys.finderAction.split;
|
||||||
split = notNull cfg.keys.finderAction.split;
|
quit = notNull cfg.keys.finderAction.quit;
|
||||||
quit = notNull cfg.keys.finderAction.quit;
|
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
};
|
||||||
};
|
in
|
||||||
in
|
notEmpty keys;
|
||||||
notEmpty keys;
|
|
||||||
|
|
||||||
code_action_keys =
|
code_action_keys = let
|
||||||
let
|
keys = {
|
||||||
keys = {
|
quit = notNull cfg.keys.codeAction.quit;
|
||||||
quit = notNull cfg.keys.codeAction.quit;
|
exec = notNull cfg.keys.codeAction.exec;
|
||||||
exec = notNull cfg.keys.codeAction.exec;
|
};
|
||||||
};
|
in
|
||||||
in
|
notEmpty keys;
|
||||||
notEmpty keys;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
local saga = require 'lspsaga'
|
local saga = require 'lspsaga'
|
||||||
|
|
|
@ -1,70 +1,69 @@
|
||||||
{ pkgs
|
{
|
||||||
, lib
|
pkgs,
|
||||||
, config
|
lib,
|
||||||
, ...
|
config,
|
||||||
}:
|
...
|
||||||
let
|
}: let
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in
|
||||||
with lib; {
|
with lib; {
|
||||||
options.plugins.nvim-lightbulb = {
|
options.plugins.nvim-lightbulb = {
|
||||||
enable = mkEnableOption "nvim-lightbulb, showing available code actions";
|
enable = mkEnableOption "nvim-lightbulb, showing available code actions";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "nvim-lightbulb" pkgs.vimPlugins.nvim-lightbulb;
|
package = helpers.mkPackageOption "nvim-lightbulb" pkgs.vimPlugins.nvim-lightbulb;
|
||||||
|
|
||||||
ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
LSP client names to ignore
|
LSP client names to ignore
|
||||||
'';
|
|
||||||
|
|
||||||
sign = {
|
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "";
|
|
||||||
priority = helpers.defaultNullOpts.mkInt 10 "";
|
|
||||||
};
|
|
||||||
|
|
||||||
float = {
|
|
||||||
enabled = helpers.defaultNullOpts.mkBool false "";
|
|
||||||
|
|
||||||
text = helpers.defaultNullOpts.mkStr "💡" "Text to show in the popup float";
|
|
||||||
|
|
||||||
winOpts = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}" ''
|
|
||||||
Options for the floating window (see |vim.lsp.util.open_floating_preview| for more information)
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
virtualText = {
|
sign = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool false "";
|
enabled = helpers.defaultNullOpts.mkBool true "";
|
||||||
|
priority = helpers.defaultNullOpts.mkInt 10 "";
|
||||||
|
};
|
||||||
|
|
||||||
text = helpers.defaultNullOpts.mkStr "💡" "Text to show at virtual text";
|
float = {
|
||||||
|
enabled = helpers.defaultNullOpts.mkBool false "";
|
||||||
|
|
||||||
hlMode = helpers.defaultNullOpts.mkStr "replace" ''
|
text = helpers.defaultNullOpts.mkStr "💡" "Text to show in the popup float";
|
||||||
highlight mode to use for virtual text (replace, combine, blend), see
|
|
||||||
:help nvim_buf_set_extmark() for reference
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
statusText = {
|
winOpts = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}" ''
|
||||||
enabled = helpers.defaultNullOpts.mkBool false "";
|
Options for the floating window (see |vim.lsp.util.open_floating_preview| for more information)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
text = helpers.defaultNullOpts.mkStr "💡" "Text to provide when code actions are available";
|
virtualText = {
|
||||||
|
enabled = helpers.defaultNullOpts.mkBool false "";
|
||||||
|
|
||||||
textUnavailable = helpers.defaultNullOpts.mkStr "" ''
|
text = helpers.defaultNullOpts.mkStr "💡" "Text to show at virtual text";
|
||||||
Text to provide when no actions are available
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
autocmd = {
|
hlMode = helpers.defaultNullOpts.mkStr "replace" ''
|
||||||
enabled = helpers.defaultNullOpts.mkBool false "";
|
highlight mode to use for virtual text (replace, combine, blend), see
|
||||||
|
:help nvim_buf_set_extmark() for reference
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
pattern = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["*"]'' "";
|
statusText = {
|
||||||
|
enabled = helpers.defaultNullOpts.mkBool false "";
|
||||||
|
|
||||||
events =
|
text = helpers.defaultNullOpts.mkStr "💡" "Text to provide when code actions are available";
|
||||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
|
||||||
|
textUnavailable = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Text to provide when no actions are available
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
autocmd = {
|
||||||
|
enabled = helpers.defaultNullOpts.mkBool false "";
|
||||||
|
|
||||||
|
pattern = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["*"]'' "";
|
||||||
|
|
||||||
|
events =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
''["CursorHold" "CursorHoldI"]'' "";
|
''["CursorHold" "CursorHoldI"]'' "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
|
||||||
cfg = config.plugins.nvim-lightbulb;
|
cfg = config.plugins.nvim-lightbulb;
|
||||||
setupOptions = {
|
setupOptions = {
|
||||||
inherit (cfg) ignore sign autocmd;
|
inherit (cfg) ignore sign autocmd;
|
||||||
|
@ -82,10 +81,10 @@ with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require("nvim-lightbulb").setup(${helpers.toLuaObject setupOptions})
|
require("nvim-lightbulb").setup(${helpers.toLuaObject setupOptions})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# THIS FILE IS AUTOGENERATED DO NOT EDIT
|
# THIS FILE IS AUTOGENERATED DO NOT EDIT
|
||||||
lib: with lib; {
|
lib:
|
||||||
|
with lib; {
|
||||||
"assist" = {
|
"assist" = {
|
||||||
"expressionFillDefault" = mkOption {
|
"expressionFillDefault" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "todo" "default" ]);
|
type = types.nullOr (types.enum ["todo" "default"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Placeholder expression to use for missing expressions in assists.
|
Placeholder expression to use for missing expressions in assists.
|
||||||
|
@ -105,7 +106,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"features" = mkOption {
|
"features" = mkOption {
|
||||||
type = types.nullOr (types.oneOf [ (types.enum [ "all" ]) (types.listOf (types.str)) ]);
|
type = types.nullOr (types.oneOf [(types.enum ["all"]) (types.listOf (types.str))]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
List of features to activate.
|
List of features to activate.
|
||||||
|
@ -217,7 +218,7 @@ lib: with lib; {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"features" = mkOption {
|
"features" = mkOption {
|
||||||
type = types.nullOr (types.nullOr (types.oneOf [ (types.enum [ "all" ]) (types.listOf (types.str)) ]));
|
type = types.nullOr (types.nullOr (types.oneOf [(types.enum ["all"]) (types.listOf (types.str))]));
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
List of features to activate. Defaults to
|
List of features to activate. Defaults to
|
||||||
|
@ -320,7 +321,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
"callable" = {
|
"callable" = {
|
||||||
"snippets" = mkOption {
|
"snippets" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "fill_arguments" "add_parentheses" "none" ]);
|
type = types.nullOr (types.enum ["fill_arguments" "add_parentheses" "none"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to add parenthesis and argument snippets when completing function.
|
Whether to add parenthesis and argument snippets when completing function.
|
||||||
|
@ -508,7 +509,7 @@ lib: with lib; {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"watcher" = mkOption {
|
"watcher" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "client" "server" ]);
|
type = types.nullOr (types.enum ["client" "server"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Controls file watching implementation.
|
Controls file watching implementation.
|
||||||
|
@ -727,7 +728,7 @@ lib: with lib; {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"group" = mkOption {
|
"group" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "preserve" "crate" "module" "item" ]);
|
type = types.nullOr (types.enum ["preserve" "crate" "module" "item"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
How imports should be grouped into use statements.
|
How imports should be grouped into use statements.
|
||||||
|
@ -768,7 +769,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"prefix" = mkOption {
|
"prefix" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "plain" "self" "crate" ]);
|
type = types.nullOr (types.enum ["plain" "self" "crate"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
The path structure for newly inserted paths to use.
|
The path structure for newly inserted paths to use.
|
||||||
|
@ -838,7 +839,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
"closureReturnTypeHints" = {
|
"closureReturnTypeHints" = {
|
||||||
"enable" = mkOption {
|
"enable" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "always" "never" "with_block" ]);
|
type = types.nullOr (types.enum ["always" "never" "with_block"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to show inlay type hints for return types of closures.
|
Whether to show inlay type hints for return types of closures.
|
||||||
|
@ -852,7 +853,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
"lifetimeElisionHints" = {
|
"lifetimeElisionHints" = {
|
||||||
"enable" = mkOption {
|
"enable" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "always" "never" "skip_trivial" ]);
|
type = types.nullOr (types.enum ["always" "never" "skip_trivial"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to show inlay type hints for elided lifetimes in function signatures.
|
Whether to show inlay type hints for elided lifetimes in function signatures.
|
||||||
|
@ -905,7 +906,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
"reborrowHints" = {
|
"reborrowHints" = {
|
||||||
"enable" = mkOption {
|
"enable" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "always" "never" "mutable" ]);
|
type = types.nullOr (types.enum ["always" "never" "mutable"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to show inlay type hints for compiler inserted reborrows.
|
Whether to show inlay type hints for compiler inserted reborrows.
|
||||||
|
@ -1154,7 +1155,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"linkedProjects" = mkOption {
|
"linkedProjects" = mkOption {
|
||||||
type = types.nullOr (types.listOf (types.oneOf [ (types.str) (types.attrsOf types.anything) ]));
|
type = types.nullOr (types.listOf (types.oneOf [(types.str) (types.attrsOf types.anything)]));
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Disable project auto-discovery in favor of explicitly specified set
|
Disable project auto-discovery in favor of explicitly specified set
|
||||||
|
@ -1471,7 +1472,7 @@ lib: with lib; {
|
||||||
};
|
};
|
||||||
"signatureInfo" = {
|
"signatureInfo" = {
|
||||||
"detail" = mkOption {
|
"detail" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "full" "parameters" ]);
|
type = types.nullOr (types.enum ["full" "parameters"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Show full signature of the callable. Only shows parameters if disabled.
|
Show full signature of the callable. Only shows parameters if disabled.
|
||||||
|
@ -1517,7 +1518,7 @@ lib: with lib; {
|
||||||
"symbol" = {
|
"symbol" = {
|
||||||
"search" = {
|
"search" = {
|
||||||
"kind" = mkOption {
|
"kind" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "only_types" "all_symbols" ]);
|
type = types.nullOr (types.enum ["only_types" "all_symbols"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Workspace symbol search kind.
|
Workspace symbol search kind.
|
||||||
|
@ -1543,7 +1544,7 @@ lib: with lib; {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"scope" = mkOption {
|
"scope" = mkOption {
|
||||||
type = types.nullOr (types.enum [ "workspace" "workspace_and_dependencies" ]);
|
type = types.nullOr (types.enum ["workspace" "workspace_and_dependencies"]);
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Workspace symbol search scope.
|
Workspace symbol search scope.
|
||||||
|
|
|
@ -1,26 +1,30 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.plugins.trouble;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
# with helpers;
|
|
||||||
{
|
{
|
||||||
options.plugins.trouble = {
|
config,
|
||||||
enable = mkEnableOption "trouble.nvim";
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.plugins.trouble;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with lib;
|
||||||
|
# with helpers;
|
||||||
|
{
|
||||||
|
options.plugins.trouble = {
|
||||||
|
enable = mkEnableOption "trouble.nvim";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "trouble-nvim" pkgs.vimPlugins.trouble-nvim;
|
package = helpers.mkPackageOption "trouble-nvim" pkgs.vimPlugins.trouble-nvim;
|
||||||
|
|
||||||
position = helpers.mkNullOrOption (types.enum [ "top" "left" "right" "bottom" ]) "Position of the list";
|
position = helpers.mkNullOrOption (types.enum ["top" "left" "right" "bottom"]) "Position of the list";
|
||||||
height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom";
|
height = helpers.mkNullOrOption types.int "Height of the trouble list when position is top or bottom";
|
||||||
width = helpers.mkNullOrOption types.int "Width of the trouble list when position is left or right";
|
width = helpers.mkNullOrOption types.int "Width of the trouble list when position is left or right";
|
||||||
icons = helpers.mkNullOrOption types.bool "Use devicons for filenames";
|
icons = helpers.mkNullOrOption types.bool "Use devicons for filenames";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
nvim-web-devicons
|
nvim-web-devicons
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# This is for plugins not in nixpkgs
|
# This is for plugins not in nixpkgs
|
||||||
# e.g. intellitab.nvim
|
# e.g. intellitab.nvim
|
||||||
# Ideally, in the future, this would all be specified as a flake input!
|
# Ideally, in the future, this would all be specified as a flake input!
|
||||||
{ pkgs, ... }:
|
{pkgs, ...}: {
|
||||||
{
|
|
||||||
intellitab-nvim = pkgs.vimUtils.buildVimPlugin rec {
|
intellitab-nvim = pkgs.vimUtils.buildVimPlugin rec {
|
||||||
pname = "intellitab-nvim";
|
pname = "intellitab-nvim";
|
||||||
version = "a6c1a505865f6131866d609c52440306e9914b16";
|
version = "a6c1a505865f6131866d609c52440306e9914b16";
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
sha256 = "sha256-/m4Paw6AvDzTMWWCWpPnrdI4gsjIDSJPvGCMV7ufbEA=";
|
sha256 = "sha256-/m4Paw6AvDzTMWWCWpPnrdI4gsjIDSJPvGCMV7ufbEA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [ pkgs.python3Packages.pynvim ];
|
propagatedBuildInputs = [pkgs.python3Packages.pynvim];
|
||||||
})
|
})
|
||||||
(ps.buildPythonPackage rec {
|
(ps.buildPythonPackage rec {
|
||||||
pname = "std2";
|
pname = "std2";
|
||||||
|
@ -96,30 +95,29 @@
|
||||||
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
passthru.python3Dependencies = ps:
|
||||||
|
with ps; [
|
||||||
passthru.python3Dependencies = ps: with ps; [
|
pynvim
|
||||||
pynvim
|
jupyter-client
|
||||||
jupyter-client
|
ueberzug
|
||||||
ueberzug
|
pillow
|
||||||
pillow
|
cairosvg
|
||||||
cairosvg
|
plotly
|
||||||
plotly
|
ipykernel
|
||||||
ipykernel
|
pyperclip
|
||||||
pyperclip
|
(ps.buildPythonPackage rec {
|
||||||
(ps.buildPythonPackage rec {
|
pname = "pnglatex";
|
||||||
pname = "pnglatex";
|
version = "1.1";
|
||||||
version = "1.1";
|
src = fetchPypi {
|
||||||
src = fetchPypi {
|
inherit pname version;
|
||||||
inherit pname version;
|
hash = "sha256-CZUGDUkmttO0BzFYbGFSNMPkWzFC/BW4NmAeOwz4Y9M=";
|
||||||
hash = "sha256-CZUGDUkmttO0BzFYbGFSNMPkWzFC/BW4NmAeOwz4Y9M=";
|
};
|
||||||
};
|
doCheck = false;
|
||||||
doCheck = false;
|
meta = with lib; {
|
||||||
meta = with lib; {
|
homepage = "https://github.com/MaT1g3R/pnglatex";
|
||||||
homepage = "https://github.com/MaT1g3R/pnglatex";
|
description = "a small program that converts LaTeX snippets to png";
|
||||||
description = "a small program that converts LaTeX snippets to png";
|
};
|
||||||
};
|
})
|
||||||
})
|
];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.packer;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.packer;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.packer = {
|
plugins.packer = {
|
||||||
enable = mkEnableOption "packer.nvim";
|
enable = mkEnableOption "packer.nvim";
|
||||||
|
@ -13,67 +16,79 @@ in
|
||||||
type = types.listOf (types.oneOf [
|
type = types.listOf (types.oneOf [
|
||||||
types.str
|
types.str
|
||||||
(with types; let
|
(with types; let
|
||||||
mkOpt = type: desc: mkOption {
|
mkOpt = type: desc:
|
||||||
type = nullOr type;
|
mkOption {
|
||||||
default = null;
|
type = nullOr type;
|
||||||
description = desc;
|
default = null;
|
||||||
};
|
description = desc;
|
||||||
|
};
|
||||||
function = attrsOf str;
|
function = attrsOf str;
|
||||||
in
|
in
|
||||||
types.submodule {
|
types.submodule {
|
||||||
options = {
|
options = {
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "Name of the plugin to install";
|
description = "Name of the plugin to install";
|
||||||
};
|
};
|
||||||
|
|
||||||
disable = mkOpt bool "Mark plugin as inactive";
|
disable = mkOpt bool "Mark plugin as inactive";
|
||||||
as = mkOpt bool "Specifies an alias under which to install the plugin";
|
as = mkOpt bool "Specifies an alias under which to install the plugin";
|
||||||
installer = mkOpt function "A custom installer";
|
installer = mkOpt function "A custom installer";
|
||||||
updater = mkOpt function "A custom updater";
|
updater = mkOpt function "A custom updater";
|
||||||
after = mkOpt (oneOf [ str (listOf any) ]) "Plugins to load after this plugin";
|
after = mkOpt (oneOf [str (listOf any)]) "Plugins to load after this plugin";
|
||||||
rtp = mkOpt str "Specifies a subdirectory of the plugin to add to runtimepath";
|
rtp = mkOpt str "Specifies a subdirectory of the plugin to add to runtimepath";
|
||||||
opt = mkOpt str "Marks a plugin as optional";
|
opt = mkOpt str "Marks a plugin as optional";
|
||||||
branch = mkOpt str "Git branch to use";
|
branch = mkOpt str "Git branch to use";
|
||||||
tag = mkOpt str "Git tag to use";
|
tag = mkOpt str "Git tag to use";
|
||||||
commit = mkOpt str "Git commit to use";
|
commit = mkOpt str "Git commit to use";
|
||||||
lock = mkOpt bool "Skip this plugin in updates";
|
lock = mkOpt bool "Skip this plugin in updates";
|
||||||
run = mkOpt (oneOf [ str function ]) "Post-install hook";
|
run = mkOpt (oneOf [str function]) "Post-install hook";
|
||||||
requires = mkOpt (oneOf [ str (listOf any) ]) "Plugin dependencies";
|
requires = mkOpt (oneOf [str (listOf any)]) "Plugin dependencies";
|
||||||
rocks = mkOpt (oneOf [ str (listOf any) ]) "Luarocks dependencies";
|
rocks = mkOpt (oneOf [str (listOf any)]) "Luarocks dependencies";
|
||||||
config = mkOpt (oneOf [ str function ]) "Code to run after this plugin is loaded";
|
config = mkOpt (oneOf [str function]) "Code to run after this plugin is loaded";
|
||||||
setup = mkOpt (oneOf [ str function ]) "Code to be run before this plugin is loaded";
|
setup = mkOpt (oneOf [str function]) "Code to be run before this plugin is loaded";
|
||||||
cmd = mkOpt (oneOf [ str (listOf str) ]) "Commands which load this plugin";
|
cmd = mkOpt (oneOf [str (listOf str)]) "Commands which load this plugin";
|
||||||
ft = mkOpt (oneOf [ str (listOf str) ]) "Filetypes which load this plugin";
|
ft = mkOpt (oneOf [str (listOf str)]) "Filetypes which load this plugin";
|
||||||
keys = mkOpt (oneOf [ str (listOf str) ]) "Keymaps which load this plugin";
|
keys = mkOpt (oneOf [str (listOf str)]) "Keymaps which load this plugin";
|
||||||
event = mkOpt (oneOf [ str (listOf str) ]) "Autocommand events which load this plugin";
|
event = mkOpt (oneOf [str (listOf str)]) "Autocommand events which load this plugin";
|
||||||
fn = mkOpt (oneOf [ str (listOf str) ]) "Functions which load this plugin";
|
fn = mkOpt (oneOf [str (listOf str)]) "Functions which load this plugin";
|
||||||
cond = mkOpt (oneOf [ str function (listOf (oneOf [ str function ])) ]) "Conditional test to load this plugin";
|
cond = mkOpt (oneOf [str function (listOf (oneOf [str function]))]) "Conditional test to load this plugin";
|
||||||
module = mkOpt (oneOf [ str (listOf str) ]) "Patterns of module names which load this plugin";
|
module = mkOpt (oneOf [str (listOf str)]) "Patterns of module names which load this plugin";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
default = [ ];
|
default = [];
|
||||||
description = "List of plugins";
|
description = "List of plugins";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ (pkgs.vimPlugins.packer-nvim.overrideAttrs (_: { pname = "packer.nvim"; })) ];
|
extraPlugins = [(pkgs.vimPlugins.packer-nvim.overrideAttrs (_: {pname = "packer.nvim";}))];
|
||||||
extraPackages = [ pkgs.git ];
|
extraPackages = [pkgs.git];
|
||||||
|
|
||||||
extraConfigLua =
|
extraConfigLua = let
|
||||||
let
|
plugins =
|
||||||
plugins = map
|
map
|
||||||
(plugin:
|
(plugin:
|
||||||
if isAttrs plugin then
|
if isAttrs plugin
|
||||||
mapAttrs' (k: v: { name = if k == "name" then "@" else k; value = v; }) plugin
|
then
|
||||||
else plugin)
|
mapAttrs' (k: v: {
|
||||||
cfg.plugins;
|
name =
|
||||||
packedPlugins = if length plugins == 1 then head plugins else plugins;
|
if k == "name"
|
||||||
in
|
then "@"
|
||||||
mkIf (cfg.plugins != [ ]) ''
|
else k;
|
||||||
|
value = v;
|
||||||
|
})
|
||||||
|
plugin
|
||||||
|
else plugin)
|
||||||
|
cfg.plugins;
|
||||||
|
packedPlugins =
|
||||||
|
if length plugins == 1
|
||||||
|
then head plugins
|
||||||
|
else plugins;
|
||||||
|
in
|
||||||
|
mkIf (cfg.plugins != []) ''
|
||||||
require('packer').startup(function()
|
require('packer').startup(function()
|
||||||
use ${helpers.toLuaObject packedPlugins}
|
use ${helpers.toLuaObject packedPlugins}
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.luasnip;
|
|
||||||
helpers = import ../../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.luasnip;
|
||||||
|
helpers = import ../../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.luasnip = {
|
options.plugins.luasnip = {
|
||||||
enable = mkEnableOption "Enable luasnip";
|
enable = mkEnableOption "Enable luasnip";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "luasnip" pkgs.vimPlugins.luasnip;
|
package = helpers.mkPackageOption "luasnip" pkgs.vimPlugins.luasnip;
|
||||||
|
|
||||||
fromVscode = mkOption {
|
fromVscode = mkOption {
|
||||||
default = [ ];
|
default = [];
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
{}
|
{}
|
||||||
|
@ -38,18 +41,19 @@ in
|
||||||
# TODO: add option to also include the default runtimepath
|
# TODO: add option to also include the default runtimepath
|
||||||
paths = mkOption {
|
paths = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = with types; nullOr (oneOf
|
type = with types;
|
||||||
[
|
nullOr (oneOf
|
||||||
str
|
[
|
||||||
path
|
str
|
||||||
helpers.rawType
|
path
|
||||||
(listOf (oneOf
|
helpers.rawType
|
||||||
[
|
(listOf (oneOf
|
||||||
str
|
[
|
||||||
path
|
str
|
||||||
helpers.rawType
|
path
|
||||||
]))
|
helpers.rawType
|
||||||
]);
|
]))
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
exclude = mkOption {
|
exclude = mkOption {
|
||||||
|
@ -75,21 +79,18 @@ in
|
||||||
# TODO: add support for lua
|
# TODO: add support for lua
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
fromVscodeLoaders =
|
||||||
|
lists.map
|
||||||
fromVscodeLoaders = lists.map
|
(loader: let
|
||||||
(loader:
|
options = attrsets.getAttrs ["paths" "exclude" "include"] loader;
|
||||||
let
|
in ''
|
||||||
options = attrsets.getAttrs [ "paths" "exclude" "include" ] loader;
|
require("luasnip.loaders.from_vscode").${optionalString loader.lazyLoad "lazy_"}load(${helpers.toLuaObject options})
|
||||||
in
|
'')
|
||||||
''
|
cfg.fromVscode;
|
||||||
require("luasnip.loaders.from_vscode").${optionalString loader.lazyLoad "lazy_"}load(${helpers.toLuaObject options})
|
in
|
||||||
'')
|
|
||||||
cfg.fromVscode;
|
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua = concatStringsSep "\n" fromVscodeLoaders;
|
extraConfigLua = concatStringsSep "\n" fromVscodeLoaders;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.airline;
|
cfg = config.plugins.airline;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
|
||||||
sectionType = with types; nullOr (oneOf [ str (listOf str) ]);
|
sectionType = with types; nullOr (oneOf [str (listOf str)]);
|
||||||
sectionOption = mkOption {
|
sectionOption = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = sectionType;
|
type = sectionType;
|
||||||
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
plugins.airline = {
|
plugins.airline = {
|
||||||
enable = mkEnableOption "airline";
|
enable = mkEnableOption "airline";
|
||||||
|
@ -33,16 +36,17 @@ in
|
||||||
sections = mkOption {
|
sections = mkOption {
|
||||||
description = "Statusbar sections";
|
description = "Statusbar sections";
|
||||||
default = null;
|
default = null;
|
||||||
type = with types; nullOr (submodule {
|
type = with types;
|
||||||
options = {
|
nullOr (submodule {
|
||||||
a = sectionOption;
|
options = {
|
||||||
b = sectionOption;
|
a = sectionOption;
|
||||||
c = sectionOption;
|
b = sectionOption;
|
||||||
x = sectionOption;
|
c = sectionOption;
|
||||||
y = sectionOption;
|
x = sectionOption;
|
||||||
z = sectionOption;
|
y = sectionOption;
|
||||||
};
|
z = sectionOption;
|
||||||
});
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
powerline = mkOption {
|
powerline = mkOption {
|
||||||
|
@ -59,21 +63,24 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
sections = {};
|
||||||
sections = { };
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins;
|
||||||
cfg.package
|
[
|
||||||
] ++ optional (!isNull cfg.theme) vim-airline-themes;
|
cfg.package
|
||||||
globals = {
|
]
|
||||||
airline.extensions = cfg.extensions;
|
++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||||
|
globals =
|
||||||
|
{
|
||||||
|
airline.extensions = cfg.extensions;
|
||||||
|
|
||||||
airline_statusline_ontop = mkIf cfg.onTop 1;
|
airline_statusline_ontop = mkIf cfg.onTop 1;
|
||||||
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
||||||
|
|
||||||
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||||
} // sections;
|
}
|
||||||
|
// sections;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.lightline;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.lightline;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.lightline = {
|
plugins.lightline = {
|
||||||
enable = mkEnableOption "lightline";
|
enable = mkEnableOption "lightline";
|
||||||
|
@ -51,23 +54,21 @@ in
|
||||||
active = mkOption {
|
active = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.submodule {
|
type = types.nullOr (types.submodule {
|
||||||
options =
|
options = let
|
||||||
let
|
listType = with types; nullOr (listOf (listOf str));
|
||||||
listType = with types; nullOr (listOf (listOf str));
|
in {
|
||||||
in
|
left = mkOption {
|
||||||
{
|
type = listType;
|
||||||
left = mkOption {
|
description = "List of components that will show up on the left side of the bar";
|
||||||
type = listType;
|
default = null;
|
||||||
description = "List of components that will show up on the left side of the bar";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
right = mkOption {
|
|
||||||
type = listType;
|
|
||||||
description = "List of components that will show up on the right side of the bar";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
right = mkOption {
|
||||||
|
type = listType;
|
||||||
|
description = "List of components that will show up on the right side of the bar";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,14 +80,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
configAttrs = filterAttrs (_: v: v != null) {
|
||||||
configAttrs = filterAttrs (_: v: v != null) {
|
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
globals.lightline = mkIf (configAttrs != { }) configAttrs;
|
globals.lightline = mkIf (configAttrs != {}) configAttrs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.lualine;
|
cfg = config.plugins.lualine;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
separators = mkOption {
|
separators = mkOption {
|
||||||
type = types.nullOr (types.submodule {
|
type = types.nullOr (types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -32,7 +36,7 @@ let
|
||||||
default = defaultName;
|
default = defaultName;
|
||||||
};
|
};
|
||||||
icons_enabled = mkOption {
|
icons_enabled = mkOption {
|
||||||
type = types.enum [ "True" "False" ];
|
type = types.enum ["True" "False"];
|
||||||
default = "True";
|
default = "True";
|
||||||
description = "displays icons in alongside component";
|
description = "displays icons in alongside component";
|
||||||
};
|
};
|
||||||
|
@ -44,7 +48,7 @@ let
|
||||||
separator = separators;
|
separator = separators;
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = { };
|
default = {};
|
||||||
description = "extra options for the component";
|
description = "extra options for the component";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -52,8 +56,7 @@ let
|
||||||
]));
|
]));
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
plugins.lualine = {
|
plugins.lualine = {
|
||||||
enable = mkEnableOption "lualine";
|
enable = mkEnableOption "lualine";
|
||||||
|
@ -79,12 +82,11 @@ in
|
||||||
alwaysDivideMiddle = mkOption {
|
alwaysDivideMiddle = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = null;
|
default = null;
|
||||||
description =
|
description = "When true, left_sections (a,b,c) can't take over entire statusline";
|
||||||
"When true, left_sections (a,b,c) can't take over entire statusline";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sections = mkOption {
|
sections = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
lualine_a = component_options "mode";
|
lualine_a = component_options "mode";
|
||||||
lualine_b = component_options "branch";
|
lualine_b = component_options "branch";
|
||||||
|
@ -100,7 +102,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
tabline = mkOption {
|
tabline = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
lualine_a = component_options "";
|
lualine_a = component_options "";
|
||||||
lualine_b = component_options "";
|
lualine_b = component_options "";
|
||||||
|
@ -121,34 +123,45 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config =
|
config = let
|
||||||
let
|
processComponent = x:
|
||||||
processComponent = x: (if isAttrs x then processTableComponent else id) x;
|
(
|
||||||
processTableComponent = { name, icons_enabled, icon, separator, extraConfig }: mergeAttrs
|
if isAttrs x
|
||||||
{
|
then processTableComponent
|
||||||
"@" = name;
|
else id
|
||||||
inherit icons_enabled icon separator;
|
)
|
||||||
}
|
x;
|
||||||
extraConfig;
|
processTableComponent = {
|
||||||
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
|
name,
|
||||||
setupOptions = {
|
icons_enabled,
|
||||||
options = {
|
icon,
|
||||||
theme = cfg.theme;
|
separator,
|
||||||
section_separators = cfg.sectionSeparators;
|
extraConfig,
|
||||||
component_separators = cfg.componentSeparators;
|
}:
|
||||||
disabled_filetypes = cfg.disabledFiletypes;
|
mergeAttrs
|
||||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
{
|
||||||
};
|
"@" = name;
|
||||||
|
inherit icons_enabled icon separator;
|
||||||
sections = mapNullable processSections cfg.sections;
|
}
|
||||||
tabline = mapNullable processSections cfg.tabline;
|
extraConfig;
|
||||||
extensions = cfg.extensions;
|
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
|
||||||
|
setupOptions = {
|
||||||
|
options = {
|
||||||
|
theme = cfg.theme;
|
||||||
|
section_separators = cfg.sectionSeparators;
|
||||||
|
component_separators = cfg.componentSeparators;
|
||||||
|
disabled_filetypes = cfg.disabledFiletypes;
|
||||||
|
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||||
};
|
};
|
||||||
in
|
|
||||||
|
sections = mapNullable processSections cfg.sections;
|
||||||
|
tabline = mapNullable processSections cfg.tabline;
|
||||||
|
extensions = cfg.extensions;
|
||||||
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraPackages = [ pkgs.git ];
|
extraPackages = [pkgs.git];
|
||||||
extraConfigLua =
|
extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||||
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{ pkgs
|
|
||||||
, config
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./frecency.nix
|
./frecency.nix
|
||||||
./fzf-native.nix
|
./fzf-native.nix
|
||||||
|
@ -33,13 +32,13 @@ in
|
||||||
enabledExtensions = mkOption {
|
enabledExtensions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
description = "A list of enabled extensions. Don't use this directly";
|
description = "A list of enabled extensions. Don't use this directly";
|
||||||
default = [ ];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
extensionConfig = mkOption {
|
extensionConfig = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
description = "Configuration for the extensions. Don't use this directly";
|
description = "Configuration for the extensions. Don't use this directly";
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaults = mkOption {
|
defaults = mkOption {
|
||||||
|
@ -50,13 +49,13 @@ in
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = { };
|
default = {};
|
||||||
description = "An attribute set, that lets you set extra options or override options set by nixvim";
|
description = "An attribute set, that lets you set extra options or override options set by nixvim";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPackages = [ pkgs.bat ];
|
extraPackages = [pkgs.bat];
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
|
@ -68,23 +67,23 @@ in
|
||||||
let $BAT_THEME = '${cfg.highlightTheme}'
|
let $BAT_THEME = '${cfg.highlightTheme}'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extraConfigLua =
|
extraConfigLua = let
|
||||||
let
|
options =
|
||||||
options = {
|
{
|
||||||
extensions = cfg.extensionConfig;
|
extensions = cfg.extensionConfig;
|
||||||
defaults = cfg.defaults;
|
defaults = cfg.defaults;
|
||||||
} // cfg.extraOptions;
|
}
|
||||||
in
|
// cfg.extraOptions;
|
||||||
''
|
in ''
|
||||||
do
|
do
|
||||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||||
|
|
||||||
require('telescope').setup(${helpers.toLuaObject options})
|
require('telescope').setup(${helpers.toLuaObject options})
|
||||||
|
|
||||||
for i, extension in ipairs(__telescopeExtensions) do
|
for i, extension in ipairs(__telescopeExtensions) do
|
||||||
require('telescope').load_extension(extension)
|
require('telescope').load_extension(extension)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
'';
|
end
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope.extensions.frecency;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope.extensions.frecency;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.telescope.extensions.frecency = {
|
options.plugins.telescope.extensions.frecency = {
|
||||||
enable = mkEnableOption "frecency";
|
enable = mkEnableOption "frecency";
|
||||||
|
|
||||||
|
@ -47,26 +50,25 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
configuration = {
|
||||||
configuration = {
|
db_root = cfg.dbRoot;
|
||||||
db_root = cfg.dbRoot;
|
default_workspace = cfg.defaultWorkspace;
|
||||||
default_workspace = cfg.defaultWorkspace;
|
ignore_patterns = cfg.ignorePatterns;
|
||||||
ignore_patterns = cfg.ignorePatterns;
|
show_scores = cfg.showScores;
|
||||||
show_scores = cfg.showScores;
|
workspaces = cfg.workspaces;
|
||||||
workspaces = cfg.workspaces;
|
show_unindexed = cfg.showUnindexed;
|
||||||
show_unindexed = cfg.showUnindexed;
|
devicons_disabled = cfg.deviconsDisabled;
|
||||||
devicons_disabled = cfg.deviconsDisabled;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPackages = [ pkgs.sqlite ];
|
extraPackages = [pkgs.sqlite];
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
sqlite-lua
|
sqlite-lua
|
||||||
];
|
];
|
||||||
|
|
||||||
plugins.telescope.enabledExtensions = [ "frecency" ];
|
plugins.telescope.enabledExtensions = ["frecency"];
|
||||||
plugins.telescope.extensionConfig."frecency" = configuration;
|
plugins.telescope.extensionConfig."frecency" = configuration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope.extensions.fzf-native;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope.extensions.fzf-native;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.telescope.extensions.fzf-native = {
|
options.plugins.telescope.extensions.fzf-native = {
|
||||||
enable = mkEnableOption "Enable fzf-native";
|
enable = mkEnableOption "Enable fzf-native";
|
||||||
|
|
||||||
|
@ -26,7 +29,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
caseMode = mkOption {
|
caseMode = mkOption {
|
||||||
type = types.nullOr (types.enum [ "smart_case" "ignore_case" "respect_case" ]);
|
type = types.nullOr (types.enum ["smart_case" "ignore_case" "respect_case"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -38,10 +41,11 @@ in
|
||||||
override_file_sorter = cfg.overrideFileSorter;
|
override_file_sorter = cfg.overrideFileSorter;
|
||||||
case_mode = cfg.caseMode;
|
case_mode = cfg.caseMode;
|
||||||
};
|
};
|
||||||
in mkIf cfg.enable {
|
in
|
||||||
extraPlugins = [ cfg.package ];
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
plugins.telescope.enabledExtensions = [ "fzf" ];
|
plugins.telescope.enabledExtensions = ["fzf"];
|
||||||
plugins.telescope.extensionConfig."fzf" = configuration;
|
plugins.telescope.extensionConfig."fzf" = configuration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
{ pkgs, config, lib, ...}:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope.extensions.fzy-native;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope.extensions.fzy-native;
|
||||||
|
in {
|
||||||
options.plugins.telescope.extensions.fzy-native = {
|
options.plugins.telescope.extensions.fzy-native = {
|
||||||
enable = mkEnableOption "Enable fzy-native";
|
enable = mkEnableOption "Enable fzy-native";
|
||||||
|
|
||||||
|
@ -24,10 +27,11 @@ in
|
||||||
override_generic_sorter = cfg.overrideGenericSorter;
|
override_generic_sorter = cfg.overrideGenericSorter;
|
||||||
override_file_sorter = cfg.overrideFileSorter;
|
override_file_sorter = cfg.overrideFileSorter;
|
||||||
};
|
};
|
||||||
in mkIf cfg.enable {
|
in
|
||||||
extraPlugins = [ pkgs.vimPlugins.telescope-fzy-native-nvim ];
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [pkgs.vimPlugins.telescope-fzy-native-nvim];
|
||||||
|
|
||||||
plugins.telescope.enabledExtensions = [ "fzy_native" ];
|
plugins.telescope.enabledExtensions = ["fzy_native"];
|
||||||
plugins.telescope.extensionConfig."fzy_native" = configuration;
|
plugins.telescope.extensionConfig."fzy_native" = configuration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope.extensions.media_files;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope.extensions.media_files;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.telescope.extensions.media_files = {
|
options.plugins.telescope.extensions.media_files = {
|
||||||
enable = mkEnableOption "Enable media_files extension for telescope";
|
enable = mkEnableOption "Enable media_files extension for telescope";
|
||||||
|
|
||||||
|
@ -23,7 +26,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
plugins.telescope.enabledExtensions = [ "media_files" ];
|
plugins.telescope.enabledExtensions = ["media_files"];
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
popup-nvim
|
popup-nvim
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.telescope.extensions.project-nvim;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||||
|
in {
|
||||||
options.plugins.telescope.extensions.project-nvim = {
|
options.plugins.telescope.extensions.project-nvim = {
|
||||||
enable = mkEnableOption "project-nvim telescope extension";
|
enable = mkEnableOption "project-nvim telescope extension";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
plugins.telescope.enabledExtensions = [ "projects" ];
|
plugins.telescope.enabledExtensions = ["projects"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.comment-nvim;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.comment-nvim;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.comment-nvim = {
|
plugins.comment-nvim = {
|
||||||
enable = mkEnableOption "Enable comment-nvim";
|
enable = mkEnableOption "Enable comment-nvim";
|
||||||
|
@ -27,7 +30,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
toggler = mkOption {
|
toggler = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
line = mkOption {
|
line = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -45,7 +48,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
opleader = mkOption {
|
opleader = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
line = mkOption {
|
line = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -63,7 +66,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
mappings = mkOption {
|
mappings = mkOption {
|
||||||
type = types.nullOr (types.submodule ({ ... }: {
|
type = types.nullOr (types.submodule ({...}: {
|
||||||
options = {
|
options = {
|
||||||
basic = mkOption {
|
basic = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@ -88,20 +91,18 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
setupOptions = {
|
||||||
setupOptions = {
|
padding = cfg.padding;
|
||||||
padding = cfg.padding;
|
sticky = cfg.sticky;
|
||||||
sticky = cfg.sticky;
|
ignore = cfg.ignore;
|
||||||
ignore = cfg.ignore;
|
toggler = cfg.toggler;
|
||||||
toggler = cfg.toggler;
|
opleader = cfg.opleader;
|
||||||
opleader = cfg.opleader;
|
mappings = cfg.mappings;
|
||||||
mappings = cfg.mappings;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua =
|
extraConfigLua = ''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
||||||
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.commentary;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.commentary;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
# TODO Add support for aditional filetypes. This requires autocommands!
|
# TODO Add support for aditional filetypes. This requires autocommands!
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -16,6 +19,6 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
with lib;
|
config,
|
||||||
let
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.dashboard;
|
cfg = config.plugins.dashboard;
|
||||||
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
plugins.dashboard = {
|
plugins.dashboard = {
|
||||||
enable = mkEnableOption "dashboard";
|
enable = mkEnableOption "dashboard";
|
||||||
|
@ -90,7 +93,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
hideStatusline = mkOption {
|
hideStatusline = mkOption {
|
||||||
|
@ -107,34 +110,32 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
options = {
|
||||||
options = {
|
custom_header = cfg.header;
|
||||||
custom_header = cfg.header;
|
custom_footer = cfg.footer;
|
||||||
custom_footer = cfg.footer;
|
custom_center = cfg.center;
|
||||||
custom_center = cfg.center;
|
|
||||||
|
|
||||||
preview_file_path = cfg.preview.file;
|
preview_file_path = cfg.preview.file;
|
||||||
preview_file_height = cfg.preview.height;
|
preview_file_height = cfg.preview.height;
|
||||||
preview_file_width = cfg.preview.width;
|
preview_file_width = cfg.preview.width;
|
||||||
preview_command = cfg.preview.command;
|
preview_command = cfg.preview.command;
|
||||||
|
|
||||||
hide_statusline = cfg.hideStatusline;
|
hide_statusline = cfg.hideStatusline;
|
||||||
hide_tabline = cfg.hideTabline;
|
hide_tabline = cfg.hideTabline;
|
||||||
|
|
||||||
session_directory = cfg.sessionDirectory;
|
session_directory = cfg.sessionDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
filteredOptions = filterAttrs (_: v: !isNull v) options;
|
filteredOptions = filterAttrs (_: v: !isNull v) options;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
local dashboard = require("dashboard")
|
local dashboard = require("dashboard")
|
||||||
|
|
||||||
${toString (mapAttrsToList (n: v:
|
${toString (mapAttrsToList (n: v: "dashboard.${n} = ${helpers.toLuaObject v}\n")
|
||||||
"dashboard.${n} = ${helpers.toLuaObject v}\n")
|
filteredOptions)}
|
||||||
filteredOptions)}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.easyescape;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.easyescape;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.easyescape = {
|
plugins.easyescape = {
|
||||||
enable = mkEnableOption "Enable easyescape";
|
enable = mkEnableOption "Enable easyescape";
|
||||||
|
|
|
@ -1,34 +1,39 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
with lib;
|
lib,
|
||||||
let
|
pkgs,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
...
|
||||||
|
} @ attrs:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
|
||||||
eitherAttrsStrInt = with types; let
|
eitherAttrsStrInt = with types; let
|
||||||
strInt = either str int;
|
strInt = either str int;
|
||||||
in either strInt (attrsOf (either strInt (attrsOf strInt)));
|
in
|
||||||
in with helpers;
|
either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||||
mkPlugin attrs {
|
in
|
||||||
name = "emmet";
|
with helpers;
|
||||||
description = "Enable emmet";
|
mkPlugin attrs {
|
||||||
package = pkgs.vimPlugins.emmet-vim;
|
name = "emmet";
|
||||||
|
description = "Enable emmet";
|
||||||
|
package = pkgs.vimPlugins.emmet-vim;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
mode = mkDefaultOpt {
|
mode = mkDefaultOpt {
|
||||||
type = types.enum [ "i" "n" "v" "a" ];
|
type = types.enum ["i" "n" "v" "a"];
|
||||||
global = "user_emmet_mode";
|
global = "user_emmet_mode";
|
||||||
description = "Mode where emmet will enable";
|
description = "Mode where emmet will enable";
|
||||||
};
|
};
|
||||||
|
|
||||||
leader = mkDefaultOpt {
|
leader = mkDefaultOpt {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
global = "user_emmet_leader_key";
|
global = "user_emmet_leader_key";
|
||||||
description = "Set leader key";
|
description = "Set leader key";
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkDefaultOpt {
|
settings = mkDefaultOpt {
|
||||||
type = types.attrsOf (types.attrsOf eitherAttrsStrInt);
|
type = types.attrsOf (types.attrsOf eitherAttrsStrInt);
|
||||||
global = "user_emmet_settings";
|
global = "user_emmet_settings";
|
||||||
description = "Emmet settings";
|
description = "Emmet settings";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "endwise";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable vim-endwise";
|
in
|
||||||
package = pkgs.vimPlugins.vim-endwise;
|
with helpers;
|
||||||
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "endwise";
|
||||||
|
description = "Enable vim-endwise";
|
||||||
|
package = pkgs.vimPlugins.vim-endwise;
|
||||||
|
|
||||||
# Yes it's really not configurable
|
# Yes it's really not configurable
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.floaterm;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.floaterm;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.floaterm = {
|
plugins.floaterm = {
|
||||||
enable = mkEnableOption "floaterm";
|
enable = mkEnableOption "floaterm";
|
||||||
|
@ -21,7 +24,7 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
winType = mkOption {
|
winType = mkOption {
|
||||||
type = types.nullOr (types.enum [ "float" "split" "vsplit" ]);
|
type = types.nullOr (types.enum ["float" "split" "vsplit"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
winWidth = mkOption {
|
winWidth = mkOption {
|
||||||
|
@ -45,17 +48,17 @@ in
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
opener = mkOption {
|
opener = mkOption {
|
||||||
type = types.nullOr (types.enum [ "edit" "split" "vsplit" "tabe" "drop" ]);
|
type = types.nullOr (types.enum ["edit" "split" "vsplit" "tabe" "drop"]);
|
||||||
description = "Command used for opening a file in the outside nvim from within :terminal";
|
description = "Command used for opening a file in the outside nvim from within :terminal";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
autoClose = mkOption {
|
autoClose = mkOption {
|
||||||
type = types.nullOr (types.enum [ 0 1 2 ]);
|
type = types.nullOr (types.enum [0 1 2]);
|
||||||
description = "Whether to close floaterm window once the job gets finished.";
|
description = "Whether to close floaterm window once the job gets finished.";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
autoHide = mkOption {
|
autoHide = mkOption {
|
||||||
type = types.nullOr (types.enum [ 0 1 2 ]);
|
type = types.nullOr (types.enum [0 1 2]);
|
||||||
description = "Whether to hide previous floaterm before switching to or opening another one.";
|
description = "Whether to hide previous floaterm before switching to or opening another one.";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,29 +1,34 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "goyo";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable goyo.vim";
|
in
|
||||||
package = pkgs.vimPlugins.goyo-vim;
|
with helpers;
|
||||||
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "goyo";
|
||||||
|
description = "Enable goyo.vim";
|
||||||
|
package = pkgs.vimPlugins.goyo-vim;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
width = mkDefaultOpt {
|
width = mkDefaultOpt {
|
||||||
description = "Width";
|
description = "Width";
|
||||||
global = "goyo_width";
|
global = "goyo_width";
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
height = mkDefaultOpt {
|
height = mkDefaultOpt {
|
||||||
description = "Height";
|
description = "Height";
|
||||||
global = "goyo_height";
|
global = "goyo_height";
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
showLineNumbers = mkDefaultOpt {
|
showLineNumbers = mkDefaultOpt {
|
||||||
description = "Show line numbers when in Goyo mode";
|
description = "Show line numbers when in Goyo mode";
|
||||||
global = "goyo_linenr";
|
global = "goyo_linenr";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.harpoon;
|
cfg = config.plugins.harpoon;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
|
||||||
projectConfigModule = types.submodule {
|
projectConfigModule = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -15,8 +19,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.plugins.harpoon = {
|
options.plugins.harpoon = {
|
||||||
enable = mkEnableOption "harpoon";
|
enable = mkEnableOption "harpoon";
|
||||||
|
|
||||||
|
@ -47,7 +50,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
projects = mkOption {
|
projects = mkOption {
|
||||||
default = { };
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Predefined projetcs. The keys of this attrs should be the path to the project.
|
Predefined projetcs. The keys of this attrs should be the path to the project.
|
||||||
$HOME is working.
|
$HOME is working.
|
||||||
|
@ -73,50 +76,48 @@ in
|
||||||
Menu window height
|
Menu window height
|
||||||
'';
|
'';
|
||||||
|
|
||||||
borderChars = helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
borderChars =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
"[ \"─\" \"│\" \"─\" \"│\" \"╭\" \"╮\" \"╯\" \"╰\" ]"
|
"[ \"─\" \"│\" \"─\" \"│\" \"╭\" \"╮\" \"╯\" \"╰\" ]"
|
||||||
"Border characters"
|
"Border characters";
|
||||||
;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
projects =
|
||||||
projects = builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(
|
(
|
||||||
name: value: {
|
name: value: {
|
||||||
term.cmds = value.termCommands;
|
term.cmds = value.termCommands;
|
||||||
mark.marks = map (mark: { filename = mark; }) value.marks;
|
mark.marks = map (mark: {filename = mark;}) value.marks;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
cfg.projects;
|
cfg.projects;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
global_settings = {
|
global_settings = {
|
||||||
save_on_toggle = cfg.saveOnToggle;
|
save_on_toggle = cfg.saveOnToggle;
|
||||||
save_on_change = cfg.saveOnChange;
|
save_on_change = cfg.saveOnChange;
|
||||||
enter_on_sendcmd = cfg.enterOnSendcmd;
|
enter_on_sendcmd = cfg.enterOnSendcmd;
|
||||||
tmux_autoclose_windows = cfg.tmuxAutocloseWindows;
|
tmux_autoclose_windows = cfg.tmuxAutocloseWindows;
|
||||||
excluded_filetypes = cfg.excludedFiletypes;
|
excluded_filetypes = cfg.excludedFiletypes;
|
||||||
mark_branch = cfg.markBranch;
|
mark_branch = cfg.markBranch;
|
||||||
};
|
|
||||||
|
|
||||||
projects = projects;
|
|
||||||
|
|
||||||
menu = {
|
|
||||||
width = cfg.menu.width;
|
|
||||||
height = cfg.menu.height;
|
|
||||||
borderchars = cfg.menu.borderChars;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
|
||||||
|
projects = projects;
|
||||||
|
|
||||||
|
menu = {
|
||||||
|
width = cfg.menu.width;
|
||||||
|
height = cfg.menu.height;
|
||||||
|
borderchars = cfg.menu.borderChars;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('harpoon').setup(${helpers.toLuaObject options})
|
require('harpoon').setup(${helpers.toLuaObject options})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{ lib
|
{
|
||||||
, pkgs
|
lib,
|
||||||
, config
|
pkgs,
|
||||||
, ...
|
config,
|
||||||
|
...
|
||||||
} @ args:
|
} @ args:
|
||||||
with lib; let
|
with lib; let
|
||||||
helpers = import ../helpers.nix args;
|
helpers = import ../helpers.nix args;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.plugins.indent-blankline = {
|
options.plugins.indent-blankline = {
|
||||||
enable = mkEnableOption "indent-blankline.nvim";
|
enable = mkEnableOption "indent-blankline.nvim";
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ in
|
||||||
|
|
||||||
useTreesitter =
|
useTreesitter =
|
||||||
helpers.defaultNullOpts.mkBool false
|
helpers.defaultNullOpts.mkBool false
|
||||||
"Use treesitter to calculate indentation when possible.";
|
"Use treesitter to calculate indentation when possible.";
|
||||||
|
|
||||||
indentLevel = helpers.defaultNullOpts.mkInt 10 "Specifies the maximum indent level to display.";
|
indentLevel = helpers.defaultNullOpts.mkInt 10 "Specifies the maximum indent level to display.";
|
||||||
|
|
||||||
|
@ -107,14 +107,14 @@ in
|
||||||
|
|
||||||
filetypeExclude =
|
filetypeExclude =
|
||||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
''["lspinfo" "packer" "checkhealth" "help" "man" ""]'' ''
|
''["lspinfo" "packer" "checkhealth" "help" "man" ""]'' ''
|
||||||
Specifies a list of |filetype| values for which this plugin is not enabled.
|
Specifies a list of |filetype| values for which this plugin is not enabled.
|
||||||
Ignored if the value is an empty list.
|
Ignored if the value is an empty list.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buftypeExclude =
|
buftypeExclude =
|
||||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
''["terminal" "nofile" "quickfix" "prompt"]'' ''
|
''["terminal" "nofile" "quickfix" "prompt"]'' ''
|
||||||
Specifies a list of |buftype| values for which this plugin is not enabled.
|
Specifies a list of |buftype| values for which this plugin is not enabled.
|
||||||
Ignored if the value is an empty list.
|
Ignored if the value is an empty list.
|
||||||
'';
|
'';
|
||||||
|
@ -197,7 +197,7 @@ in
|
||||||
|
|
||||||
contextStartPriority =
|
contextStartPriority =
|
||||||
helpers.defaultNullOpts.mkInt 10000
|
helpers.defaultNullOpts.mkInt 10000
|
||||||
"Specifies the |extmarks| priority for the context start.";
|
"Specifies the |extmarks| priority for the context start.";
|
||||||
|
|
||||||
contextPatterns = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''
|
contextPatterns = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''
|
||||||
[
|
[
|
||||||
|
@ -248,12 +248,11 @@ in
|
||||||
helpers.defaultNullOpts.mkBool false "Turns deprecation warning messages off.";
|
helpers.defaultNullOpts.mkBool false "Turns deprecation warning messages off.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.plugins.indent-blankline;
|
||||||
cfg = config.plugins.indent-blankline;
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
indent_blankline_char = cfg.char;
|
indent_blankline_char = cfg.char;
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.intellitab;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
defs = import ../plugin-defs.nix { inherit pkgs; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.intellitab;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
defs = import ../plugin-defs.nix {inherit pkgs;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.intellitab = {
|
plugins.intellitab = {
|
||||||
enable = mkEnableOption "intellitab.nvim";
|
enable = mkEnableOption "intellitab.nvim";
|
||||||
|
@ -15,7 +18,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
|
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
|
||||||
plugins.treesitter = {
|
plugins.treesitter = {
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.magma-nvim;
|
cfg = config.plugins.magma-nvim;
|
||||||
plugins = import ../plugin-defs.nix { inherit pkgs; };
|
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
||||||
package = pkgs.fetchFromGitHub {
|
package = pkgs.fetchFromGitHub {
|
||||||
owner = "dccsillag";
|
owner = "dccsillag";
|
||||||
repo = "magma-nvim";
|
repo = "magma-nvim";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.magma-nvim = {
|
plugins.magma-nvim = {
|
||||||
enable = mkEnableOption "Enable magma-nvim?";
|
enable = mkEnableOption "Enable magma-nvim?";
|
||||||
image_provider = mkOption {
|
image_provider = mkOption {
|
||||||
type = types.enum [ "none" "ueberzug" "kitty" ];
|
type = types.enum ["none" "ueberzug" "kitty"];
|
||||||
default = "none";
|
default = "none";
|
||||||
example = "ueberzug";
|
example = "ueberzug";
|
||||||
description =
|
description = " This configures how to display images. The following options are available:
|
||||||
" This configures how to display images. The following options are available:
|
|
||||||
none -- don't show imagesmagma_image_provider.
|
none -- don't show imagesmagma_image_provider.
|
||||||
ueberzug -- use Ueberzug to display images.
|
ueberzug -- use Ueberzug to display images.
|
||||||
kitty -- use the Kitty protocol to display images.";
|
kitty -- use the Kitty protocol to display images.";
|
||||||
|
@ -27,8 +30,7 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
description =
|
description = " If this is true, then whenever you have an active cell its output window will be automatically shown.
|
||||||
" If this is true, then whenever you have an active cell its output window will be automatically shown.
|
|
||||||
If this is false, then the output window will only be automatically shown when you've just evaluated the code. So, if you take your cursor out of the cell, and then come back, the output window won't be opened (but the cell will be highlighted). This means that there will be nothing covering your code. You can then open the output window at will using :MagmaShowOutput.";
|
If this is false, then the output window will only be automatically shown when you've just evaluated the code. So, if you take your cursor out of the cell, and then come back, the output window won't be opened (but the cell will be highlighted). This means that there will be nothing covering your code. You can then open the output window at will using :MagmaShowOutput.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,60 +38,54 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
description =
|
description = " If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
||||||
" If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
output_window_borders = mkOption {
|
output_window_borders = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
description =
|
description = " If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
||||||
" If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cell_highlight_group = mkOption {
|
cell_highlight_group = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "CursorLine";
|
default = "CursorLine";
|
||||||
# example = "";
|
# example = "";
|
||||||
description =
|
description = " The highlight group to be used for highlighting cells.";
|
||||||
" The highlight group to be used for highlighting cells.";
|
|
||||||
};
|
};
|
||||||
save_path = mkOption {
|
save_path = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
description =
|
description = "Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
||||||
"Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
|
||||||
The generated file is placed in this directory, with the filename itself being the buffer's name, with % replaced by %% and / replaced by %, and postfixed with the extension .json.";
|
The generated file is placed in this directory, with the filename itself being the buffer's name, with % replaced by %% and / replaced by %, and postfixed with the extension .json.";
|
||||||
};
|
};
|
||||||
show_mimetype_debug = mkOption {
|
show_mimetype_debug = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
example = true;
|
example = true;
|
||||||
description =
|
description = " If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
||||||
" If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
|
||||||
This is meant for debugging and adding new mimetypes.";
|
This is meant for debugging and adding new mimetypes.";
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.nullOr types.package;
|
type = types.nullOr types.package;
|
||||||
default = null;
|
default = null;
|
||||||
example =
|
example = "package = pkgs.fetchFromGitHub {
|
||||||
"package = pkgs.fetchFromGitHub {
|
|
||||||
owner = \"WhiteBlackGoose\";
|
owner = \"WhiteBlackGoose\";
|
||||||
repo = \"magma-nvim-goose\";
|
repo = \"magma-nvim-goose\";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = \"sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=\";} ";
|
sha256 = \"sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=\";} ";
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ (
|
extraPlugins = [
|
||||||
if cfg.package != null then plugins.magma-nvim.override {src = cfg.package;} else plugins.magma-nvim
|
(
|
||||||
)];
|
if cfg.package != null
|
||||||
|
then plugins.magma-nvim.override {src = cfg.package;}
|
||||||
|
else plugins.magma-nvim
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
magma_image_provider =
|
magma_image_provider =
|
||||||
|
@ -99,13 +95,11 @@ in {
|
||||||
magma_wrap_output = mkIf (!cfg.wrap_output) cfg.wrap_output;
|
magma_wrap_output = mkIf (!cfg.wrap_output) cfg.wrap_output;
|
||||||
magma_output_window_borders =
|
magma_output_window_borders =
|
||||||
mkIf (!cfg.output_window_borders) cfg.output_window_borders;
|
mkIf (!cfg.output_window_borders) cfg.output_window_borders;
|
||||||
magma_highlight_group = mkIf (cfg.cell_highlight_group != "CursorLine")
|
magma_highlight_group =
|
||||||
|
mkIf (cfg.cell_highlight_group != "CursorLine")
|
||||||
cfg.cell_highlight_group;
|
cfg.cell_highlight_group;
|
||||||
magma_show_mimetype_debug =
|
magma_show_mimetype_debug =
|
||||||
mkIf cfg.show_mimetype_debug cfg.show_mimetype_debug;
|
mkIf cfg.show_mimetype_debug cfg.show_mimetype_debug;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.mark-radar;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
defs = import ../plugin-defs.nix { inherit pkgs; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.mark-radar;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
defs = import ../plugin-defs.nix {inherit pkgs;};
|
||||||
|
in {
|
||||||
options.plugins.mark-radar = {
|
options.plugins.mark-radar = {
|
||||||
enable = mkEnableOption "mark-radar";
|
enable = mkEnableOption "mark-radar";
|
||||||
|
|
||||||
|
@ -33,16 +35,15 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
opts = helpers.toLuaObject {
|
||||||
opts = helpers.toLuaObject {
|
inherit (cfg) highlight_group background_highlight_group;
|
||||||
inherit (cfg) highlight_group background_highlight_group;
|
set_default_mappings = cfg.set_default_keybinds;
|
||||||
set_default_mappings = cfg.set_default_keybinds;
|
background_highlight = cfg.highlight_background;
|
||||||
background_highlight = cfg.highlight_background;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require("mark-radar").setup(${opts})
|
require("mark-radar").setup(${opts})
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.notify;
|
cfg = config.plugins.notify;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
icon = mkOption {
|
icon = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.plugins.notify = {
|
options.plugins.notify = {
|
||||||
enable = mkEnableOption "notify";
|
enable = mkEnableOption "notify";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify;
|
package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify;
|
||||||
|
|
||||||
stages = mkOption {
|
stages = mkOption {
|
||||||
type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]);
|
type = types.nullOr (types.enum ["fade_in_slide_out" "fade" "slide" "static"]);
|
||||||
description = "Animation style";
|
description = "Animation style";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
@ -45,28 +48,27 @@ in
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
description = "Icons for the different levels";
|
description = "Icons for the different levels";
|
||||||
default = { };
|
default = {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
setupOptions = with cfg; {
|
||||||
setupOptions = with cfg; {
|
stages = stages;
|
||||||
stages = stages;
|
timeout = timeout;
|
||||||
timeout = timeout;
|
background_color = backgroundColor;
|
||||||
background_color = backgroundColor;
|
minimum_width = minimumWidth;
|
||||||
minimum_width = minimumWidth;
|
icons = with icons; {
|
||||||
icons = with icons; {
|
ERROR = error;
|
||||||
ERROR = error;
|
WARN = warn;
|
||||||
WARN = warn;
|
INFO = info;
|
||||||
INFO = info;
|
DEBUG = debug;
|
||||||
DEBUG = debug;
|
TRACE = trace;
|
||||||
TRACE = trace;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
vim.notify = require('notify');
|
vim.notify = require('notify');
|
||||||
require('notify').setup(${helpers.toLuaObject setupOptions})
|
require('notify').setup(${helpers.toLuaObject setupOptions})
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.nvim-autopairs;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.nvim-autopairs;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.nvim-autopairs = {
|
options.plugins.nvim-autopairs = {
|
||||||
enable = mkEnableOption "nvim-autopairs";
|
enable = mkEnableOption "nvim-autopairs";
|
||||||
|
|
||||||
|
@ -41,18 +44,17 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
options = {
|
||||||
options = {
|
pairs_map = cfg.pairs;
|
||||||
pairs_map = cfg.pairs;
|
disable_filetype = cfg.disabledFiletypes;
|
||||||
disable_filetype = cfg.disabledFiletypes;
|
break_line_filetype = cfg.breakLineFiletypes;
|
||||||
break_line_filetype = cfg.breakLineFiletypes;
|
html_break_line_filetype = cfg.htmlFiletypes;
|
||||||
html_break_line_filetype = cfg.htmlFiletypes;
|
ignored_next_char = cfg.ignoredNextChar;
|
||||||
ignored_next_char = cfg.ignoredNextChar;
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('nvim-autopairs').setup(${helpers.toLuaObject options})
|
require('nvim-autopairs').setup(${helpers.toLuaObject options})
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
with lib;
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
cfg = config.plugins.nvim-colorizer;
|
cfg = config.plugins.nvim-colorizer;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
|
||||||
colorizer-options = {
|
colorizer-options = {
|
||||||
RGB = mkOption {
|
RGB = mkOption {
|
||||||
|
@ -53,7 +56,7 @@ let
|
||||||
};
|
};
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Set the display mode";
|
description = "Set the display mode";
|
||||||
type = types.nullOr (types.enum [ "foreground" "background" "virtualtext" ]);
|
type = types.nullOr (types.enum ["foreground" "background" "virtualtext"]);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
tailwind = mkOption {
|
tailwind = mkOption {
|
||||||
|
@ -61,7 +64,7 @@ let
|
||||||
type = types.nullOr (
|
type = types.nullOr (
|
||||||
types.oneOf [
|
types.oneOf [
|
||||||
types.bool
|
types.bool
|
||||||
(types.enum [ "normal" "lsp" "both" ])
|
(types.enum ["normal" "lsp" "both"])
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -84,12 +87,9 @@ let
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
plugins.nvim-colorizer = {
|
plugins.nvim-colorizer = {
|
||||||
|
|
||||||
enable = mkEnableOption "nvim-colorizer";
|
enable = mkEnableOption "nvim-colorizer";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua;
|
package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua;
|
||||||
|
@ -100,11 +100,13 @@ in
|
||||||
types.listOf (types.oneOf [
|
types.listOf (types.oneOf [
|
||||||
types.str
|
types.str
|
||||||
(types.submodule {
|
(types.submodule {
|
||||||
options = {
|
options =
|
||||||
language = mkOption {
|
{
|
||||||
type = types.str;
|
language = mkOption {
|
||||||
};
|
type = types.str;
|
||||||
} // colorizer-options;
|
};
|
||||||
|
}
|
||||||
|
// colorizer-options;
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
@ -128,24 +130,26 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = let
|
extraConfigLua = let
|
||||||
|
filetypes =
|
||||||
filetypes = if (cfg.fileTypes != null)
|
if (cfg.fileTypes != null)
|
||||||
then (
|
then
|
||||||
let
|
(
|
||||||
list = map (
|
let
|
||||||
v: if builtins.isAttrs v
|
list =
|
||||||
then v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v [ "language" ])
|
map (
|
||||||
else "'${v}'"
|
v:
|
||||||
) cfg.fileTypes;
|
if builtins.isAttrs v
|
||||||
in "{" + (concatStringsSep "," list) + "}"
|
then v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v ["language"])
|
||||||
)
|
else "'${v}'"
|
||||||
else
|
)
|
||||||
"nil"
|
cfg.fileTypes;
|
||||||
;
|
in
|
||||||
|
"{" + (concatStringsSep "," list) + "}"
|
||||||
|
)
|
||||||
|
else "nil";
|
||||||
in ''
|
in ''
|
||||||
require("colorizer").setup({
|
require("colorizer").setup({
|
||||||
filetypes = ${filetypes},
|
filetypes = ${filetypes},
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
{ pkgs, config, lib, ... }@args:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.nvim-tree;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
|
||||||
basePluginPath = [ "plugins" "nvim-tree" ];
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.nvim-tree;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||||
|
basePluginPath = ["plugins" "nvim-tree"];
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(optionWarnings.mkRenamedOption {
|
(optionWarnings.mkRenamedOption {
|
||||||
option = basePluginPath ++ [ "updateCwd" ];
|
option = basePluginPath ++ ["updateCwd"];
|
||||||
newOption = basePluginPath ++ [ "syncRootWithCwd" ];
|
newOption = basePluginPath ++ ["syncRootWithCwd"];
|
||||||
})
|
})
|
||||||
(optionWarnings.mkRenamedOption {
|
(optionWarnings.mkRenamedOption {
|
||||||
option = basePluginPath ++ [ "updateFocusedFile" "updateCwd" ];
|
option = basePluginPath ++ ["updateFocusedFile" "updateCwd"];
|
||||||
newOption = basePluginPath ++ [ "updateFocusedFile" "updateRoot" ];
|
newOption = basePluginPath ++ ["updateFocusedFile" "updateRoot"];
|
||||||
})
|
})
|
||||||
(optionWarnings.mkDeprecatedOption {
|
(optionWarnings.mkDeprecatedOption {
|
||||||
option = basePluginPath ++ [ "openOnSetup" ];
|
option = basePluginPath ++ ["openOnSetup"];
|
||||||
alternative = [];
|
alternative = [];
|
||||||
})
|
})
|
||||||
(optionWarnings.mkDeprecatedOption {
|
(optionWarnings.mkDeprecatedOption {
|
||||||
option = basePluginPath ++ [ "ignoreFtOnSetup" ];
|
option = basePluginPath ++ ["ignoreFtOnSetup"];
|
||||||
alternative = [];
|
alternative = [];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -102,20 +105,19 @@ in
|
||||||
description = "Enable diagnostics";
|
description = "Enable diagnostics";
|
||||||
};
|
};
|
||||||
|
|
||||||
icons =
|
icons = let
|
||||||
let
|
diagnosticOption = desc:
|
||||||
diagnosticOption = desc: mkOption {
|
mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
description = desc;
|
description = desc;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
hint = diagnosticOption "Hints";
|
||||||
hint = diagnosticOption "Hints";
|
info = diagnosticOption "Info";
|
||||||
info = diagnosticOption "Info";
|
warning = diagnosticOption "Warning";
|
||||||
warning = diagnosticOption "Warning";
|
error = diagnosticOption "Error";
|
||||||
error = diagnosticOption "Error";
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateFocusedFile = {
|
updateFocusedFile = {
|
||||||
|
@ -233,50 +235,49 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
options = {
|
||||||
options = {
|
disable_netrw = cfg.disableNetrw;
|
||||||
disable_netrw = cfg.disableNetrw;
|
hijack_netrw = cfg.hijackNetrw;
|
||||||
hijack_netrw = cfg.hijackNetrw;
|
open_on_setup = cfg.openOnSetup;
|
||||||
open_on_setup = cfg.openOnSetup;
|
ignore_ft_on_setup = cfg.ignoreFtOnSetup;
|
||||||
ignore_ft_on_setup = cfg.ignoreFtOnSetup;
|
open_on_tab = cfg.openOnTab;
|
||||||
open_on_tab = cfg.openOnTab;
|
hijack_cursor = cfg.hijackCursor;
|
||||||
hijack_cursor = cfg.hijackCursor;
|
sync_root_with_cwd = cfg.syncRootWithCwd;
|
||||||
sync_root_with_cwd = cfg.syncRootWithCwd;
|
respect_buf_cwd = cfg.respectBufCwd;
|
||||||
respect_buf_cwd = cfg.respectBufCwd;
|
update_to_buf_dir = {
|
||||||
update_to_buf_dir = {
|
enable = cfg.updateToBufDir.enable;
|
||||||
enable = cfg.updateToBufDir.enable;
|
auto_open = cfg.updateToBufDir.autoOpen;
|
||||||
auto_open = cfg.updateToBufDir.autoOpen;
|
|
||||||
};
|
|
||||||
diagnostics = cfg.diagnostics;
|
|
||||||
update_focused_file = {
|
|
||||||
enable = cfg.updateFocusedFile.enable;
|
|
||||||
update_root = cfg.updateFocusedFile.updateRoot;
|
|
||||||
ignore_list = cfg.updateFocusedFile.ignoreList;
|
|
||||||
};
|
|
||||||
system_open = cfg.systemOpen;
|
|
||||||
filters = cfg.filters;
|
|
||||||
git = cfg.git;
|
|
||||||
view = {
|
|
||||||
width = cfg.view.width;
|
|
||||||
height = cfg.view.height;
|
|
||||||
hide_root_folder = cfg.view.hideRootFolder;
|
|
||||||
side = cfg.view.side;
|
|
||||||
auto_resize = cfg.view.autoResize;
|
|
||||||
mappings = {
|
|
||||||
custom_only = cfg.view.mappings.customOnly;
|
|
||||||
list = cfg.view.mappings.list;
|
|
||||||
};
|
|
||||||
number = cfg.view.number;
|
|
||||||
relativenumber = cfg.view.relativenumber;
|
|
||||||
signcolumn = cfg.view.signcolumn;
|
|
||||||
};
|
|
||||||
trash = {
|
|
||||||
cmd = cfg.trash.cmd;
|
|
||||||
require_confirm = cfg.trash.requireConfirm;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
diagnostics = cfg.diagnostics;
|
||||||
|
update_focused_file = {
|
||||||
|
enable = cfg.updateFocusedFile.enable;
|
||||||
|
update_root = cfg.updateFocusedFile.updateRoot;
|
||||||
|
ignore_list = cfg.updateFocusedFile.ignoreList;
|
||||||
|
};
|
||||||
|
system_open = cfg.systemOpen;
|
||||||
|
filters = cfg.filters;
|
||||||
|
git = cfg.git;
|
||||||
|
view = {
|
||||||
|
width = cfg.view.width;
|
||||||
|
height = cfg.view.height;
|
||||||
|
hide_root_folder = cfg.view.hideRootFolder;
|
||||||
|
side = cfg.view.side;
|
||||||
|
auto_resize = cfg.view.autoResize;
|
||||||
|
mappings = {
|
||||||
|
custom_only = cfg.view.mappings.customOnly;
|
||||||
|
list = cfg.view.mappings.list;
|
||||||
|
};
|
||||||
|
number = cfg.view.number;
|
||||||
|
relativenumber = cfg.view.relativenumber;
|
||||||
|
signcolumn = cfg.view.signcolumn;
|
||||||
|
};
|
||||||
|
trash = {
|
||||||
|
cmd = cfg.trash.cmd;
|
||||||
|
require_confirm = cfg.trash.requireConfirm;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
|
@ -294,6 +295,6 @@ in
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('nvim-tree').setup(${helpers.toLuaObject options})
|
require('nvim-tree').setup(${helpers.toLuaObject options})
|
||||||
'';
|
'';
|
||||||
extraPackages = [ pkgs.git ];
|
extraPackages = [pkgs.git];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +1,69 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.project-nvim;
|
|
||||||
helpers = import ../helpers.nix { inherit lib pkgs; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.plugins.project-nvim = helpers.extraOptionsOptions // {
|
pkgs,
|
||||||
enable = mkEnableOption "project.nvim";
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.project-nvim;
|
||||||
|
helpers = import ../helpers.nix {inherit lib pkgs;};
|
||||||
|
in {
|
||||||
|
options.plugins.project-nvim =
|
||||||
|
helpers.extraOptionsOptions
|
||||||
|
// {
|
||||||
|
enable = mkEnableOption "project.nvim";
|
||||||
|
|
||||||
package = helpers.mkPackageOption "project-nvim" pkgs.vimPlugins.project-nvim;
|
package = helpers.mkPackageOption "project-nvim" pkgs.vimPlugins.project-nvim;
|
||||||
|
|
||||||
manualMode = mkOption {
|
manualMode = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = null;
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
detectionMethods = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
patterns = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
ignoreLsp = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
excludeDirs = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
showHidden = mkOption {
|
||||||
|
type = types.nullOr types.bool;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
silentChdir = mkOption {
|
||||||
|
type = types.nullOr types.bool;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
scopeChdir = mkOption {
|
||||||
|
type = types.nullOr (types.enum ["global" "tab" "win"]);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
dataPath = mkOption {
|
||||||
|
type = types.nullOr (types.either types.str helpers.rawType);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
detectionMethods = mkOption {
|
config = let
|
||||||
type = types.nullOr (types.listOf types.str);
|
options =
|
||||||
default = null;
|
{
|
||||||
};
|
|
||||||
|
|
||||||
patterns = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
ignoreLsp = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
excludeDirs = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
showHidden = mkOption {
|
|
||||||
type = types.nullOr types.bool;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
silentChdir = mkOption {
|
|
||||||
type = types.nullOr types.bool;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
scopeChdir = mkOption {
|
|
||||||
type = types.nullOr (types.enum [ "global" "tab" "win" ]);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
dataPath = mkOption {
|
|
||||||
type = types.nullOr (types.either types.str helpers.rawType);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
options = {
|
|
||||||
manual_mode = cfg.manualMode;
|
manual_mode = cfg.manualMode;
|
||||||
detection_methods = cfg.detectionMethods;
|
detection_methods = cfg.detectionMethods;
|
||||||
patterns = cfg.patterns;
|
patterns = cfg.patterns;
|
||||||
|
@ -69,10 +73,11 @@ in
|
||||||
silent_chdir = cfg.silentChdir;
|
silent_chdir = cfg.silentChdir;
|
||||||
scope_schdir = cfg.scopeChdir;
|
scope_schdir = cfg.scopeChdir;
|
||||||
data_path = cfg.dataPath;
|
data_path = cfg.dataPath;
|
||||||
} // cfg.extraOptions;
|
}
|
||||||
in
|
// cfg.extraOptions;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
require('project_nvim').setup(${helpers.toLuaObject options})
|
require('project_nvim').setup(${helpers.toLuaObject options})
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.specs;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.specs;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options.plugins.specs = {
|
options.plugins.specs = {
|
||||||
enable = mkEnableOption "specs-nvim";
|
enable = mkEnableOption "specs-nvim";
|
||||||
|
|
||||||
|
@ -73,15 +76,16 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { builtin = "linear_fader"; };
|
default = {builtin = "linear_fader";};
|
||||||
};
|
};
|
||||||
|
|
||||||
resizer = mkOption {
|
resizer = mkOption {
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
builtin = mkOption {
|
builtin = mkOption {
|
||||||
type = types.nullOr
|
type =
|
||||||
(types.enum [ "shrink_resizer" "slide_resizer" "empty_resizer" ]);
|
types.nullOr
|
||||||
|
(types.enum ["shrink_resizer" "slide_resizer" "empty_resizer"]);
|
||||||
default = "shrink_resizer";
|
default = "shrink_resizer";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,48 +102,53 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = { builtin = "shrink_resizer"; };
|
default = {builtin = "shrink_resizer";};
|
||||||
};
|
};
|
||||||
|
|
||||||
ignored_filetypes = mkOption {
|
ignored_filetypes = mkOption {
|
||||||
type = with types; listOf string;
|
type = with types; listOf string;
|
||||||
default = [ ];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
ignored_buffertypes = mkOption {
|
ignored_buffertypes = mkOption {
|
||||||
type = with types; listOf string;
|
type = with types; listOf string;
|
||||||
default = [ "nofile" ];
|
default = ["nofile"];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
config =
|
config = let
|
||||||
let
|
setup = helpers.toLuaObject {
|
||||||
setup = helpers.toLuaObject {
|
inherit (cfg) show_jumps min_jump;
|
||||||
inherit (cfg) show_jumps min_jump;
|
ignore_filetypes =
|
||||||
ignore_filetypes = attrsets.listToAttrs
|
attrsets.listToAttrs
|
||||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||||
cfg.ignored_filetypes);
|
cfg.ignored_filetypes);
|
||||||
ignore_buftypes = attrsets.listToAttrs
|
ignore_buftypes =
|
||||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
attrsets.listToAttrs
|
||||||
cfg.ignored_buffertypes);
|
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||||
popup = {
|
cfg.ignored_buffertypes);
|
||||||
inherit (cfg) blend width;
|
popup = {
|
||||||
winhl = if (!isNull cfg.color) then "SpecsPopColor" else "PMenu";
|
inherit (cfg) blend width;
|
||||||
delay_ms = cfg.delay;
|
winhl =
|
||||||
inc_ms = cfg.increment;
|
if (!isNull cfg.color)
|
||||||
fader = helpers.mkRaw (if cfg.fader.builtin == null then
|
then "SpecsPopColor"
|
||||||
cfg.fader.custom
|
else "PMenu";
|
||||||
else
|
delay_ms = cfg.delay;
|
||||||
''require("specs").${cfg.fader.builtin}'');
|
inc_ms = cfg.increment;
|
||||||
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
|
fader = helpers.mkRaw (
|
||||||
cfg.resizer.custom
|
if cfg.fader.builtin == null
|
||||||
else
|
then cfg.fader.custom
|
||||||
''require("specs").${cfg.resizer.builtin}'');
|
else ''require("specs").${cfg.fader.builtin}''
|
||||||
};
|
);
|
||||||
|
resizer = helpers.mkRaw (
|
||||||
|
if cfg.resizer.builtin == null
|
||||||
|
then cfg.resizer.custom
|
||||||
|
else ''require("specs").${cfg.resizer.builtin}''
|
||||||
|
);
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;
|
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;
|
||||||
|
|
||||||
|
|
|
@ -1,220 +1,233 @@
|
||||||
{ pkgs, lib, ... }@args:
|
{
|
||||||
let
|
pkgs,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
lib,
|
||||||
in with lib; with helpers;
|
...
|
||||||
mkPlugin args {
|
} @ args: let
|
||||||
name = "startify";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable startify";
|
in
|
||||||
package = pkgs.vimPlugins.vim-startify;
|
with lib;
|
||||||
|
with helpers;
|
||||||
|
mkPlugin args {
|
||||||
|
name = "startify";
|
||||||
|
description = "Enable startify";
|
||||||
|
package = pkgs.vimPlugins.vim-startify;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
sessionDir = mkDefaultOpt {
|
sessionDir = mkDefaultOpt {
|
||||||
description = "Directory to save/load session";
|
description = "Directory to save/load session";
|
||||||
global = "startify_session_dir";
|
global = "startify_session_dir";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
|
||||||
|
|
||||||
lists = mkDefaultOpt {
|
|
||||||
description = "Startify display lists. If it's a string, it'll be interpreted as literal lua code";
|
|
||||||
global = "startify_lists";
|
|
||||||
type = types.listOf (types.oneOf [(types.submodule {
|
|
||||||
options = {
|
|
||||||
type = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The type of the list";
|
|
||||||
};
|
|
||||||
# TODO the header should be a literal lua string!
|
|
||||||
header = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
description = "Optional header. It's a list of strings";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
indices = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
description = "Optional indices for the current list";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}) types.str]);
|
|
||||||
|
|
||||||
value = val: let
|
lists = mkDefaultOpt {
|
||||||
list = map (v: if builtins.isAttrs v then toLuaObject v else v) val;
|
description = "Startify display lists. If it's a string, it'll be interpreted as literal lua code";
|
||||||
in "{" + (concatStringsSep "," list) + "}";
|
global = "startify_lists";
|
||||||
};
|
type = types.listOf (types.oneOf [
|
||||||
|
(types.submodule {
|
||||||
|
options = {
|
||||||
|
type = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The type of the list";
|
||||||
|
};
|
||||||
|
# TODO the header should be a literal lua string!
|
||||||
|
header = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
description = "Optional header. It's a list of strings";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
indices = mkOption {
|
||||||
|
type = types.nullOr (types.listOf types.str);
|
||||||
|
description = "Optional indices for the current list";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
types.str
|
||||||
|
]);
|
||||||
|
|
||||||
bookmarks = mkDefaultOpt {
|
value = val: let
|
||||||
description = "A list of files or directories to bookmark.";
|
list = map (v:
|
||||||
global = "startify_bookmarks";
|
if builtins.isAttrs v
|
||||||
type = with types; listOf (oneOf [str (attrsOf str)]);
|
then toLuaObject v
|
||||||
};
|
else v)
|
||||||
|
val;
|
||||||
|
in
|
||||||
|
"{" + (concatStringsSep "," list) + "}";
|
||||||
|
};
|
||||||
|
|
||||||
commands = mkDefaultOpt {
|
bookmarks = mkDefaultOpt {
|
||||||
description = "A list of commands to execute on selection";
|
description = "A list of files or directories to bookmark.";
|
||||||
global = "startify_commands";
|
global = "startify_bookmarks";
|
||||||
type = with types; listOf (oneOf [ str (listOf str) attrs ]);
|
type = with types; listOf (oneOf [str (attrsOf str)]);
|
||||||
};
|
};
|
||||||
|
|
||||||
filesNumber = mkDefaultOpt {
|
commands = mkDefaultOpt {
|
||||||
description = "The number of files to list";
|
description = "A list of commands to execute on selection";
|
||||||
global = "startify_files_number";
|
global = "startify_commands";
|
||||||
type = types.int;
|
type = with types; listOf (oneOf [str (listOf str) attrs]);
|
||||||
};
|
};
|
||||||
|
|
||||||
updateOldFiles = mkDefaultOpt {
|
filesNumber = mkDefaultOpt {
|
||||||
description = "Update v:oldfiles on-the-fly, so that :Startify is always up-to-date";
|
description = "The number of files to list";
|
||||||
global = "startify_update_oldfiles";
|
global = "startify_files_number";
|
||||||
type = types.bool;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionAutoload = mkDefaultOpt {
|
updateOldFiles = mkDefaultOpt {
|
||||||
description = "Load Session.vim";
|
description = "Update v:oldfiles on-the-fly, so that :Startify is always up-to-date";
|
||||||
global = "startify_session_autoload";
|
global = "startify_update_oldfiles";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionBeforeSave = mkDefaultOpt {
|
sessionAutoload = mkDefaultOpt {
|
||||||
description = "Commands to be executed before saving a session";
|
description = "Load Session.vim";
|
||||||
global = "startify_session_before_save";
|
global = "startify_session_autoload";
|
||||||
type = types.listOf types.str;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionPersistence = mkDefaultOpt {
|
sessionBeforeSave = mkDefaultOpt {
|
||||||
description = "Automatically update sessions";
|
description = "Commands to be executed before saving a session";
|
||||||
global = "startify_session_persistence";
|
global = "startify_session_before_save";
|
||||||
type = types.bool;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionDeleteBuffers = mkDefaultOpt {
|
sessionPersistence = mkDefaultOpt {
|
||||||
description = "Delete all buffers when loading or closing a session";
|
description = "Automatically update sessions";
|
||||||
global = "startify_session_delete_buffers";
|
global = "startify_session_persistence";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
changeToDir = mkDefaultOpt {
|
sessionDeleteBuffers = mkDefaultOpt {
|
||||||
description = "When opening a file or bookmark, change to its directory";
|
description = "Delete all buffers when loading or closing a session";
|
||||||
global = "startify_change_to_dir";
|
global = "startify_session_delete_buffers";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
changeToVcsRoot = mkDefaultOpt {
|
changeToDir = mkDefaultOpt {
|
||||||
description = "When opening a file or bookmark, change to the root directory of the VCS";
|
description = "When opening a file or bookmark, change to its directory";
|
||||||
global = "startify_change_to_vcs_root";
|
global = "startify_change_to_dir";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
changeCmd = mkDefaultOpt {
|
changeToVcsRoot = mkDefaultOpt {
|
||||||
description = "The default command for switching directories";
|
description = "When opening a file or bookmark, change to the root directory of the VCS";
|
||||||
global = "startify_change_cmd";
|
global = "startify_change_to_vcs_root";
|
||||||
type = types.enum [ "cd" "lcd" "tcd" ];
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
skipList = mkDefaultOpt {
|
changeCmd = mkDefaultOpt {
|
||||||
description = "A list of regexes that is used to filter recently used files";
|
description = "The default command for switching directories";
|
||||||
global = "startify_skiplist";
|
global = "startify_change_cmd";
|
||||||
type = types.listOf types.str;
|
type = types.enum ["cd" "lcd" "tcd"];
|
||||||
};
|
};
|
||||||
|
|
||||||
useUnicode = mkDefaultOpt {
|
skipList = mkDefaultOpt {
|
||||||
description = "Use unicode box drawing characters for the fortune header";
|
description = "A list of regexes that is used to filter recently used files";
|
||||||
global = "startify_fortune_use_unicode";
|
global = "startify_skiplist";
|
||||||
type = types.bool;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
paddingLeft = mkDefaultOpt {
|
useUnicode = mkDefaultOpt {
|
||||||
description = "Number of spaces used for left padding";
|
description = "Use unicode box drawing characters for the fortune header";
|
||||||
global = "startify_padding_left";
|
global = "startify_fortune_use_unicode";
|
||||||
type = types.int;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
skipListServer = mkDefaultOpt {
|
paddingLeft = mkDefaultOpt {
|
||||||
description = "Do not create the startify buffer if this is a Vim server instance with a name contained in this list";
|
description = "Number of spaces used for left padding";
|
||||||
global = "startify_skiplist_server";
|
global = "startify_padding_left";
|
||||||
type = types.listOf types.str;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
enableSpecial = mkDefaultOpt {
|
skipListServer = mkDefaultOpt {
|
||||||
description = "Show <empty buffer> and <quit>";
|
description = "Do not create the startify buffer if this is a Vim server instance with a name contained in this list";
|
||||||
global = "startify_enable_special";
|
global = "startify_skiplist_server";
|
||||||
type = types.bool;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
enableUnsafe = mkDefaultOpt {
|
enableSpecial = mkDefaultOpt {
|
||||||
description = "Improves start time but reduces accuracy of the file list";
|
description = "Show <empty buffer> and <quit>";
|
||||||
global = "startify_enable_unsafe";
|
global = "startify_enable_special";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionRemoveLines = mkDefaultOpt {
|
enableUnsafe = mkDefaultOpt {
|
||||||
description = "Lines matching any of the patterns in this list will be removed from the session file";
|
description = "Improves start time but reduces accuracy of the file list";
|
||||||
global = "startify_session_remove_lines";
|
global = "startify_enable_unsafe";
|
||||||
type = types.listOf types.str;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionSaveVars = mkDefaultOpt {
|
sessionRemoveLines = mkDefaultOpt {
|
||||||
description = "List of variables for Startify to save into the session file";
|
description = "Lines matching any of the patterns in this list will be removed from the session file";
|
||||||
global = "startify_session_savevars";
|
global = "startify_session_remove_lines";
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionSaveCmds = mkDefaultOpt {
|
sessionSaveVars = mkDefaultOpt {
|
||||||
description = "List of cmdline commands to run when loading the session";
|
description = "List of variables for Startify to save into the session file";
|
||||||
global = "startify_session_savecmds";
|
global = "startify_session_savevars";
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionNumber = mkDefaultOpt {
|
sessionSaveCmds = mkDefaultOpt {
|
||||||
description = "Maximum number of sessions to display";
|
description = "List of cmdline commands to run when loading the session";
|
||||||
global = "startify_session_number";
|
global = "startify_session_savecmds";
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionSort = mkDefaultOpt {
|
sessionNumber = mkDefaultOpt {
|
||||||
description = "Sort sessions by modification time rather than alphabetically";
|
description = "Maximum number of sessions to display";
|
||||||
global = "startify_session_sort";
|
global = "startify_session_number";
|
||||||
type = types.bool;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
customIndices = mkDefaultOpt {
|
sessionSort = mkDefaultOpt {
|
||||||
description = "Use this list as indices instead of increasing numbers";
|
description = "Sort sessions by modification time rather than alphabetically";
|
||||||
global = "startify_custom_indices";
|
global = "startify_session_sort";
|
||||||
type = types.listOf types.str;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
customHeader = mkDefaultOpt {
|
customIndices = mkDefaultOpt {
|
||||||
description = "Define your own header";
|
description = "Use this list as indices instead of increasing numbers";
|
||||||
global = "startify_custom_header";
|
global = "startify_custom_indices";
|
||||||
type = types.oneOf [ types.str (types.listOf types.str) ];
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
customQuotes = mkDefaultOpt {
|
customHeader = mkDefaultOpt {
|
||||||
description = "Own quotes for the cowsay header";
|
description = "Define your own header";
|
||||||
global = "startify_custom_header_quotes";
|
global = "startify_custom_header";
|
||||||
# TODO this should also support funcrefs!
|
type = types.oneOf [types.str (types.listOf types.str)];
|
||||||
type = types.listOf (types.listOf types.str);
|
};
|
||||||
};
|
|
||||||
|
|
||||||
customFooter = mkDefaultOpt {
|
customQuotes = mkDefaultOpt {
|
||||||
description = "Custom footer";
|
description = "Own quotes for the cowsay header";
|
||||||
global = "startify_custom_footer";
|
global = "startify_custom_header_quotes";
|
||||||
type = types.str;
|
# TODO this should also support funcrefs!
|
||||||
};
|
type = types.listOf (types.listOf types.str);
|
||||||
|
};
|
||||||
|
|
||||||
disableAtVimEnter = mkDefaultOpt {
|
customFooter = mkDefaultOpt {
|
||||||
description = "Don't run Startify at Vim startup";
|
description = "Custom footer";
|
||||||
global = "startify_disable_at_vimenter";
|
global = "startify_custom_footer";
|
||||||
type = types.bool;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
relativePath = mkDefaultOpt {
|
disableAtVimEnter = mkDefaultOpt {
|
||||||
description = "If the file is in or below the current working directory, use a relative path";
|
description = "Don't run Startify at Vim startup";
|
||||||
global = "startify_relative_path";
|
global = "startify_disable_at_vimenter";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
useEnv = mkDefaultOpt {
|
relativePath = mkDefaultOpt {
|
||||||
description = "Show environment variables in path, if their name is shorter than their value";
|
description = "If the file is in or below the current working directory, use a relative path";
|
||||||
global = "startify_use_env";
|
global = "startify_relative_path";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
useEnv = mkDefaultOpt {
|
||||||
|
description = "Show environment variables in path, if their name is shorter than their value";
|
||||||
|
global = "startify_use_env";
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
{ lib, pkgs, ... }@attrs:
|
{
|
||||||
let
|
lib,
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
pkgs,
|
||||||
in with helpers; with lib;
|
...
|
||||||
mkPlugin attrs {
|
} @ attrs: let
|
||||||
name = "surround";
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
description = "Enable surround.vim";
|
in
|
||||||
package = pkgs.vimPlugins.surround;
|
with helpers;
|
||||||
|
with lib;
|
||||||
|
mkPlugin attrs {
|
||||||
|
name = "surround";
|
||||||
|
description = "Enable surround.vim";
|
||||||
|
package = pkgs.vimPlugins.surround;
|
||||||
|
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.plugins.undotree;
|
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.plugins.undotree;
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.undotree = {
|
plugins.undotree = {
|
||||||
enable = mkEnableOption "Enable undotree";
|
enable = mkEnableOption "Enable undotree";
|
||||||
|
@ -110,7 +113,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
|
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
|
||||||
|
|
524
tests/flake.nix
524
tests/flake.nix
|
@ -14,299 +14,305 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs-stable";
|
inputs.nixpkgs.follows = "nixpkgs-stable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixvim, nixvim-stable, nixpkgs, flake-utils, nixpkgs-stable, build-ts, gleam, ... }:
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixvim,
|
||||||
|
nixvim-stable,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
nixpkgs-stable,
|
||||||
|
build-ts,
|
||||||
|
gleam,
|
||||||
|
...
|
||||||
|
}:
|
||||||
(flake-utils.lib.eachDefaultSystem
|
(flake-utils.lib.eachDefaultSystem
|
||||||
(system:
|
(system: let
|
||||||
let
|
pkgs = import nixpkgs {inherit system;};
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs-stable = import nixpkgs-stable {inherit system;};
|
||||||
pkgs-stable = import nixpkgs-stable { inherit system; };
|
build = nixvim.legacyPackages.${system}.makeNixvim;
|
||||||
build = nixvim.legacyPackages.${system}.makeNixvim;
|
build-stable = nixvim-stable.legacyPackages.${system}.makeNixvim;
|
||||||
build-stable = nixvim-stable.legacyPackages.${system}.makeNixvim;
|
in rec {
|
||||||
in
|
# A plain nixvim configuration
|
||||||
rec {
|
packages = {
|
||||||
# A plain nixvim configuration
|
plain = build {};
|
||||||
packages = {
|
|
||||||
plain = build { };
|
|
||||||
|
|
||||||
# Should print "Hello!" when starting up
|
# Should print "Hello!" when starting up
|
||||||
hello = build {
|
hello = build {
|
||||||
extraConfigLua = "print(\"Hello!\")";
|
extraConfigLua = "print(\"Hello!\")";
|
||||||
|
};
|
||||||
|
|
||||||
|
simple-plugin = build {
|
||||||
|
extraPlugins = [pkgs.vimPlugins.vim-surround];
|
||||||
|
};
|
||||||
|
|
||||||
|
gruvbox = build {
|
||||||
|
extraPlugins = [pkgs.vimPlugins.gruvbox];
|
||||||
|
colorscheme = "gruvbox";
|
||||||
|
};
|
||||||
|
|
||||||
|
gruvbox-module = build {
|
||||||
|
colorschemes.gruvbox.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter = build {
|
||||||
|
plugins.treesitter.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter-nonix = build {
|
||||||
|
plugins.treesitter = {
|
||||||
|
enable = true;
|
||||||
|
nixGrammars = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
elixir-ls = build {
|
||||||
|
plugins.lsp.enable = true;
|
||||||
|
plugins.lsp.servers.elixirls.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp-lines = build-stable {
|
||||||
|
plugins.lsp-lines.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
trouble = build {
|
||||||
|
plugins.lsp = {
|
||||||
|
enable = true;
|
||||||
|
servers.clangd.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
simple-plugin = build {
|
plugins.trouble.enable = true;
|
||||||
extraPlugins = [ pkgs.vimPlugins.vim-surround ];
|
};
|
||||||
};
|
|
||||||
|
|
||||||
gruvbox = build {
|
beautysh = build {
|
||||||
extraPlugins = [ pkgs.vimPlugins.gruvbox ];
|
plugins.null-ls = {
|
||||||
colorscheme = "gruvbox";
|
enable = true;
|
||||||
|
sources.formatting.beautysh.enable = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
gruvbox-module = build {
|
keymaps = build {
|
||||||
colorschemes.gruvbox.enable = true;
|
maps.normal."," = "<cmd>echo \"test\"<cr>";
|
||||||
};
|
};
|
||||||
|
|
||||||
treesitter = build {
|
issue-40 = build-stable {
|
||||||
plugins.treesitter.enable = true;
|
plugins = {
|
||||||
};
|
nix.enable = true;
|
||||||
|
nvim-autopairs.enable = true;
|
||||||
|
|
||||||
treesitter-nonix = build {
|
lualine = {
|
||||||
plugins.treesitter = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
nixGrammars = false;
|
|
||||||
|
sectionSeparators = {
|
||||||
|
left = "";
|
||||||
|
right = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
componentSeparators = {
|
||||||
|
left = "";
|
||||||
|
right = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = "auto";
|
||||||
|
};
|
||||||
|
|
||||||
|
goyo = {
|
||||||
|
enable = true;
|
||||||
|
showLineNumbers = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
servers = {
|
||||||
|
rust-analyzer.enable = true;
|
||||||
|
rnix-lsp.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
elixir-ls = build {
|
|
||||||
plugins.lsp.enable = true;
|
options = {
|
||||||
plugins.lsp.servers.elixirls.enable = true;
|
# Indentation
|
||||||
|
autoindent = true;
|
||||||
|
tabstop = 4;
|
||||||
|
shiftwidth = 4;
|
||||||
|
expandtab = true;
|
||||||
|
backspace = "indent,eol,start";
|
||||||
|
|
||||||
|
# Text
|
||||||
|
showmatch = true;
|
||||||
|
mouse = "a";
|
||||||
|
number = true;
|
||||||
|
relativenumber = false;
|
||||||
|
ttyfast = true;
|
||||||
|
clipboard = "unnamedplus";
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
background = "dark";
|
||||||
|
termguicolors = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
issue-65 = build {
|
||||||
|
colorschemes.gruvbox = {
|
||||||
|
enable = true;
|
||||||
|
contrastLight = "hard";
|
||||||
|
contrastDark = "hard";
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp-lines = build-stable {
|
options = {
|
||||||
plugins.lsp-lines.enable = true;
|
number = true;
|
||||||
|
shiftwidth = 2;
|
||||||
|
tabstop = 2;
|
||||||
|
guifont = "FiraCode\ Nerd\ Font\ Mono:h14";
|
||||||
};
|
};
|
||||||
|
|
||||||
trouble = build {
|
plugins = {
|
||||||
plugins.lsp = {
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
servers.rnix-lsp.enable = true;
|
||||||
|
servers.rust-analyzer.enable = true;
|
||||||
|
servers.jsonls.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nvim-tree = {
|
||||||
|
enable = true;
|
||||||
|
openOnSetup = true;
|
||||||
|
openOnTab = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
telescope = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nvim-cmp = {
|
||||||
|
formatting = {
|
||||||
|
format = ''
|
||||||
|
require("lspkind").cmp_format({
|
||||||
|
mode="symbol",
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "..."
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
auto_enable_sources = true;
|
||||||
|
snippet = {
|
||||||
|
expand = ''
|
||||||
|
function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
enable = true;
|
||||||
|
sources = [
|
||||||
|
{name = "nvim_lsp";}
|
||||||
|
{
|
||||||
|
name = "luasnip";
|
||||||
|
option = {
|
||||||
|
show_autosnippets = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{name = "path";}
|
||||||
|
{name = "buffer";}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
barbar.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
globals.mapleader = " ";
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
|
which-key-nvim
|
||||||
|
# leap-nvim
|
||||||
|
vim-flutter
|
||||||
|
plenary-nvim
|
||||||
|
fidget-nvim
|
||||||
|
luasnip
|
||||||
|
lspkind-nvim
|
||||||
|
];
|
||||||
|
|
||||||
|
# extraConfigLua = (builtins.readFile ./nvim-extra-lua.lua);
|
||||||
|
};
|
||||||
|
|
||||||
|
issue-71 = build {
|
||||||
|
maps.normal."<leader>hb" = "<cmd>lua require('gitsigns').blame_line{full=true}<cr>";
|
||||||
|
};
|
||||||
|
|
||||||
|
lspkind = build {
|
||||||
|
plugins = {
|
||||||
|
lsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
servers.clangd.enable = true;
|
servers.clangd.enable = true;
|
||||||
};
|
};
|
||||||
|
nvim-cmp.enable = true;
|
||||||
plugins.trouble.enable = true;
|
lspkind.enable = true;
|
||||||
};
|
|
||||||
|
|
||||||
beautysh = build {
|
|
||||||
plugins.null-ls = {
|
|
||||||
enable = true;
|
|
||||||
sources.formatting.beautysh.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
keymaps = build {
|
|
||||||
maps.normal."," = "<cmd>echo \"test\"<cr>";
|
|
||||||
};
|
|
||||||
|
|
||||||
issue-40 = build-stable {
|
|
||||||
plugins = {
|
|
||||||
nix.enable = true;
|
|
||||||
nvim-autopairs.enable = true;
|
|
||||||
|
|
||||||
lualine = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
sectionSeparators = {
|
|
||||||
left = "";
|
|
||||||
right = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
componentSeparators = {
|
|
||||||
left = "";
|
|
||||||
right = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
theme = "auto";
|
|
||||||
};
|
|
||||||
|
|
||||||
goyo = {
|
|
||||||
enable = true;
|
|
||||||
showLineNumbers = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp = {
|
|
||||||
enable = true;
|
|
||||||
servers = {
|
|
||||||
rust-analyzer.enable = true;
|
|
||||||
rnix-lsp.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
options = {
|
|
||||||
# Indentation
|
|
||||||
autoindent = true;
|
|
||||||
tabstop = 4;
|
|
||||||
shiftwidth = 4;
|
|
||||||
expandtab = true;
|
|
||||||
backspace = "indent,eol,start";
|
|
||||||
|
|
||||||
# Text
|
|
||||||
showmatch = true;
|
|
||||||
mouse = "a";
|
|
||||||
number = true;
|
|
||||||
relativenumber = false;
|
|
||||||
ttyfast = true;
|
|
||||||
clipboard = "unnamedplus";
|
|
||||||
|
|
||||||
# Colors
|
|
||||||
background = "dark";
|
|
||||||
termguicolors = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
issue-65 = build {
|
|
||||||
colorschemes.gruvbox = {
|
|
||||||
enable = true;
|
|
||||||
contrastLight = "hard";
|
|
||||||
contrastDark = "hard";
|
|
||||||
};
|
|
||||||
|
|
||||||
options = {
|
|
||||||
number = true;
|
|
||||||
shiftwidth = 2;
|
|
||||||
tabstop = 2;
|
|
||||||
guifont = "FiraCode\ Nerd\ Font\ Mono:h14";
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins = {
|
|
||||||
lsp = {
|
|
||||||
enable = true;
|
|
||||||
servers.rnix-lsp.enable = true;
|
|
||||||
servers.rust-analyzer.enable = true;
|
|
||||||
servers.jsonls.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-tree = {
|
|
||||||
enable = true;
|
|
||||||
openOnSetup = true;
|
|
||||||
openOnTab = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
telescope = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-cmp = {
|
|
||||||
formatting = {
|
|
||||||
format = ''
|
|
||||||
require("lspkind").cmp_format({
|
|
||||||
mode="symbol",
|
|
||||||
maxwidth = 50,
|
|
||||||
ellipsis_char = "..."
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
auto_enable_sources = true;
|
|
||||||
snippet = {
|
|
||||||
expand = ''
|
|
||||||
function(args)
|
|
||||||
require("luasnip").lsp_expand(args.body)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
enable = true;
|
|
||||||
sources = [
|
|
||||||
{ name = "nvim_lsp"; }
|
|
||||||
{
|
|
||||||
name = "luasnip";
|
|
||||||
option = {
|
|
||||||
show_autosnippets = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{ name = "path"; }
|
|
||||||
{ name = "buffer"; }
|
|
||||||
];
|
|
||||||
|
|
||||||
};
|
|
||||||
barbar.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
globals.mapleader = " ";
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
|
||||||
which-key-nvim
|
|
||||||
# leap-nvim
|
|
||||||
vim-flutter
|
|
||||||
plenary-nvim
|
|
||||||
fidget-nvim
|
|
||||||
luasnip
|
|
||||||
lspkind-nvim
|
|
||||||
];
|
|
||||||
|
|
||||||
# extraConfigLua = (builtins.readFile ./nvim-extra-lua.lua);
|
|
||||||
};
|
|
||||||
|
|
||||||
issue-71 = build {
|
|
||||||
maps.normal."<leader>hb" = "<cmd>lua require('gitsigns').blame_line{full=true}<cr>";
|
|
||||||
};
|
|
||||||
|
|
||||||
lspkind = build {
|
|
||||||
plugins = {
|
|
||||||
lsp = {
|
|
||||||
enable = true;
|
|
||||||
servers.clangd.enable = true;
|
|
||||||
};
|
|
||||||
nvim-cmp.enable = true;
|
|
||||||
lspkind.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
highlight = build {
|
|
||||||
options.termguicolors = true;
|
|
||||||
highlight = {
|
|
||||||
Normal.fg = "#ff0000";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
autoCmd = build {
|
|
||||||
autoCmd = [
|
|
||||||
{
|
|
||||||
event = [ "BufEnter" "BufWinEnter" ];
|
|
||||||
pattern = [ "*.c" "*.h" ];
|
|
||||||
command = "echo 'Entering a C or C++ file'";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
event = "InsertEnter";
|
|
||||||
command = "norm zz";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
ts-custom = build {
|
|
||||||
plugins.treesitter = {
|
|
||||||
enable = true;
|
|
||||||
nixGrammars = true;
|
|
||||||
grammarPackages = [
|
|
||||||
(build-ts.lib.buildGrammar pkgs {
|
|
||||||
language = "gleam";
|
|
||||||
version = "0.25.0";
|
|
||||||
source = gleam;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})) // {
|
|
||||||
|
highlight = build {
|
||||||
|
options.termguicolors = true;
|
||||||
|
highlight = {
|
||||||
|
Normal.fg = "#ff0000";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
autoCmd = build {
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = ["BufEnter" "BufWinEnter"];
|
||||||
|
pattern = ["*.c" "*.h"];
|
||||||
|
command = "echo 'Entering a C or C++ file'";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "InsertEnter";
|
||||||
|
command = "norm zz";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
ts-custom = build {
|
||||||
|
plugins.treesitter = {
|
||||||
|
enable = true;
|
||||||
|
nixGrammars = true;
|
||||||
|
grammarPackages = [
|
||||||
|
(build-ts.lib.buildGrammar pkgs {
|
||||||
|
language = "gleam";
|
||||||
|
version = "0.25.0";
|
||||||
|
source = gleam;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}))
|
||||||
|
// {
|
||||||
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
({ pkgs, ... }: {
|
({pkgs, ...}: {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(nixvim.build pkgs { colorschemes.gruvbox.enable = true; })
|
(nixvim.build pkgs {colorschemes.gruvbox.enable = true;})
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = [
|
||||||
[
|
({pkgs, ...}: {
|
||||||
({ pkgs, ... }: {
|
boot.isContainer = true;
|
||||||
boot.isContainer = true;
|
|
||||||
|
|
||||||
# Let 'nixos-version --json' know about the Git revision
|
# Let 'nixos-version --json' know about the Git revision
|
||||||
# of this flake.
|
# of this flake.
|
||||||
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
nixvim.nixosModules.x86_64-linux.nixvim
|
nixvim.nixosModules.x86_64-linux.nixvim
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
colorschemes.gruvbox.enable = true;
|
colorschemes.gruvbox.enable = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||||
|
in {
|
||||||
helpers = mkOption {
|
helpers = mkOption {
|
||||||
type = mkOptionType {
|
type = mkOptionType {
|
||||||
name = "helpers";
|
name = "helpers";
|
||||||
|
@ -11,6 +12,6 @@ in
|
||||||
check = builtins.isAttrs;
|
check = builtins.isAttrs;
|
||||||
};
|
};
|
||||||
description = "Use this option to access the helpers";
|
description = "Use this option to access the helpers";
|
||||||
default = import ../plugins/helpers.nix { inherit (pkgs) lib; };
|
default = import ../plugins/helpers.nix {inherit (pkgs) lib;};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
modules:
|
modules: {
|
||||||
{ pkgs, config, lib, ... }@args:
|
pkgs,
|
||||||
|
config,
|
||||||
let
|
lib,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||||
shared = import ./_shared.nix args;
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
programs.nixvim = mkOption {
|
programs.nixvim = mkOption {
|
||||||
type = types.submodule ((modules pkgs) ++ [{
|
type = types.submodule ((modules pkgs)
|
||||||
options.enable = mkEnableOption "nixvim";
|
++ [
|
||||||
config.wrapRc = mkForce true;
|
{
|
||||||
}]);
|
options.enable = mkEnableOption "nixvim";
|
||||||
|
config.wrapRc = mkForce true;
|
||||||
|
}
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = shared.helpers;
|
nixvim.helpers = shared.helpers;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable mkMerge [
|
config = mkIf cfg.enable mkMerge [
|
||||||
{
|
{
|
||||||
environment.systemPackages = [ cfg.finalPackage ];
|
environment.systemPackages = [cfg.finalPackage];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
warnings = cfg.warnings;
|
warnings = cfg.warnings;
|
||||||
|
|
|
@ -1,30 +1,35 @@
|
||||||
modules:
|
modules: {
|
||||||
{ pkgs, config, lib, ... }@args:
|
pkgs,
|
||||||
|
config,
|
||||||
let
|
lib,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||||
shared = import ./_shared.nix args;
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
programs.nixvim = mkOption {
|
programs.nixvim = mkOption {
|
||||||
type = types.submodule ((modules pkgs) ++ [{
|
type = types.submodule ((modules pkgs)
|
||||||
options.enable = mkEnableOption "nixvim";
|
++ [
|
||||||
}]);
|
{
|
||||||
|
options.enable = mkEnableOption "nixvim";
|
||||||
|
}
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = shared.helpers;
|
nixvim.helpers = shared.helpers;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config =
|
||||||
|
mkIf cfg.enable
|
||||||
(mkMerge [
|
(mkMerge [
|
||||||
{ home.packages = [ cfg.finalPackage ]; }
|
{home.packages = [cfg.finalPackage];}
|
||||||
(mkIf (!cfg.wrapRc) {
|
(mkIf (!cfg.wrapRc) {
|
||||||
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
||||||
})
|
})
|
||||||
({
|
{
|
||||||
warnings = cfg.warnings;
|
warnings = cfg.warnings;
|
||||||
assertions = cfg.assertions;
|
assertions = cfg.assertions;
|
||||||
})
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,36 @@
|
||||||
modules:
|
modules: {
|
||||||
{ pkgs, config, lib, ... }@args:
|
pkgs,
|
||||||
|
config,
|
||||||
let
|
lib,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||||
shared = import ./_shared.nix args;
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = {
|
options = {
|
||||||
programs.nixvim = mkOption {
|
programs.nixvim = mkOption {
|
||||||
type = types.submodule ((modules pkgs) ++ [{
|
type = types.submodule ((modules pkgs)
|
||||||
options.enable = mkEnableOption "nixvim";
|
++ [
|
||||||
}]);
|
{
|
||||||
|
options.enable = mkEnableOption "nixvim";
|
||||||
|
}
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = shared.helpers;
|
nixvim.helpers = shared.helpers;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config =
|
||||||
|
mkIf cfg.enable
|
||||||
(mkMerge [
|
(mkMerge [
|
||||||
{ environment.systemPackages = [ cfg.finalPackage ]; }
|
{environment.systemPackages = [cfg.finalPackage];}
|
||||||
(mkIf (!cfg.wrapRc) {
|
(mkIf (!cfg.wrapRc) {
|
||||||
environment.etc."nvim/sysinit.lua".text = cfg.initContent;
|
environment.etc."nvim/sysinit.lua".text = cfg.initContent;
|
||||||
environment.variables."VIM" = "/etc/nvim";
|
environment.variables."VIM" = "/etc/nvim";
|
||||||
})
|
})
|
||||||
({
|
{
|
||||||
warnings = cfg.warnings;
|
warnings = cfg.warnings;
|
||||||
assertions = cfg.assertions;
|
assertions = cfg.assertions;
|
||||||
})
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
default_pkgs: modules: {pkgs ? default_pkgs, module}:
|
default_pkgs: modules: {
|
||||||
|
pkgs ? default_pkgs,
|
||||||
let
|
module,
|
||||||
|
}: let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
wrap = { wrapRc = true; };
|
wrap = {wrapRc = true;};
|
||||||
|
|
||||||
eval = lib.evalModules {
|
eval = lib.evalModules {
|
||||||
modules = (modules pkgs) ++ [ module wrap ];
|
modules = (modules pkgs) ++ [module wrap];
|
||||||
};
|
};
|
||||||
|
in
|
||||||
in eval.config.finalPackage
|
eval.config.finalPackage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue