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
|
@ -1,7 +1,9 @@
|
|||
(import (
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/c75e76f80c57784a6734356315b306140646ee84.tar.gz";
|
||||
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h"; }
|
||||
) {
|
||||
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h";
|
||||
}
|
||||
) {
|
||||
src = ./.;
|
||||
}).defaultNix
|
||||
})
|
||||
.defaultNix
|
||||
|
|
16
docs.nix
16
docs.nix
|
@ -1,8 +1,12 @@
|
|||
{ pkgs, lib, modules, ... }:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
modules,
|
||||
...
|
||||
}: let
|
||||
options = lib.evalModules {
|
||||
modules = modules;
|
||||
specialArgs = { inherit pkgs lib; };
|
||||
specialArgs = {inherit pkgs lib;};
|
||||
};
|
||||
docs = pkgs.nixosOptionsDoc {
|
||||
# If we don't do this, we end up with _module.args on the generated options, which we do not want
|
||||
|
@ -11,7 +15,7 @@ let
|
|||
};
|
||||
asciidoc = docs.optionsAsciiDoc;
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "nixvim-docs";
|
||||
|
||||
src = asciidoc;
|
||||
|
@ -19,7 +23,7 @@ pkgs.stdenv.mkDerivation {
|
|||
pkgs.asciidoctor
|
||||
];
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
phases = ["buildPhase"];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/share/doc
|
||||
|
@ -32,4 +36,4 @@ pkgs.stdenv.mkDerivation {
|
|||
cat header.adoc $src > tmp.adoc
|
||||
asciidoctor tmp.adoc -o $out/share/doc/index.html
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
programs.nixvim = {
|
||||
# This just enables NixVim.
|
||||
# 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
|
||||
active = {
|
||||
left = [
|
||||
[ "mode" "paste" ]
|
||||
[ "redaonly" "filename" "modified" "helloworld" ]
|
||||
["mode" "paste"]
|
||||
["redaonly" "filename" "modified" "helloworld"]
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -73,7 +72,7 @@
|
|||
|
||||
# What about plugins not available as a module?
|
||||
# Use extraPlugins:
|
||||
extraPlugins = with pkgs.vimPlugins; [ vim-toml ];
|
||||
extraPlugins = with pkgs.vimPlugins; [vim-toml];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
56
flake.nix
56
flake.nix
|
@ -6,43 +6,52 @@
|
|||
inputs.beautysh.url = "github:lovesegfault/beautysh";
|
||||
inputs.beautysh.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
} @ inputs:
|
||||
with nixpkgs.lib;
|
||||
with builtins;
|
||||
let
|
||||
with builtins; let
|
||||
# TODO: Support nesting
|
||||
nixvimModules = map (f: ./modules + "/${f}") (attrNames (builtins.readDir ./modules));
|
||||
|
||||
modules = pkgs: nixvimModules ++ [
|
||||
(rec {
|
||||
modules = pkgs:
|
||||
nixvimModules
|
||||
++ [
|
||||
rec {
|
||||
_file = ./flake.nix;
|
||||
key = _file;
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs = mkForce pkgs;
|
||||
inherit (pkgs) lib;
|
||||
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
|
||||
helpers = import ./plugins/helpers.nix {inherit (pkgs) lib;};
|
||||
inputs = inputs;
|
||||
};
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
# ./plugins/default.nix
|
||||
];
|
||||
|
||||
flakeOutput =
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
extractRustAnalyzer = { stdenv, pkgs }: stdenv.mkDerivation {
|
||||
(system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
extractRustAnalyzer = {
|
||||
stdenv,
|
||||
pkgs,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "extract_rust_analyzer";
|
||||
version = "master";
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
|
||||
buildInputs = [ pkgs.python3 ];
|
||||
buildInputs = [pkgs.python3];
|
||||
|
||||
installPhase = ''
|
||||
ls -la
|
||||
|
@ -50,15 +59,19 @@
|
|||
cp ${./helpers/extract_rust_analyzer.py} $out/bin/extract_rust_analyzer.py
|
||||
'';
|
||||
};
|
||||
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { };
|
||||
in
|
||||
{
|
||||
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer {};
|
||||
in {
|
||||
packages = {
|
||||
docs = pkgs.callPackage (import ./docs.nix) {
|
||||
modules = nixvimModules;
|
||||
};
|
||||
runUpdates = pkgs.callPackage
|
||||
({ pkgs, stdenv }: stdenv.mkDerivation {
|
||||
runUpdates =
|
||||
pkgs.callPackage
|
||||
({
|
||||
pkgs,
|
||||
stdenv,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "run-updates";
|
||||
version = pkgs.rust-analyzer.version;
|
||||
|
||||
|
@ -77,19 +90,22 @@
|
|||
cp rust-analyzer-config.nix $out/share
|
||||
'';
|
||||
})
|
||||
{ };
|
||||
{};
|
||||
};
|
||||
legacyPackages = rec {
|
||||
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
|
||||
makeNixvim = configuration: makeNixvimWithModule {
|
||||
makeNixvim = configuration:
|
||||
makeNixvimWithModule {
|
||||
module = {
|
||||
config = configuration;
|
||||
};
|
||||
};
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
});
|
||||
in
|
||||
flakeOutput // {
|
||||
flakeOutput
|
||||
// {
|
||||
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
|
||||
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
|
||||
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
||||
|
|
151
lib/helpers.nix
151
lib/helpers.nix
|
@ -1,48 +1,52 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
rec {
|
||||
{lib, ...}:
|
||||
with lib; rec {
|
||||
# vim dictionaries are, in theory, compatible with JSON
|
||||
toVimDict = args: toJSON
|
||||
toVimDict = args:
|
||||
toJSON
|
||||
(lib.filterAttrs (n: v: !isNull v) args);
|
||||
|
||||
# Black functional magic that converts a bunch of different Nix types to their
|
||||
# lua equivalents!
|
||||
toLuaObject = args:
|
||||
if builtins.isAttrs args then
|
||||
if hasAttr "__raw" args then
|
||||
args.__raw
|
||||
if builtins.isAttrs args
|
||||
then
|
||||
if hasAttr "__raw" args
|
||||
then args.__raw
|
||||
else
|
||||
"{" + (concatStringsSep ","
|
||||
"{"
|
||||
+ (concatStringsSep ","
|
||||
(mapAttrsToList
|
||||
(n: v:
|
||||
if head (stringToCharacters n) == "@" then
|
||||
toLuaObject v
|
||||
if head (stringToCharacters n) == "@"
|
||||
then toLuaObject v
|
||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args))) + "}"
|
||||
else if builtins.isList args then
|
||||
"{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args then
|
||||
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args)))
|
||||
+ "}"
|
||||
else if builtins.isList args
|
||||
then "{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args
|
||||
then
|
||||
# This should be enough!
|
||||
builtins.toJSON args
|
||||
else if builtins.isPath args then
|
||||
builtins.toJSON (toString args)
|
||||
else if builtins.isBool args then
|
||||
"${ boolToString args }"
|
||||
else if builtins.isFloat args then
|
||||
"${ toString args }"
|
||||
else if builtins.isInt args then
|
||||
"${ toString args }"
|
||||
else if isNull args then
|
||||
"nil"
|
||||
else if builtins.isPath args
|
||||
then builtins.toJSON (toString args)
|
||||
else if builtins.isBool args
|
||||
then "${boolToString args}"
|
||||
else if builtins.isFloat args
|
||||
then "${toString args}"
|
||||
else if builtins.isInt args
|
||||
then "${toString args}"
|
||||
else if isNull args
|
||||
then "nil"
|
||||
else "";
|
||||
|
||||
# Generates maps for a lua config
|
||||
genMaps = mode: maps:
|
||||
let
|
||||
normalized = builtins.mapAttrs
|
||||
genMaps = mode: maps: let
|
||||
normalized =
|
||||
builtins.mapAttrs
|
||||
(key: action:
|
||||
if builtins.isString action then
|
||||
{
|
||||
if builtins.isString action
|
||||
then {
|
||||
silent = false;
|
||||
expr = false;
|
||||
unique = false;
|
||||
|
@ -55,8 +59,7 @@ rec {
|
|||
maps;
|
||||
in
|
||||
builtins.attrValues (builtins.mapAttrs
|
||||
(key: action:
|
||||
{
|
||||
(key: action: {
|
||||
action = action.action;
|
||||
config = lib.filterAttrs (_: v: v) {
|
||||
inherit (action) silent expr unique noremap script nowait;
|
||||
|
@ -67,7 +70,8 @@ rec {
|
|||
normalized);
|
||||
|
||||
# Creates an option with a nullable type that defaults to null.
|
||||
mkNullOrOption = type: desc: lib.mkOption {
|
||||
mkNullOrOption = type: desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
|
@ -76,11 +80,14 @@ rec {
|
|||
mkIfNonNull = c: mkIf (!isNull c) c;
|
||||
|
||||
defaultNullOpts = rec {
|
||||
mkNullable = type: default: desc: mkNullOrOption type (
|
||||
mkNullable = type: default: desc:
|
||||
mkNullOrOption type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == "" then defaultDesc else ''
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
|
@ -88,45 +95,64 @@ rec {
|
|||
);
|
||||
|
||||
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}'';
|
||||
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
||||
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
||||
};
|
||||
|
||||
mkPackageOption = name: default: mkOption {
|
||||
mkPackageOption = name: default:
|
||||
mkOption {
|
||||
type = types.package;
|
||||
inherit default;
|
||||
description = "Plugin to use for ${name}";
|
||||
};
|
||||
|
||||
mkPlugin = { config, lib, ... }: { name
|
||||
, description
|
||||
, package ? null
|
||||
, extraPlugins ? [ ]
|
||||
, extraPackages ? [ ]
|
||||
, options ? { }
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
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'
|
||||
globals =
|
||||
mapAttrs'
|
||||
(name: opt: {
|
||||
name = opt.global;
|
||||
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
||||
value =
|
||||
if cfg.${name} != null
|
||||
then opt.value cfg.${name}
|
||||
else null;
|
||||
})
|
||||
options;
|
||||
# does this evaluate package?
|
||||
packageOption = if package == null then { } else {
|
||||
packageOption =
|
||||
if package == null
|
||||
then {}
|
||||
else {
|
||||
package = mkPackageOption name package;
|
||||
};
|
||||
in
|
||||
in {
|
||||
options.plugins.${name} =
|
||||
{
|
||||
options.plugins.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
} // packageOption // pluginOptions;
|
||||
}
|
||||
// packageOption
|
||||
// pluginOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
inherit extraPackages globals;
|
||||
|
@ -136,11 +162,24 @@ rec {
|
|||
};
|
||||
|
||||
globalVal = val:
|
||||
if builtins.isBool val then
|
||||
(if val == false then 0 else 1)
|
||||
if builtins.isBool val
|
||||
then
|
||||
(
|
||||
if val == false
|
||||
then 0
|
||||
else 1
|
||||
)
|
||||
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 {
|
||||
type = types.nullOr type;
|
||||
default = default;
|
||||
|
@ -153,7 +192,7 @@ rec {
|
|||
|
||||
extraOptionsOptions = {
|
||||
extraOptions = mkOption {
|
||||
default = { };
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = ''
|
||||
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: ''
|
||||
do
|
||||
|
|
|
@ -1,48 +1,47 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
|
||||
rec {
|
||||
{lib, ...}:
|
||||
with lib; rec {
|
||||
# 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
|
||||
mkDeprecatedOption =
|
||||
{ option # an array of the path to the option
|
||||
, alternative ? null
|
||||
, message ? null
|
||||
, visible ? false
|
||||
}:
|
||||
{ options, config, ... }:
|
||||
let
|
||||
mkDeprecatedOption = {
|
||||
option, # an array of the path to the option
|
||||
alternative ? null,
|
||||
message ? null,
|
||||
visible ? false,
|
||||
}: {
|
||||
options,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
fromOpt = getAttrFromPath option options;
|
||||
fromValue = getAttrFromPath option config;
|
||||
fullMessage = "The option `${showOption option}` has been deprecated, but might still work." +
|
||||
(optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.") +
|
||||
(optionalString (message != null) " Message: ${message}");
|
||||
in
|
||||
{
|
||||
fullMessage =
|
||||
"The option `${showOption option}` has been deprecated, but might still work."
|
||||
+ (optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.")
|
||||
+ (optionalString (message != null) " Message: ${message}");
|
||||
in {
|
||||
config = mkIf (fromOpt.isDefined && fromValue != fromOpt.default) {
|
||||
warnings = [
|
||||
("Nixvim: ${fullMessage}")
|
||||
"Nixvim: ${fullMessage}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkRenamedOption =
|
||||
{ option
|
||||
, newOption
|
||||
, visible ? false
|
||||
, warn ? true
|
||||
, overrideDescription ? null
|
||||
}:
|
||||
{ options, ... }:
|
||||
let
|
||||
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";
|
||||
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;
|
||||
|
@ -50,18 +49,20 @@ rec {
|
|||
if overrideDescription == null
|
||||
then message
|
||||
else overrideDescription;
|
||||
} // optionalAttrs (toType != null) {
|
||||
}
|
||||
// optionalAttrs (toType != null) {
|
||||
type = toType;
|
||||
});
|
||||
config = mkMerge [
|
||||
{
|
||||
warnings = mkIf (warn && fromOpt.isDefined) [ "Nixvim: ${message}" ];
|
||||
warnings = mkIf (warn && fromOpt.isDefined) ["Nixvim: ${message}"];
|
||||
}
|
||||
(mkAliasAndWrapDefinitions (setAttrByPath newOption) fromOpt)
|
||||
];
|
||||
};
|
||||
|
||||
mkAliasOption = option: newOption: mkRenamedOption {
|
||||
mkAliasOption = option: newOption:
|
||||
mkRenamedOption {
|
||||
inherit option newOption;
|
||||
visible = true;
|
||||
warn = false;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
|
||||
autoGroupOption = types.submodule {
|
||||
options = {
|
||||
|
@ -47,13 +50,11 @@ let
|
|||
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands.";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
autoGroups = mkOption {
|
||||
type = types.attrsOf autoGroupOption;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "augroup definitions";
|
||||
example = ''
|
||||
autoGroups = {
|
||||
|
@ -66,7 +67,7 @@ in
|
|||
|
||||
autoCmd = mkOption {
|
||||
type = types.listOf autoCmdOption;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "autocmd definitions";
|
||||
example = ''
|
||||
autoCmd = [
|
||||
|
@ -80,8 +81,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.autoGroups != { } || config.autoCmd != { }) {
|
||||
extraConfigLuaPost = (optionalString (config.autoGroups != { }) ''
|
||||
config = mkIf (config.autoGroups != {} || config.autoCmd != {}) {
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.autoGroups != {}) ''
|
||||
-- Set up autogroups {{
|
||||
do
|
||||
local __nixvim_autogroups = ${helpers.toLuaObject config.autoGroups}
|
||||
|
@ -91,8 +93,8 @@ in
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'') +
|
||||
(optionalString (config.autoCmd != [ ]) ''
|
||||
'')
|
||||
+ (optionalString (config.autoCmd != []) ''
|
||||
-- Set up autocommands {{
|
||||
do
|
||||
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options = {
|
||||
colorscheme = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Define highlight groups";
|
||||
example = ''
|
||||
highlight = {
|
||||
|
@ -18,7 +20,7 @@ with lib;
|
|||
|
||||
match = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Define match groups";
|
||||
example = ''
|
||||
match = {
|
||||
|
@ -28,8 +30,9 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.highlight != { } || config.match != { }) {
|
||||
extraConfigLuaPost = (optionalString (config.highlight != { }) ''
|
||||
config = mkIf (config.highlight != {} || config.match != {}) {
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.highlight != {}) ''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlight}
|
||||
|
@ -39,8 +42,8 @@ with lib;
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'') +
|
||||
(optionalString (config.match != { }) ''
|
||||
'')
|
||||
+ (optionalString (config.match != {}) ''
|
||||
-- Match groups {{
|
||||
do
|
||||
local match = ${helpers.toLuaObject config.match}
|
||||
|
@ -52,5 +55,4 @@ with lib;
|
|||
-- }}
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
|
||||
mapOption = types.oneOf [
|
||||
types.str
|
||||
|
@ -57,13 +60,13 @@ let
|
|||
})
|
||||
];
|
||||
|
||||
mapOptions = mode: mkOption {
|
||||
mapOptions = mode:
|
||||
mkOption {
|
||||
description = "Mappings for ${mode} mode";
|
||||
type = types.attrsOf mapOption;
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
maps = mkOption {
|
||||
type = types.submodule {
|
||||
|
@ -82,7 +85,7 @@ in
|
|||
command = mapOptions "command-line";
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
description = ''
|
||||
Custom keybindings for any mode.
|
||||
|
||||
|
@ -101,23 +104,21 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
mappings =
|
||||
(helpers.genMaps "" config.maps.normalVisualOp) ++
|
||||
(helpers.genMaps "n" config.maps.normal) ++
|
||||
(helpers.genMaps "i" config.maps.insert) ++
|
||||
(helpers.genMaps "v" config.maps.visual) ++
|
||||
(helpers.genMaps "x" config.maps.visualOnly) ++
|
||||
(helpers.genMaps "s" config.maps.select) ++
|
||||
(helpers.genMaps "t" config.maps.terminal) ++
|
||||
(helpers.genMaps "o" config.maps.operator) ++
|
||||
(helpers.genMaps "l" config.maps.lang) ++
|
||||
(helpers.genMaps "!" config.maps.insertCommand) ++
|
||||
(helpers.genMaps "c" config.maps.command);
|
||||
in
|
||||
{
|
||||
extraConfigLua = optionalString (mappings != [ ]) ''
|
||||
(helpers.genMaps "" config.maps.normalVisualOp)
|
||||
++ (helpers.genMaps "n" config.maps.normal)
|
||||
++ (helpers.genMaps "i" config.maps.insert)
|
||||
++ (helpers.genMaps "v" config.maps.visual)
|
||||
++ (helpers.genMaps "x" config.maps.visualOnly)
|
||||
++ (helpers.genMaps "s" config.maps.select)
|
||||
++ (helpers.genMaps "t" config.maps.terminal)
|
||||
++ (helpers.genMaps "o" config.maps.operator)
|
||||
++ (helpers.genMaps "l" config.maps.lang)
|
||||
++ (helpers.genMaps "!" config.maps.insertCommand)
|
||||
++ (helpers.genMaps "c" config.maps.command);
|
||||
in {
|
||||
extraConfigLua = optionalString (mappings != []) ''
|
||||
-- Set up keybinds {{{
|
||||
do
|
||||
local __nixvim_binds = ${helpers.toLuaObject mappings}
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
{ 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 = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "The configuration options, e.g. line numbers";
|
||||
};
|
||||
|
||||
globals = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Global variables";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
extraConfigLuaPre = optionalString (config.globals != { }) ''
|
||||
extraConfigLuaPre =
|
||||
optionalString (config.globals != {}) ''
|
||||
-- Set up globals {{{
|
||||
do
|
||||
local nixvim_globals = ${helpers.toLuaObject config.globals}
|
||||
|
@ -29,7 +32,8 @@ in
|
|||
end
|
||||
end
|
||||
-- }}}
|
||||
'' + optionalString (config.options != { }) ''
|
||||
''
|
||||
+ optionalString (config.options != {}) ''
|
||||
-- Set up options {{{
|
||||
do
|
||||
local nixvim_options = ${helpers.toLuaObject config.options}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
config = mkOption {
|
||||
|
@ -9,7 +13,9 @@ let
|
|||
default = "";
|
||||
};
|
||||
|
||||
optional = mkEnableOption "optional" // {
|
||||
optional =
|
||||
mkEnableOption "optional"
|
||||
// {
|
||||
description = "Don't load by default (load with :packadd)";
|
||||
};
|
||||
|
||||
|
@ -19,8 +25,7 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
viAlias = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -46,13 +51,13 @@ in
|
|||
|
||||
extraPlugins = mkOption {
|
||||
type = with types; listOf (either package pluginWithConfigType);
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "List of vim plugins to install";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "Extra packages to be made available to neovim";
|
||||
};
|
||||
|
||||
|
@ -74,7 +79,6 @@ in
|
|||
description = "Extra contents for init.lua after everything else";
|
||||
};
|
||||
|
||||
|
||||
extraConfigVim = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
@ -101,16 +105,21 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
|
||||
config = let
|
||||
defaultPlugin = {
|
||||
plugin = null;
|
||||
config = "";
|
||||
optional = false;
|
||||
};
|
||||
|
||||
normalizedPlugins = map (x: defaultPlugin // (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 ({
|
||||
inherit (config) viAlias vimAlias;
|
||||
|
@ -121,8 +130,12 @@ in
|
|||
# or more generally before the commit:
|
||||
# cda1f8ae468 - neovim: pass packpath via the wrapper
|
||||
// optionalAttrs (functionArgs pkgs.neovimUtils.makeNeovimConfig ? configure) {
|
||||
configure.packages =
|
||||
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
||||
configure.packages = {
|
||||
nixvim = {
|
||||
start = map (x: x.plugin) normalizedPlugins;
|
||||
opt = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
customRC =
|
||||
|
@ -130,34 +143,33 @@ in
|
|||
vim.cmd([[
|
||||
${neovimConfig.neovimRcContent}
|
||||
]])
|
||||
'' +
|
||||
(optionalString (config.extraConfigLuaPre != "") ''
|
||||
''
|
||||
+ (optionalString (config.extraConfigLuaPre != "") ''
|
||||
${config.extraConfigLuaPre}
|
||||
'') +
|
||||
(optionalString (config.extraConfigVim != "") ''
|
||||
'')
|
||||
+ (optionalString (config.extraConfigVim != "") ''
|
||||
vim.cmd([[
|
||||
${config.extraConfigVim}
|
||||
]])
|
||||
'') +
|
||||
(optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
'')
|
||||
+ (optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
'');
|
||||
|
||||
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||
(optional (config.extraPackages != [ ])
|
||||
(optional (config.extraPackages != [])
|
||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
||||
++
|
||||
(optional (config.wrapRc)
|
||||
++ (optional (config.wrapRc)
|
||||
''--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;
|
||||
wrapRc = false;
|
||||
});
|
||||
in
|
||||
{
|
||||
in {
|
||||
finalPackage = wrappedNeovim;
|
||||
initContent = customRC;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{ ... }:
|
||||
{
|
||||
{...}: {
|
||||
imports = [
|
||||
../plugins/default.nix
|
||||
];
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
|
||||
{
|
||||
{lib, ...}:
|
||||
with lib; {
|
||||
options = {
|
||||
warnings = mkOption {
|
||||
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 = {
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
|
||||
|
@ -65,17 +68,18 @@ in
|
|||
|
||||
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
||||
|
||||
|
||||
icons = {
|
||||
enable = helpers.defaultNullOpts.mkNullable
|
||||
(with types; (either bool (enum [ "numbers" "both" ])))
|
||||
enable =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; (either bool (enum ["numbers" "both"])))
|
||||
"true"
|
||||
''
|
||||
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
|
||||
'';
|
||||
|
||||
customColors = helpers.defaultNullOpts.mkNullable
|
||||
customColors =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.either types.bool types.str)
|
||||
"false"
|
||||
''
|
||||
|
@ -122,7 +126,6 @@ in
|
|||
But only a static string is accepted here.
|
||||
'';
|
||||
|
||||
|
||||
# Keybinds concept:
|
||||
# keys = {
|
||||
# previousBuffer = mkBindDef "normal" "Previous buffer" { action = ":BufferPrevious<CR>"; silent = true; } "<A-,>";
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
{ config, pkgs, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.plugins.bufferline;
|
||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||
helpers = import ../helpers.nix args;
|
||||
|
||||
highlight = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
guifg = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
|
@ -20,14 +24,13 @@ let
|
|||
};
|
||||
};
|
||||
}));
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
(optionWarnings.mkDeprecatedOption {
|
||||
option = [ "plugins" "bufferline" "indicatorIcon" ];
|
||||
alternative = [ "plugins" "bufferline" "indicator" "icon" ];
|
||||
option = ["plugins" "bufferline" "indicatorIcon"];
|
||||
alternative = ["plugins" "bufferline" "indicator" "icon"];
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -111,7 +114,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
diagnostics = mkOption {
|
||||
type = types.nullOr (types.enum [ false "nvim_lsp" "coc" ]);
|
||||
type = types.nullOr (types.enum [false "nvim_lsp" "coc"]);
|
||||
default = null;
|
||||
};
|
||||
diagnosticsUpdateInInsert = mkOption {
|
||||
|
@ -147,7 +150,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
separatorStyle = mkOption {
|
||||
type = types.nullOr (types.enum [ "slant" "thick" "thin" ]);
|
||||
type = types.nullOr (types.enum ["slant" "thick" "thin"]);
|
||||
default = null;
|
||||
};
|
||||
enforceRegularTabs = mkOption {
|
||||
|
@ -159,27 +162,27 @@ in
|
|||
default = null;
|
||||
};
|
||||
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;
|
||||
};
|
||||
indicator = mkOption {
|
||||
default = { };
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
default = {};
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
icon = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
style = mkOption {
|
||||
type = types.nullOr (types.enum [ "icon" "underline" "none" ]);
|
||||
type = types.nullOr (types.enum ["icon" "underline" "none"]);
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
highlights = mkOption {
|
||||
default = { };
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
default = {};
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
fill = highlight;
|
||||
background = highlight;
|
||||
|
@ -246,16 +249,16 @@ in
|
|||
|
||||
extraOptions = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Extra options, will override others if defined";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = {
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
numbers = cfg.numbers;
|
||||
close_command = cfg.closeCommand;
|
||||
right_mouse_command = cfg.rightMouseCommand;
|
||||
|
@ -264,10 +267,13 @@ in
|
|||
# deprecated, but might still work
|
||||
indicator_icon = cfg.indicatorIcon;
|
||||
indicator =
|
||||
if cfg.indicator != null then with cfg.indicator; {
|
||||
if cfg.indicator != null
|
||||
then
|
||||
with cfg.indicator; {
|
||||
icon = icon;
|
||||
style = style;
|
||||
} else null;
|
||||
}
|
||||
else null;
|
||||
buffer_close_icon = cfg.bufferCloseIcon;
|
||||
modified_icon = cfg.modifiedIcon;
|
||||
close_icon = cfg.closeIcon;
|
||||
|
@ -290,8 +296,13 @@ in
|
|||
enforce_regular_tabs = cfg.enforceRegularTabs;
|
||||
always_show_bufferline = cfg.alwaysShowBufferline;
|
||||
sort_by = cfg.sortBy;
|
||||
} // cfg.extraOptions;
|
||||
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
highlights =
|
||||
if builtins.isNull cfg.highlights
|
||||
then null
|
||||
else
|
||||
with cfg.highlights; {
|
||||
fill = fill;
|
||||
background = background;
|
||||
|
||||
|
@ -350,7 +361,6 @@ in
|
|||
pick = pick;
|
||||
pick_visible = pickVisible;
|
||||
pick_selected = pickSelected;
|
||||
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -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 = {
|
||||
colorschemes.base16 = {
|
||||
enable = mkEnableOption "base16";
|
||||
|
@ -34,7 +37,7 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "base16-${cfg.colorscheme}";
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
plugins.airline.theme = mkIf (cfg.setUpBar) "base16";
|
||||
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 = {
|
||||
colorschemes.gruvbox = {
|
||||
enable = mkEnableOption "gruvbox";
|
||||
|
@ -18,13 +21,13 @@ in
|
|||
undercurl = mkEnableOption "undercurled text";
|
||||
|
||||
contrastDark = mkOption {
|
||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
||||
type = types.nullOr (types.enum ["soft" "medium" "hard"]);
|
||||
default = null;
|
||||
description = "Contrast for the dark mode";
|
||||
};
|
||||
|
||||
contrastLight = mkOption {
|
||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
||||
type = types.nullOr (types.enum ["soft" "medium" "hard"]);
|
||||
default = null;
|
||||
description = "Contrast for the light mode";
|
||||
};
|
||||
|
@ -110,13 +113,12 @@ in
|
|||
transparentBg = mkEnableOption "transparent background";
|
||||
|
||||
trueColor = mkEnableOption "true color support";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "gruvbox";
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
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 = {
|
||||
colorschemes.nord = {
|
||||
enable = mkEnableOption "nord";
|
||||
|
||||
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";
|
||||
|
||||
borders = mkEnableOption
|
||||
borders =
|
||||
mkEnableOption
|
||||
"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";
|
||||
|
||||
cursorline_transparent = mkEnableOption
|
||||
cursorline_transparent =
|
||||
mkEnableOption
|
||||
"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";
|
||||
|
||||
italic = mkOption {
|
||||
|
@ -36,7 +44,7 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "nord";
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
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 = {
|
||||
colorschemes.one = {
|
||||
enable = mkEnableOption "vim-one";
|
||||
|
@ -15,7 +18,7 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "one";
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
options = {
|
||||
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 = {
|
||||
colorschemes.onedark = {
|
||||
enable = mkEnableOption "onedark";
|
||||
|
@ -15,7 +18,7 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "onedark";
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
options = {
|
||||
termguicolors = true;
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}@args:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.tokyonight;
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.tokyonight = {
|
||||
enable = mkEnableOption "tokyonight";
|
||||
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 =
|
||||
helpers.defaultNullOpts.mkBool true
|
||||
"Configure the colors used when opening a :terminal in Neovim";
|
||||
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
||||
styles =
|
||||
let
|
||||
styles = let
|
||||
mkBackgroundStyle = name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "dark" "transparent" "normal" ]
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
|
||||
"Background style for ${name}";
|
||||
in
|
||||
{
|
||||
in {
|
||||
comments =
|
||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||
"Define comments highlight properties";
|
||||
|
@ -56,10 +54,9 @@ in
|
|||
};
|
||||
config = mkIf cfg.enable {
|
||||
colorscheme = "tokyonight";
|
||||
extraPlugins = [ cfg.package ];
|
||||
options = { termguicolors = true; };
|
||||
extraConfigLuaPre =
|
||||
let
|
||||
extraPlugins = [cfg.package];
|
||||
options = {termguicolors = true;};
|
||||
extraConfigLuaPre = let
|
||||
setupOptions = with cfg; {
|
||||
inherit (cfg) style transparent styles sidebars;
|
||||
terminal_colors = terminalColors;
|
||||
|
@ -68,8 +65,7 @@ in
|
|||
lualine_bold = lualineBold;
|
||||
day_brightness = dayBrightness;
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
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 = {
|
||||
plugins.copilot = {
|
||||
enable = mkEnableOption "copilot";
|
||||
|
@ -12,8 +15,8 @@ in
|
|||
filetypes = mkOption {
|
||||
type = types.attrsOf types.bool;
|
||||
description = "A dictionary mapping file types to their enabled status";
|
||||
default = { };
|
||||
example = literalExpression ''{
|
||||
default = {};
|
||||
example = literalExpression '' {
|
||||
"*": false,
|
||||
python: true
|
||||
}'';
|
||||
|
@ -27,12 +30,17 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
globals = {
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
globals =
|
||||
{
|
||||
copilot_node_command = "${pkgs.nodejs-16_x}/bin/node";
|
||||
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 = {
|
||||
plugins.coq-nvim = {
|
||||
enable = mkEnableOption "coq-nvim";
|
||||
|
@ -16,7 +18,7 @@ in
|
|||
installArtifacts = mkEnableOption "Install coq-artifacts";
|
||||
|
||||
autoStart = mkOption {
|
||||
type = with types; nullOr (oneOf [ bool (enum [ "shut-up" ]) ]);
|
||||
type = with types; nullOr (oneOf [bool (enum ["shut-up"])]);
|
||||
default = null;
|
||||
description = "Auto-start or shut up";
|
||||
};
|
||||
|
@ -28,23 +30,24 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
settings = {
|
||||
auto_start = cfg.autoStart;
|
||||
"keymap.recommended" = cfg.recommendedKeymaps;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [
|
||||
extraPlugins =
|
||||
[
|
||||
cfg.package
|
||||
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
|
||||
]
|
||||
++ optional cfg.installArtifacts plugins.coq-artifacts;
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
vim.g.coq_settings = ${helpers.toLuaObject settings}
|
||||
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 = {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
|
||||
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;
|
||||
description = "Defines how annotations are shown";
|
||||
};
|
||||
|
||||
preset = mkOption {
|
||||
type = with types; nullOr (enum [ "default" "codicons" ]);
|
||||
type = with types; nullOr (enum ["default" "codicons"]);
|
||||
default = null;
|
||||
description = "Default symbol map";
|
||||
};
|
||||
|
@ -61,34 +64,41 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
mode = cfg.mode;
|
||||
preset = cfg.preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
} // (if doCmp then {
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
menu = cfg.cmp.menu;
|
||||
} else { });
|
||||
}
|
||||
else {}
|
||||
);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = optionalString (!doCmp) ''
|
||||
require('lspkind').init(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
||||
plugins.nvim-cmp.formatting.format =
|
||||
if cfg.cmp.after != null then ''
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
'' else ''
|
||||
''
|
||||
else ''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
{
|
||||
mkCmpSourcePlugin = { name, extraPlugins ? [], useDefaultPackage ? true, ... }: mkPlugin attrs {
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ 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}";
|
||||
|
@ -51,4 +61,4 @@ in with helpers; with lib;
|
|||
"treesitter" = "cmp-treesitter";
|
||||
"vimwiki-tags" = "cmp-vimwiki-tags";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-cmp;
|
||||
helpers = import ../../helpers.nix { inherit lib; };
|
||||
helpers = import ../../helpers.nix {inherit lib;};
|
||||
mkNullOrOption = helpers.mkNullOrOption;
|
||||
cmpLib = import ./cmp-helpers.nix args;
|
||||
# functionName should be a string
|
||||
# parameters should be a list of strings
|
||||
wrapWithFunction = functionName: parameters:
|
||||
let
|
||||
wrapWithFunction = functionName: parameters: let
|
||||
parameterString = strings.concatStringsSep "," parameters;
|
||||
in
|
||||
''${functionName}(${parameterString})'';
|
||||
in
|
||||
{
|
||||
in ''${functionName}(${parameterString})'';
|
||||
in {
|
||||
options.plugins.nvim-cmp = {
|
||||
enable = mkEnableOption "nvim-cmp";
|
||||
|
||||
|
@ -21,7 +22,7 @@ in
|
|||
|
||||
performance = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
debounce = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
|
@ -36,14 +37,14 @@ in
|
|||
};
|
||||
|
||||
preselect = mkOption {
|
||||
type = types.nullOr (types.enum [ "Item" "None" ]);
|
||||
type = types.nullOr (types.enum ["Item" "None"]);
|
||||
default = null;
|
||||
example = ''"Item"'';
|
||||
};
|
||||
|
||||
snippet = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
expand = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
|
@ -61,7 +62,7 @@ in
|
|||
};
|
||||
|
||||
mappingPresets = mkOption {
|
||||
default = [ ];
|
||||
default = [];
|
||||
type = types.listOf (types.enum [
|
||||
"insert"
|
||||
"cmdline"
|
||||
|
@ -75,7 +76,7 @@ in
|
|||
|
||||
mapping = mkOption {
|
||||
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 = {
|
||||
action = mkOption {
|
||||
type = types.nonEmptyStr;
|
||||
|
@ -116,7 +117,7 @@ in
|
|||
|
||||
completion = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
keyword_length = mkOption {
|
||||
default = null;
|
||||
|
@ -145,7 +146,7 @@ in
|
|||
|
||||
confirmation = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
get_commit_characters = mkOption {
|
||||
default = null;
|
||||
|
@ -158,7 +159,7 @@ in
|
|||
|
||||
formatting = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
fields = mkOption {
|
||||
default = null;
|
||||
|
@ -176,7 +177,7 @@ in
|
|||
|
||||
matching = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
disallow_fuzzy_matching = mkOption {
|
||||
default = null;
|
||||
|
@ -196,7 +197,7 @@ in
|
|||
|
||||
sorting = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
priority_weight = mkOption {
|
||||
default = null;
|
||||
|
@ -218,9 +219,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
sources =
|
||||
let
|
||||
source_config = types.submodule ({ ... }: {
|
||||
sources = let
|
||||
source_config = types.submodule ({...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
|
@ -286,7 +286,7 @@ in
|
|||
|
||||
view = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
entries = mkOption {
|
||||
default = null;
|
||||
|
@ -296,8 +296,7 @@ in
|
|||
}));
|
||||
};
|
||||
|
||||
window =
|
||||
let
|
||||
window = let
|
||||
# Reusable options
|
||||
border = with types; mkNullOrOption (either str (listOf str)) null;
|
||||
winhighlight = mkNullOrOption types.str null;
|
||||
|
@ -305,11 +304,11 @@ in
|
|||
in
|
||||
mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
completion = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
inherit border winhighlight zindex;
|
||||
col_offset = mkNullOrOption types.int "Offsets the completion window relative to the cursor";
|
||||
|
@ -320,7 +319,7 @@ in
|
|||
|
||||
documentation = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
inherit border winhighlight zindex;
|
||||
max_width = mkNullOrOption types.int "Window's max width";
|
||||
|
@ -336,58 +335,89 @@ in
|
|||
experimental = mkNullOrOption types.attrs "Experimental features";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
enabled = cfg.enable;
|
||||
performance = cfg.performance;
|
||||
preselect = if (isNull cfg.preselect) then null else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
||||
preselect =
|
||||
if (isNull cfg.preselect)
|
||||
then null
|
||||
else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
||||
|
||||
# Not very readable sorry
|
||||
# If null then null
|
||||
# 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.
|
||||
mapping =
|
||||
let
|
||||
mapping = let
|
||||
mappings =
|
||||
if (isNull cfg.mapping) then null
|
||||
if (isNull cfg.mapping)
|
||||
then null
|
||||
else
|
||||
mapAttrs
|
||||
(bind: mapping: helpers.mkRaw (if isString mapping then mapping
|
||||
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"))
|
||||
(bind: mapping:
|
||||
helpers.mkRaw (
|
||||
if isString mapping
|
||||
then mapping
|
||||
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"
|
||||
))
|
||||
cfg.mapping;
|
||||
luaMappings = (helpers.toLuaObject mappings);
|
||||
luaMappings = helpers.toLuaObject mappings;
|
||||
wrapped = lists.fold (presetName: prevString: ''cmp.mapping.preset.${presetName}(${prevString})'') luaMappings cfg.mappingPresets;
|
||||
in
|
||||
helpers.mkRaw wrapped;
|
||||
|
||||
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_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;
|
||||
};
|
||||
|
||||
confirmation = if (isNull cfg.confirmation) then null else {
|
||||
confirmation =
|
||||
if (isNull cfg.confirmation)
|
||||
then null
|
||||
else {
|
||||
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;
|
||||
};
|
||||
|
||||
formatting = if (isNull cfg.formatting) then null else {
|
||||
formatting =
|
||||
if (isNull cfg.formatting)
|
||||
then null
|
||||
else {
|
||||
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;
|
||||
|
||||
sorting = if (isNull cfg.sorting) then null else {
|
||||
sorting =
|
||||
if (isNull cfg.sorting)
|
||||
then null
|
||||
else {
|
||||
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;
|
||||
|
@ -397,7 +427,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = helpers.wrapDo ''
|
||||
local cmp = require('cmp')
|
||||
|
@ -406,9 +436,11 @@ in
|
|||
|
||||
# If auto_enable_sources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins =
|
||||
let
|
||||
flattened_sources = if (isNull cfg.sources) then [ ] else flatten cfg.sources;
|
||||
plugins = let
|
||||
flattened_sources =
|
||||
if (isNull cfg.sources)
|
||||
then []
|
||||
else flatten cfg.sources;
|
||||
# Take only the names from the sources provided by the user
|
||||
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
|
||||
# A list of known source names
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs:
|
||||
with lib; let
|
||||
cmpLib = import ../cmp-helpers.nix attrs;
|
||||
cmpSourcesPluginNames = lib.attrValues cmpLib.pluginAndSourceNames;
|
||||
pluginModules = lists.map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
|
||||
in
|
||||
{
|
||||
pluginModules = lists.map (name: cmpLib.mkCmpSourcePlugin {inherit name;}) cmpSourcesPluginNames;
|
||||
in {
|
||||
# For extra cmp plugins
|
||||
imports = [
|
||||
] ++ pluginModules;
|
||||
imports =
|
||||
[
|
||||
]
|
||||
++ pluginModules;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "fugitive";
|
||||
description = "Enable vim-fugitive";
|
||||
package = pkgs.vimPlugins.vim-fugitive;
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraPackages = [pkgs.git];
|
||||
|
||||
# In typical tpope fashin, this plugin has no config 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 = {
|
||||
plugins.gitgutter = {
|
||||
enable = mkEnableOption "gitgutter";
|
||||
|
@ -54,9 +57,9 @@ in
|
|||
};
|
||||
|
||||
signs = mkOption {
|
||||
type =
|
||||
let
|
||||
signOption = desc: mkOption {
|
||||
type = let
|
||||
signOption = desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Sign for ${desc}";
|
||||
|
@ -73,7 +76,7 @@ in
|
|||
modifiedRemoved = signOption "modified and removed lines";
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Custom signs for the sign column";
|
||||
};
|
||||
|
||||
|
@ -166,20 +169,25 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
|
||||
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
|
||||
config = let
|
||||
grepPackage =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then [cfg.grep.package]
|
||||
else [];
|
||||
grepCommand =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then cfg.grep.command
|
||||
else cfg.grep;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
options = mkIf cfg.recommendedSettings {
|
||||
updatetime = 100;
|
||||
foldtext = "gitgutter#fold#foldtext";
|
||||
};
|
||||
|
||||
extraPackages = [ pkgs.git ] ++ grepPackage;
|
||||
extraPackages = [pkgs.git] ++ grepPackage;
|
||||
|
||||
globals = {
|
||||
gitgutter_max_signs = mkIf (!isNull cfg.maxSigns) cfg.maxSigns;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.gitmessenger = {
|
||||
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
|
||||
shown up.
|
||||
'';
|
||||
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault [ "none" "current" "all" ] ''
|
||||
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "current" "all"] ''
|
||||
When this value is not set to "none", a popup window includes diff hunks of the commit at
|
||||
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
|
||||
all diff hunks in the commit.
|
||||
|
@ -91,12 +91,11 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.gitmessenger;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
globals = {
|
||||
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
|
||||
git_messenger_include_diff = cfg.includeDiff;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
|
@ -33,8 +34,7 @@ with lib; let
|
|||
description = "Lua function definition";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.gitsigns = {
|
||||
enable = mkEnableOption "Enable gitsigns plugin";
|
||||
package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim;
|
||||
|
@ -76,8 +76,7 @@ in
|
|||
linehl = "GitSignsAddLn";
|
||||
};
|
||||
};
|
||||
worktrees =
|
||||
let
|
||||
worktrees = let
|
||||
worktreeModule = {
|
||||
options = {
|
||||
toplevel = mkOption {
|
||||
|
@ -164,12 +163,11 @@ in
|
|||
|
||||
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||
'';
|
||||
diffOpts =
|
||||
let
|
||||
diffOpts = let
|
||||
diffOptModule = {
|
||||
options = {
|
||||
algorithm =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "myers" "minimal" "patience" "histogram" ]
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["myers" "minimal" "patience" "histogram"]
|
||||
"Diff algorithm to use";
|
||||
internal =
|
||||
helpers.defaultNullOpts.mkBool false
|
||||
|
@ -268,7 +266,7 @@ in
|
|||
helpers.defaultNullOpts.mkBool true
|
||||
"Whether to show a virtual text blame annotation";
|
||||
virtTextPos =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault [ "eol" "overlay" "right_align" ]
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["eol" "overlay" "right_align"]
|
||||
"Blame annotation position";
|
||||
delay =
|
||||
helpers.defaultNullOpts.mkInt 1000
|
||||
|
@ -316,26 +314,24 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.gitsigns;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua =
|
||||
let
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = let
|
||||
luaFnOrStrToObj = val:
|
||||
if val == null
|
||||
then null
|
||||
else if builtins.isString val
|
||||
then val
|
||||
else { __raw = val.function; };
|
||||
else {__raw = val.function;};
|
||||
setupOptions = {
|
||||
inherit (cfg) worktrees signcolumn numhl linehl trouble yadm;
|
||||
signs = mapAttrs (_: signSetupOptions) cfg.signs;
|
||||
on_attach =
|
||||
if cfg.onAttach != null
|
||||
then { __raw = cfg.onAttach.function; }
|
||||
then {__raw = cfg.onAttach.function;}
|
||||
else null;
|
||||
watch_gitdir = {
|
||||
inherit (cfg.watchGitDir) enable interval;
|
||||
|
@ -350,8 +346,7 @@ in
|
|||
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||
};
|
||||
count_chars =
|
||||
let
|
||||
count_chars = let
|
||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||
in
|
||||
if cfg.countChars != null
|
||||
|
@ -373,18 +368,16 @@ in
|
|||
else null;
|
||||
status_formatter =
|
||||
if cfg.statusFormatter != null
|
||||
then { __raw = cfg.statusFormatter.function; }
|
||||
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
|
||||
current_line_blame_opts = let
|
||||
cfgCl = cfg.currentLineBlameOpts;
|
||||
in
|
||||
{
|
||||
in {
|
||||
inherit (cfgCl) delay;
|
||||
virt_text = cfgCl.virtText;
|
||||
virt_text_pos = cfgCl.virtTextPos;
|
||||
|
@ -396,8 +389,7 @@ in
|
|||
word_diff = cfg.wordDiff;
|
||||
debug_mode = cfg.debugMode;
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.neogit;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
sectionDefaultsModule = types.submodule {
|
||||
options = {
|
||||
|
@ -12,8 +16,7 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.neogit = {
|
||||
enable = mkEnableOption "neogit";
|
||||
|
@ -72,7 +75,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
kind = mkOption {
|
||||
|
@ -104,7 +107,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
integrations = mkOption {
|
||||
|
@ -118,7 +121,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
sections = mkOption {
|
||||
|
@ -162,7 +165,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
mappings = mkOption {
|
||||
|
@ -198,14 +201,14 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; helpers.toLuaObject {
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
helpers.toLuaObject {
|
||||
inherit kind integrations signs sections mappings;
|
||||
disable_signs = disableSigns;
|
||||
disable_hint = disableHint;
|
||||
|
@ -218,12 +221,14 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
cfg.package
|
||||
plenary-nvim
|
||||
] ++ optional cfg.integrations.diffview diffview-nvim;
|
||||
]
|
||||
++ optional cfg.integrations.diffview diffview-nvim;
|
||||
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraPackages = [pkgs.git];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('neogit').setup(${setupOptions})
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
{ pkgs, lib, ... }@args:
|
||||
with lib; with import ../helpers.nix { inherit lib; };
|
||||
mkPlugin args {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib;
|
||||
with import ../helpers.nix {inherit lib;};
|
||||
mkPlugin args {
|
||||
name = "ledger";
|
||||
description = "Enable ledger language features";
|
||||
package = pkgs.vimPlugins.vim-ledger;
|
||||
|
@ -30,4 +35,4 @@ mkPlugin args {
|
|||
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 = {
|
||||
plugins.markdown-preview = {
|
||||
enable = mkEnableOption "markdown-preview";
|
||||
|
@ -54,7 +57,7 @@ in
|
|||
uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options";
|
||||
maid = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "mermaid options";
|
||||
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:
|
||||
- "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.
|
||||
|
@ -86,18 +89,17 @@ in
|
|||
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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
previewOptions = mapAttrs (name: value: cfg.previewOptions.${name}) cfg.previewOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart;
|
||||
|
@ -109,7 +111,7 @@ in
|
|||
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser;
|
||||
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl;
|
||||
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_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss;
|
||||
mkdp_port = mkIf (!isNull cfg.port) cfg.port;
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
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
|
||||
options = {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.plantuml-syntax = {
|
||||
enable = mkEnableOption "plantuml syntax support";
|
||||
|
@ -24,12 +24,11 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.plantuml-syntax;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
plantuml_set_makeprg = cfg.setMakeprg;
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.rust-tools =
|
||||
let
|
||||
mkNullableOptionWithDefault =
|
||||
{ type
|
||||
, description
|
||||
, default
|
||||
,
|
||||
options.plugins.rust-tools = let
|
||||
mkNullableOptionWithDefault = {
|
||||
type,
|
||||
description,
|
||||
default,
|
||||
}:
|
||||
mkOption {
|
||||
type = types.nullOr type;
|
||||
|
@ -45,8 +43,7 @@ in {
|
|||
type = types.int;
|
||||
default = toString default;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable = mkEnableOption "rust tools plugins";
|
||||
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
|
||||
serverPackage = mkOption {
|
||||
|
@ -56,7 +53,7 @@ in {
|
|||
};
|
||||
|
||||
executor = mkNullableOptionWithDefault {
|
||||
type = types.enum [ "termopen" "quickfix" ];
|
||||
type = types.enum ["termopen" "quickfix"];
|
||||
default = ''"termopen"'';
|
||||
description = "how to execute terminal commands";
|
||||
};
|
||||
|
@ -157,34 +154,30 @@ in {
|
|||
}
|
||||
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.rust-tools;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [ nvim-lspconfig cfg.package ];
|
||||
extraPackages = [ cfg.serverPackage ];
|
||||
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
|
||||
extraPackages = [cfg.serverPackage];
|
||||
|
||||
plugins.lsp.postConfig =
|
||||
let
|
||||
plugins.lsp.postConfig = let
|
||||
setupOptions = {
|
||||
tools = {
|
||||
executor =
|
||||
if cfg.executor != null
|
||||
then { __raw = ''require("rust-tools.executors").${cfg.executor}''; }
|
||||
then {__raw = ''require("rust-tools.executors").${cfg.executor}'';}
|
||||
else null;
|
||||
|
||||
on_initialized =
|
||||
if cfg.onIntialized != null
|
||||
then { __raw = cfg.onIntialized; }
|
||||
then {__raw = cfg.onIntialized;}
|
||||
else null;
|
||||
|
||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||
inlay_hints =
|
||||
let
|
||||
inlay_hints = let
|
||||
cfgIH = cfg.inlayHints;
|
||||
in
|
||||
{
|
||||
in {
|
||||
auto = cfgIH.auto;
|
||||
only_current_line = cfgIH.onlyCurrentLine;
|
||||
show_parameter_hints = cfgIH.showParameterHints;
|
||||
|
@ -197,22 +190,18 @@ in {
|
|||
highlight = cfgIH.highlight;
|
||||
};
|
||||
|
||||
hover_actions =
|
||||
let
|
||||
hover_actions = let
|
||||
cfgHA = cfg.hoverActions;
|
||||
in
|
||||
{
|
||||
in {
|
||||
border = cfgHA.border;
|
||||
max_width = cfgHA.maxWidth;
|
||||
max_height = cfgHA.maxHeight;
|
||||
auto_focus = cfgHA.autoFocus;
|
||||
};
|
||||
|
||||
crate_graph =
|
||||
let
|
||||
crate_graph = let
|
||||
cfgCG = cfg.crateGraph;
|
||||
in
|
||||
{
|
||||
in {
|
||||
backend = cfgCG.backend;
|
||||
output = cfgCG.output;
|
||||
full = cfgCG.full;
|
||||
|
@ -222,11 +211,10 @@ in {
|
|||
server = {
|
||||
standalone = cfg.server.standalone;
|
||||
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
||||
on_attach = { __raw = "__lspOnAttach"; };
|
||||
on_attach = {__raw = "__lspOnAttach";};
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.plugins.tagbar;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.tagbar;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
options.plugins.tagbar = {
|
||||
|
||||
enable = mkEnableOption "tagbar";
|
||||
|
||||
package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar;
|
||||
|
@ -25,11 +23,10 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraPackages = [ pkgs.ctags ];
|
||||
extraPackages = [pkgs.ctags];
|
||||
|
||||
globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.treesitter-context = {
|
||||
enable = mkEnableOption "nvim-treesitter-context";
|
||||
|
@ -19,7 +19,7 @@ in {
|
|||
};
|
||||
|
||||
trimScope = mkOption {
|
||||
type = types.enum [ "outer" "inner" ];
|
||||
type = types.enum ["outer" "inner"];
|
||||
default = "outer";
|
||||
description = "Which context lines to discard if `max_lines` is exceeded";
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ in {
|
|||
|
||||
patterns = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
default = { };
|
||||
default = {};
|
||||
description = ''
|
||||
Patterns to use for context delimitation. The 'default' key matches all filetypes
|
||||
'';
|
||||
|
@ -40,17 +40,16 @@ in {
|
|||
|
||||
exactPatterns = mkOption {
|
||||
type = types.attrsOf types.bool;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Treat the coresponding entry in patterns as an exact match";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.treesitter-context;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
plugins.treesitter.moduleConfig.context = {
|
||||
max_lines = cfg.maxLines;
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.plugins.treesitter-refactor =
|
||||
let
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.treesitter-refactor = let
|
||||
disable = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "List of languages to disable the module on";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable =
|
||||
mkEnableOption
|
||||
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||
|
@ -103,12 +100,11 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.treesitter-refactor;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
plugins.treesitter.moduleConfig.refactor = {
|
||||
highlight_definitions = {
|
||||
|
@ -118,15 +114,13 @@ in
|
|||
highlight_current_scope = cfg.highlightCurrentScope;
|
||||
smart_rename = {
|
||||
inherit (cfg.smartRename) enable disable;
|
||||
keymaps = { smart_rename = cfg.smartRename.keymaps.smartRename; };
|
||||
keymaps = {smart_rename = cfg.smartRename.keymaps.smartRename;};
|
||||
};
|
||||
navigation = {
|
||||
inherit (cfg.navigation) enable disable;
|
||||
keymaps =
|
||||
let
|
||||
keymaps = let
|
||||
cfgK = cfg.navigation.keymaps;
|
||||
in
|
||||
{
|
||||
in {
|
||||
goto_definition = cfgK.gotoDefinition;
|
||||
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
||||
list_definitions = cfgK.listDefinitons;
|
||||
|
|
|
@ -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 = {
|
||||
plugins.treesitter = {
|
||||
enable = mkEnableOption "tree-sitter syntax highlighting";
|
||||
|
@ -22,7 +25,7 @@ in
|
|||
};
|
||||
|
||||
ensureInstalled = mkOption {
|
||||
type = with types; oneOf [ (enum [ "all" ]) (listOf str) ];
|
||||
type = with types; oneOf [(enum ["all"]) (listOf str)];
|
||||
default = "all";
|
||||
description = "Either \"all\" or a list of languages";
|
||||
};
|
||||
|
@ -32,8 +35,7 @@ in
|
|||
default =
|
||||
if cfg.nixGrammars
|
||||
then null
|
||||
else "$XDG_DATA_HOME/nvim/treesitter"
|
||||
;
|
||||
else "$XDG_DATA_HOME/nvim/treesitter";
|
||||
description = ''
|
||||
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!
|
||||
|
@ -42,30 +44,29 @@ in
|
|||
|
||||
ignoreInstall = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "List of parsers to ignore installing (for \"all\")";
|
||||
};
|
||||
|
||||
disabledLanguages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "A list of languages to disable";
|
||||
};
|
||||
|
||||
customCaptures = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "Custom capture group highlighting";
|
||||
};
|
||||
|
||||
incrementalSelection =
|
||||
let
|
||||
keymap = default: mkOption {
|
||||
incrementalSelection = let
|
||||
keymap = default:
|
||||
mkOption {
|
||||
type = types.str;
|
||||
inherit default;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
||||
keymaps = {
|
||||
initSelection = keymap "gnn";
|
||||
|
@ -87,24 +88,31 @@ in
|
|||
|
||||
moduleConfig = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "This is the configuration for extra modules. It should not be used directly";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
tsOptions = {
|
||||
config = let
|
||||
tsOptions =
|
||||
{
|
||||
highlight = {
|
||||
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 =
|
||||
if cfg.incrementalSelection.enable then {
|
||||
if cfg.incrementalSelection.enable
|
||||
then {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
init_selection = cfg.incrementalSelection.keymaps.initSelection;
|
||||
|
@ -112,29 +120,39 @@ in
|
|||
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
|
||||
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
|
||||
};
|
||||
} else null;
|
||||
}
|
||||
else null;
|
||||
|
||||
indent =
|
||||
if cfg.indent then {
|
||||
if cfg.indent
|
||||
then {
|
||||
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;
|
||||
parser_install_dir = cfg.parserInstallDir;
|
||||
} // cfg.moduleConfig;
|
||||
}
|
||||
// cfg.moduleConfig;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraConfigLua = (optionalString (cfg.parserInstallDir != null) ''
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.parserInstallDir != null) ''
|
||||
vim.opt.runtimepath:append("${cfg.parserInstallDir}")
|
||||
'') + ''
|
||||
'')
|
||||
+ ''
|
||||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||
'';
|
||||
|
||||
extraPlugins = with pkgs; if cfg.nixGrammars then
|
||||
[ (cfg.package.withPlugins (_: cfg.grammarPackages)) ]
|
||||
else [ cfg.package ];
|
||||
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
|
||||
extraPlugins = with pkgs;
|
||||
if cfg.nixGrammars
|
||||
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
||||
else [cfg.package];
|
||||
extraPackages = [pkgs.tree-sitter pkgs.nodejs];
|
||||
|
||||
options = mkIf cfg.folding {
|
||||
foldmethod = "expr";
|
||||
|
@ -142,4 +160,3 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.plugins.vimtex;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.vimtex;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
options.plugins.vimtex = {
|
||||
|
||||
enable = mkEnableOption "vimtex";
|
||||
|
||||
package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex;
|
||||
|
@ -24,19 +22,19 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
globals = {
|
||||
config = let
|
||||
globals =
|
||||
{
|
||||
enabled = cfg.enable;
|
||||
} // cfg.extraConfig;
|
||||
}
|
||||
// cfg.extraConfig;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
# Usefull for inverse search
|
||||
extraPackages = with pkgs; [ pstree xdotool ];
|
||||
extraPackages = with pkgs; [pstree xdotool];
|
||||
|
||||
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "zig";
|
||||
description = "Enable zig";
|
||||
package = pkgs.vimPlugins.zig-vim;
|
||||
|
@ -15,4 +20,4 @@ mkPlugin attrs {
|
|||
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 = [
|
||||
./servers.nix
|
||||
];
|
||||
|
@ -36,15 +39,14 @@ in
|
|||
# };
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
debug = cfg.debug;
|
||||
sources = cfg.sourcesItems;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("null-ls").setup(${helpers.toLuaObject options})
|
||||
|
|
|
@ -1,30 +1,41 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
mkServer =
|
||||
{ name
|
||||
, sourceType
|
||||
, description ? "${name} source, for null-ls."
|
||||
, package ? null
|
||||
, extraPackages ? [ ]
|
||||
, ...
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
mkServer = {
|
||||
name,
|
||||
sourceType,
|
||||
description ? "${name} source, for null-ls.",
|
||||
package ? null,
|
||||
extraPackages ? [],
|
||||
...
|
||||
}:
|
||||
# returns a module
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
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 {
|
||||
packageOption =
|
||||
if package == null
|
||||
then {}
|
||||
else {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = package;
|
||||
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;
|
||||
|
||||
# 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" } }'\'
|
||||
# '';
|
||||
};
|
||||
} // packageOption;
|
||||
}
|
||||
// packageOption;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Does this evaluate package?
|
||||
extraPackages = extraPackages ++ optional (package != null) cfg.package;
|
||||
|
||||
# Add source to list of sources
|
||||
plugins.null-ls.sourcesItems =
|
||||
let
|
||||
plugins.null-ls.sourcesItems = let
|
||||
sourceItem = "${sourceType}.${name}";
|
||||
withArgs = if (isNull cfg.withArgs) then sourceItem else "${sourceItem}.with ${cfg.withArgs}";
|
||||
withArgs =
|
||||
if (isNull cfg.withArgs)
|
||||
then sourceItem
|
||||
else "${sourceItem}.with ${cfg.withArgs}";
|
||||
finalString = ''require("null-ls").builtins.${withArgs}'';
|
||||
in
|
||||
[ (helpers.mkRaw finalString) ];
|
||||
in [(helpers.mkRaw finalString)];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
helpers = import ./helpers.nix args;
|
||||
serverData = {
|
||||
code_actions = {
|
||||
gitsigns = { };
|
||||
gitsigns = {};
|
||||
shellcheck = {
|
||||
package = pkgs.shellcheck;
|
||||
};
|
||||
};
|
||||
completion = { };
|
||||
completion = {};
|
||||
diagnostics = {
|
||||
flake8 = {
|
||||
package = pkgs.python3Packages.flake8;
|
||||
|
@ -65,18 +69,18 @@ let
|
|||
# sourceType = "formatting";
|
||||
# packages = [...];
|
||||
# }]
|
||||
serverDataFormatted = lib.mapAttrsToList
|
||||
(sourceType: sourceSet:
|
||||
lib.mapAttrsToList (name: attrs: attrs // { inherit sourceType name; }) sourceSet
|
||||
serverDataFormatted =
|
||||
lib.mapAttrsToList
|
||||
(
|
||||
sourceType: sourceSet:
|
||||
lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet
|
||||
)
|
||||
serverData;
|
||||
dataFlattened = lib.flatten serverDataFormatted;
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = lib.lists.map (helpers.mkServer) dataFlattened;
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.null-ls;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ./helpers.nix args;
|
||||
servers = [
|
||||
{
|
||||
name = "astro";
|
||||
description = "Enable astrols, for Astro";
|
||||
package = pkgs.nodePackages."@astrojs/language-server";
|
||||
cmd = cfg: [ "${cfg.package}/bin/astro-ls" "--stdio" ];
|
||||
cmd = cfg: ["${cfg.package}/bin/astro-ls" "--stdio"];
|
||||
}
|
||||
{
|
||||
name = "bashls";
|
||||
|
@ -23,7 +27,7 @@ let
|
|||
name = "cssls";
|
||||
description = "Enable cssls, for CSS";
|
||||
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";
|
||||
|
@ -70,7 +74,7 @@ let
|
|||
'';
|
||||
};
|
||||
renameFilesWithClasses = mkOption {
|
||||
type = types.nullOr (types.enum [ "always" "prompt" ]);
|
||||
type = types.nullOr (types.enum ["always" "prompt"]);
|
||||
default = null;
|
||||
description = ''
|
||||
When set to "always", will include edits to rename files when classes are renamed if the
|
||||
|
@ -98,7 +102,7 @@ let
|
|||
'';
|
||||
};
|
||||
documentation = mkOption {
|
||||
type = types.nullOr (types.enum [ "none" "summary" "full" ]);
|
||||
type = types.nullOr (types.enum ["none" "summary" "full"]);
|
||||
default = null;
|
||||
description = ''
|
||||
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";
|
||||
|
@ -125,13 +129,13 @@ let
|
|||
name = "eslint";
|
||||
description = "Enable eslint";
|
||||
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";
|
||||
description = "Enable elixirls";
|
||||
package = pkgs.elixir_ls;
|
||||
cmd = cfg: [ "${cfg.package}/bin/elixir-ls" ];
|
||||
cmd = cfg: ["${cfg.package}/bin/elixir-ls"];
|
||||
}
|
||||
{
|
||||
name = "gdscript";
|
||||
|
@ -146,13 +150,13 @@ let
|
|||
name = "html";
|
||||
description = "Enable html, for HTML";
|
||||
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";
|
||||
description = "Enable jsonls, for JSON";
|
||||
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";
|
||||
|
@ -170,7 +174,7 @@ let
|
|||
diagnostics = {
|
||||
ignored = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = ''
|
||||
Ignored diagnostic kinds.
|
||||
The kind identifier is a snake_cased_string usually shown together
|
||||
|
@ -179,7 +183,7 @@ let
|
|||
};
|
||||
excludedFiles = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = ''
|
||||
Files to exclude from showing diagnostics. Useful for generated files.
|
||||
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";
|
||||
|
@ -205,7 +209,7 @@ let
|
|||
serverName = "rust_analyzer";
|
||||
|
||||
settingsOptions = import ./rust-analyzer-config.nix lib;
|
||||
settings = cfg: { rust-analyzer = cfg; };
|
||||
settings = cfg: {rust-analyzer = cfg;};
|
||||
}
|
||||
{
|
||||
name = "sumneko-lua";
|
||||
|
@ -240,10 +244,9 @@ let
|
|||
name = "hls";
|
||||
description = "Enable 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;
|
||||
}
|
||||
|
|
|
@ -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 = [
|
||||
./basic-servers.nix
|
||||
];
|
||||
|
@ -14,7 +17,8 @@ in
|
|||
enable = mkEnableOption "neovim's built-in LSP";
|
||||
|
||||
enabledServers = mkOption {
|
||||
type = with types; listOf (oneOf [
|
||||
type = with types;
|
||||
listOf (oneOf [
|
||||
str
|
||||
(submodule {
|
||||
options = {
|
||||
|
@ -31,7 +35,7 @@ in
|
|||
})
|
||||
]);
|
||||
description = "A list of enabled LSP servers. Don't use this directly.";
|
||||
default = [ ];
|
||||
default = [];
|
||||
};
|
||||
|
||||
onAttach = mkOption {
|
||||
|
@ -43,7 +47,7 @@ in
|
|||
setupWrappers = mkOption {
|
||||
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.";
|
||||
default = [ ];
|
||||
default = [];
|
||||
};
|
||||
|
||||
preConfig = mkOption {
|
||||
|
@ -60,14 +64,14 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
runWrappers = wrappers: s:
|
||||
if wrappers == [ ] then s
|
||||
if wrappers == []
|
||||
then s
|
||||
else (head wrappers) (runWrappers (tail wrappers) s);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ pkgs.vimPlugins.nvim-lspconfig ];
|
||||
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
||||
|
||||
# Enable all LSP servers
|
||||
extraConfigLua = ''
|
||||
|
|
|
@ -1,51 +1,65 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
{
|
||||
mkLsp =
|
||||
{ name
|
||||
, description ? "Enable ${name}."
|
||||
, serverName ? name
|
||||
, package ? pkgs.${name}
|
||||
, extraPackages ? { }
|
||||
, cmd ? (cfg: null)
|
||||
, settings ? (cfg: { })
|
||||
, settingsOptions ? { }
|
||||
, ...
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
mkLsp = {
|
||||
name,
|
||||
description ? "Enable ${name}.",
|
||||
serverName ? name,
|
||||
package ? pkgs.${name},
|
||||
extraPackages ? {},
|
||||
cmd ? (cfg: null),
|
||||
settings ? (cfg: {}),
|
||||
settingsOptions ? {},
|
||||
...
|
||||
}:
|
||||
# returns a module
|
||||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lsp.servers.${name};
|
||||
|
||||
packageOption =
|
||||
if package != null then {
|
||||
if package != null
|
||||
then {
|
||||
package = mkOption {
|
||||
default = package;
|
||||
type = types.nullOr types.package;
|
||||
};
|
||||
} else { };
|
||||
in
|
||||
{
|
||||
}
|
||||
else {};
|
||||
in {
|
||||
options = {
|
||||
plugins.lsp.servers.${name} = {
|
||||
plugins.lsp.servers.${name} =
|
||||
{
|
||||
enable = mkEnableOption description;
|
||||
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;
|
||||
extraOptions = {
|
||||
cmd = cmd cfg;
|
||||
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 = {
|
||||
plugins.lsp-lines = {
|
||||
enable = mkEnableOption "lsp_lines.nvim";
|
||||
|
@ -19,24 +22,25 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
diagnosticConfig = {
|
||||
virtual_text = false;
|
||||
virtual_lines =
|
||||
if cfg.currentLine then {
|
||||
if cfg.currentLine
|
||||
then {
|
||||
only_current_line = true;
|
||||
} else true;
|
||||
}
|
||||
else true;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
do
|
||||
require("lsp_lines").setup()
|
||||
|
||||
vim.diagnostic.config(${ helpers.toLuaObject diagnosticConfig })
|
||||
vim.diagnostic.config(${helpers.toLuaObject diagnosticConfig})
|
||||
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 = {
|
||||
plugins.lspsaga = {
|
||||
enable = mkEnableOption "lspsaga.nvim";
|
||||
|
@ -107,15 +110,14 @@ in
|
|||
description = "Maximum finder preview lines";
|
||||
};
|
||||
|
||||
keys =
|
||||
let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
keys = let
|
||||
defaultKeyOpt = desc:
|
||||
mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
|
@ -132,7 +134,7 @@ in
|
|||
};
|
||||
|
||||
borderStyle = mkOption {
|
||||
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
||||
type = types.nullOr (types.enum ["thin" "rounded" "thick"]);
|
||||
default = null;
|
||||
description = "Border style";
|
||||
};
|
||||
|
@ -145,10 +147,15 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
notDefault = default: opt: if (opt != default) then opt else null;
|
||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != { }) then opt else null;
|
||||
config = let
|
||||
notDefault = default: opt:
|
||||
if (opt != default)
|
||||
then opt
|
||||
else null;
|
||||
notEmpty = opt:
|
||||
if ((filterAttrs (_: v: v != null) opt) != {})
|
||||
then opt
|
||||
else null;
|
||||
notNull = opt: opt;
|
||||
lspsagaConfig = {
|
||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||
|
@ -174,18 +181,19 @@ in
|
|||
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
|
||||
border_style =
|
||||
let
|
||||
border_style = let
|
||||
borderStyle =
|
||||
if cfg.borderStyle == "thin" then 1
|
||||
else if cfg.borderStyle == "rounded" then 2
|
||||
else if cfg.borderStyle == "thick" then 3
|
||||
if cfg.borderStyle == "thin"
|
||||
then 1
|
||||
else if cfg.borderStyle == "rounded"
|
||||
then 2
|
||||
else if cfg.borderStyle == "thick"
|
||||
then 3
|
||||
else null;
|
||||
in
|
||||
borderStyle;
|
||||
|
||||
finder_action_keys =
|
||||
let
|
||||
finder_action_keys = let
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
|
@ -197,8 +205,7 @@ in
|
|||
in
|
||||
notEmpty keys;
|
||||
|
||||
code_action_keys =
|
||||
let
|
||||
code_action_keys = let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
|
@ -208,8 +215,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
local saga = require 'lspsaga'
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
with lib; {
|
||||
options.plugins.nvim-lightbulb = {
|
||||
enable = mkEnableOption "nvim-lightbulb, showing available code actions";
|
||||
|
||||
|
@ -63,8 +63,7 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.nvim-lightbulb;
|
||||
setupOptions = {
|
||||
inherit (cfg) ignore sign autocmd;
|
||||
|
@ -83,9 +82,9 @@ with lib; {
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = ''
|
||||
require("nvim-lightbulb").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# THIS FILE IS AUTOGENERATED DO NOT EDIT
|
||||
lib: with lib; {
|
||||
lib:
|
||||
with lib; {
|
||||
"assist" = {
|
||||
"expressionFillDefault" = mkOption {
|
||||
type = types.nullOr (types.enum [ "todo" "default" ]);
|
||||
type = types.nullOr (types.enum ["todo" "default"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Placeholder expression to use for missing expressions in assists.
|
||||
|
@ -105,7 +106,7 @@ lib: with lib; {
|
|||
};
|
||||
};
|
||||
"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;
|
||||
description = ''
|
||||
List of features to activate.
|
||||
|
@ -217,7 +218,7 @@ lib: with lib; {
|
|||
'';
|
||||
};
|
||||
"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;
|
||||
description = ''
|
||||
List of features to activate. Defaults to
|
||||
|
@ -320,7 +321,7 @@ lib: with lib; {
|
|||
};
|
||||
"callable" = {
|
||||
"snippets" = mkOption {
|
||||
type = types.nullOr (types.enum [ "fill_arguments" "add_parentheses" "none" ]);
|
||||
type = types.nullOr (types.enum ["fill_arguments" "add_parentheses" "none"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to add parenthesis and argument snippets when completing function.
|
||||
|
@ -508,7 +509,7 @@ lib: with lib; {
|
|||
'';
|
||||
};
|
||||
"watcher" = mkOption {
|
||||
type = types.nullOr (types.enum [ "client" "server" ]);
|
||||
type = types.nullOr (types.enum ["client" "server"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Controls file watching implementation.
|
||||
|
@ -727,7 +728,7 @@ lib: with lib; {
|
|||
'';
|
||||
};
|
||||
"group" = mkOption {
|
||||
type = types.nullOr (types.enum [ "preserve" "crate" "module" "item" ]);
|
||||
type = types.nullOr (types.enum ["preserve" "crate" "module" "item"]);
|
||||
default = null;
|
||||
description = ''
|
||||
How imports should be grouped into use statements.
|
||||
|
@ -768,7 +769,7 @@ lib: with lib; {
|
|||
};
|
||||
};
|
||||
"prefix" = mkOption {
|
||||
type = types.nullOr (types.enum [ "plain" "self" "crate" ]);
|
||||
type = types.nullOr (types.enum ["plain" "self" "crate"]);
|
||||
default = null;
|
||||
description = ''
|
||||
The path structure for newly inserted paths to use.
|
||||
|
@ -838,7 +839,7 @@ lib: with lib; {
|
|||
};
|
||||
"closureReturnTypeHints" = {
|
||||
"enable" = mkOption {
|
||||
type = types.nullOr (types.enum [ "always" "never" "with_block" ]);
|
||||
type = types.nullOr (types.enum ["always" "never" "with_block"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to show inlay type hints for return types of closures.
|
||||
|
@ -852,7 +853,7 @@ lib: with lib; {
|
|||
};
|
||||
"lifetimeElisionHints" = {
|
||||
"enable" = mkOption {
|
||||
type = types.nullOr (types.enum [ "always" "never" "skip_trivial" ]);
|
||||
type = types.nullOr (types.enum ["always" "never" "skip_trivial"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to show inlay type hints for elided lifetimes in function signatures.
|
||||
|
@ -905,7 +906,7 @@ lib: with lib; {
|
|||
};
|
||||
"reborrowHints" = {
|
||||
"enable" = mkOption {
|
||||
type = types.nullOr (types.enum [ "always" "never" "mutable" ]);
|
||||
type = types.nullOr (types.enum ["always" "never" "mutable"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to show inlay type hints for compiler inserted reborrows.
|
||||
|
@ -1154,7 +1155,7 @@ lib: with lib; {
|
|||
};
|
||||
};
|
||||
"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;
|
||||
description = ''
|
||||
Disable project auto-discovery in favor of explicitly specified set
|
||||
|
@ -1471,7 +1472,7 @@ lib: with lib; {
|
|||
};
|
||||
"signatureInfo" = {
|
||||
"detail" = mkOption {
|
||||
type = types.nullOr (types.enum [ "full" "parameters" ]);
|
||||
type = types.nullOr (types.enum ["full" "parameters"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Show full signature of the callable. Only shows parameters if disabled.
|
||||
|
@ -1517,7 +1518,7 @@ lib: with lib; {
|
|||
"symbol" = {
|
||||
"search" = {
|
||||
"kind" = mkOption {
|
||||
type = types.nullOr (types.enum [ "only_types" "all_symbols" ]);
|
||||
type = types.nullOr (types.enum ["only_types" "all_symbols"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Workspace symbol search kind.
|
||||
|
@ -1543,7 +1544,7 @@ lib: with lib; {
|
|||
'';
|
||||
};
|
||||
"scope" = mkOption {
|
||||
type = types.nullOr (types.enum [ "workspace" "workspace_and_dependencies" ]);
|
||||
type = types.nullOr (types.enum ["workspace" "workspace_and_dependencies"]);
|
||||
default = null;
|
||||
description = ''
|
||||
Workspace symbol search scope.
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.plugins.trouble;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
with lib;
|
||||
# with helpers;
|
||||
{
|
||||
config,
|
||||
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;
|
||||
|
||||
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";
|
||||
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";
|
||||
|
@ -23,4 +27,4 @@ with lib;
|
|||
nvim-web-devicons
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# This is for plugins not in nixpkgs
|
||||
# e.g. intellitab.nvim
|
||||
# Ideally, in the future, this would all be specified as a flake input!
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
intellitab-nvim = pkgs.vimUtils.buildVimPlugin rec {
|
||||
pname = "intellitab-nvim";
|
||||
version = "a6c1a505865f6131866d609c52440306e9914b16";
|
||||
|
@ -47,7 +46,7 @@
|
|||
sha256 = "sha256-/m4Paw6AvDzTMWWCWpPnrdI4gsjIDSJPvGCMV7ufbEA=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ pkgs.python3Packages.pynvim ];
|
||||
propagatedBuildInputs = [pkgs.python3Packages.pynvim];
|
||||
})
|
||||
(ps.buildPythonPackage rec {
|
||||
pname = "std2";
|
||||
|
@ -96,9 +95,8 @@
|
|||
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
||||
};
|
||||
|
||||
|
||||
|
||||
passthru.python3Dependencies = ps: with ps; [
|
||||
passthru.python3Dependencies = ps:
|
||||
with ps; [
|
||||
pynvim
|
||||
jupyter-client
|
||||
ueberzug
|
||||
|
|
|
@ -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 = {
|
||||
plugins.packer = {
|
||||
enable = mkEnableOption "packer.nvim";
|
||||
|
@ -13,7 +16,8 @@ in
|
|||
type = types.listOf (types.oneOf [
|
||||
types.str
|
||||
(with types; let
|
||||
mkOpt = type: desc: mkOption {
|
||||
mkOpt = type: desc:
|
||||
mkOption {
|
||||
type = nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
|
@ -31,49 +35,60 @@ in
|
|||
as = mkOpt bool "Specifies an alias under which to install the plugin";
|
||||
installer = mkOpt function "A custom installer";
|
||||
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";
|
||||
opt = mkOpt str "Marks a plugin as optional";
|
||||
branch = mkOpt str "Git branch to use";
|
||||
tag = mkOpt str "Git tag to use";
|
||||
commit = mkOpt str "Git commit to use";
|
||||
lock = mkOpt bool "Skip this plugin in updates";
|
||||
run = mkOpt (oneOf [ str function ]) "Post-install hook";
|
||||
requires = mkOpt (oneOf [ str (listOf any) ]) "Plugin dependencies";
|
||||
rocks = mkOpt (oneOf [ str (listOf any) ]) "Luarocks dependencies";
|
||||
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";
|
||||
cmd = mkOpt (oneOf [ str (listOf str) ]) "Commands 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";
|
||||
event = mkOpt (oneOf [ str (listOf str) ]) "Autocommand events 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";
|
||||
module = mkOpt (oneOf [ str (listOf str) ]) "Patterns of module names which load this plugin";
|
||||
run = mkOpt (oneOf [str function]) "Post-install hook";
|
||||
requires = mkOpt (oneOf [str (listOf any)]) "Plugin dependencies";
|
||||
rocks = mkOpt (oneOf [str (listOf any)]) "Luarocks dependencies";
|
||||
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";
|
||||
cmd = mkOpt (oneOf [str (listOf str)]) "Commands 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";
|
||||
event = mkOpt (oneOf [str (listOf str)]) "Autocommand events 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";
|
||||
module = mkOpt (oneOf [str (listOf str)]) "Patterns of module names which load this plugin";
|
||||
};
|
||||
})
|
||||
]);
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "List of plugins";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ (pkgs.vimPlugins.packer-nvim.overrideAttrs (_: { pname = "packer.nvim"; })) ];
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraPlugins = [(pkgs.vimPlugins.packer-nvim.overrideAttrs (_: {pname = "packer.nvim";}))];
|
||||
extraPackages = [pkgs.git];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
plugins = map
|
||||
extraConfigLua = let
|
||||
plugins =
|
||||
map
|
||||
(plugin:
|
||||
if isAttrs plugin then
|
||||
mapAttrs' (k: v: { name = if k == "name" then "@" else k; value = v; }) plugin
|
||||
if isAttrs plugin
|
||||
then
|
||||
mapAttrs' (k: v: {
|
||||
name =
|
||||
if k == "name"
|
||||
then "@"
|
||||
else k;
|
||||
value = v;
|
||||
})
|
||||
plugin
|
||||
else plugin)
|
||||
cfg.plugins;
|
||||
packedPlugins = if length plugins == 1 then head plugins else plugins;
|
||||
packedPlugins =
|
||||
if length plugins == 1
|
||||
then head plugins
|
||||
else plugins;
|
||||
in
|
||||
mkIf (cfg.plugins != [ ]) ''
|
||||
mkIf (cfg.plugins != []) ''
|
||||
require('packer').startup(function()
|
||||
use ${helpers.toLuaObject packedPlugins}
|
||||
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 = {
|
||||
enable = mkEnableOption "Enable luasnip";
|
||||
|
||||
package = helpers.mkPackageOption "luasnip" pkgs.vimPlugins.luasnip;
|
||||
|
||||
fromVscode = mkOption {
|
||||
default = [ ];
|
||||
default = [];
|
||||
example = ''
|
||||
[
|
||||
{}
|
||||
|
@ -38,7 +41,8 @@ in
|
|||
# TODO: add option to also include the default runtimepath
|
||||
paths = mkOption {
|
||||
default = null;
|
||||
type = with types; nullOr (oneOf
|
||||
type = with types;
|
||||
nullOr (oneOf
|
||||
[
|
||||
str
|
||||
path
|
||||
|
@ -75,21 +79,18 @@ in
|
|||
# TODO: add support for lua
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
|
||||
fromVscodeLoaders = lists.map
|
||||
(loader:
|
||||
let
|
||||
options = attrsets.getAttrs [ "paths" "exclude" "include" ] loader;
|
||||
in
|
||||
''
|
||||
config = let
|
||||
fromVscodeLoaders =
|
||||
lists.map
|
||||
(loader: let
|
||||
options = attrsets.getAttrs ["paths" "exclude" "include"] loader;
|
||||
in ''
|
||||
require("luasnip.loaders.from_vscode").${optionalString loader.lazyLoad "lazy_"}load(${helpers.toLuaObject options})
|
||||
'')
|
||||
cfg.fromVscode;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = concatStringsSep "\n" fromVscodeLoaders;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
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 {
|
||||
default = null;
|
||||
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_*.";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.airline = {
|
||||
enable = mkEnableOption "airline";
|
||||
|
@ -33,7 +36,8 @@ in
|
|||
sections = mkOption {
|
||||
description = "Statusbar sections";
|
||||
default = null;
|
||||
type = with types; nullOr (submodule {
|
||||
type = with types;
|
||||
nullOr (submodule {
|
||||
options = {
|
||||
a = sectionOption;
|
||||
b = sectionOption;
|
||||
|
@ -59,21 +63,24 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
sections = { };
|
||||
config = let
|
||||
sections = {};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
cfg.package
|
||||
] ++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals = {
|
||||
]
|
||||
++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals =
|
||||
{
|
||||
airline.extensions = cfg.extensions;
|
||||
|
||||
airline_statusline_ontop = mkIf cfg.onTop 1;
|
||||
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
||||
|
||||
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 = {
|
||||
plugins.lightline = {
|
||||
enable = mkEnableOption "lightline";
|
||||
|
@ -51,11 +54,9 @@ in
|
|||
active = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule {
|
||||
options =
|
||||
let
|
||||
options = let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in
|
||||
{
|
||||
in {
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
|
@ -79,14 +80,13 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
globals.lightline = mkIf (configAttrs != { }) configAttrs;
|
||||
extraPlugins = [cfg.package];
|
||||
globals.lightline = mkIf (configAttrs != {}) configAttrs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lualine;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
separators = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
|
@ -32,7 +36,7 @@ let
|
|||
default = defaultName;
|
||||
};
|
||||
icons_enabled = mkOption {
|
||||
type = types.enum [ "True" "False" ];
|
||||
type = types.enum ["True" "False"];
|
||||
default = "True";
|
||||
description = "displays icons in alongside component";
|
||||
};
|
||||
|
@ -44,7 +48,7 @@ let
|
|||
separator = separators;
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "extra options for the component";
|
||||
};
|
||||
};
|
||||
|
@ -52,8 +56,7 @@ let
|
|||
]));
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lualine = {
|
||||
enable = mkEnableOption "lualine";
|
||||
|
@ -79,12 +82,11 @@ in
|
|||
alwaysDivideMiddle = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description =
|
||||
"When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
description = "When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
};
|
||||
|
||||
sections = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
lualine_a = component_options "mode";
|
||||
lualine_b = component_options "branch";
|
||||
|
@ -100,7 +102,7 @@ in
|
|||
};
|
||||
|
||||
tabline = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
lualine_a = component_options "";
|
||||
lualine_b = component_options "";
|
||||
|
@ -121,10 +123,22 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
processComponent = x: (if isAttrs x then processTableComponent else id) x;
|
||||
processTableComponent = { name, icons_enabled, icon, separator, extraConfig }: mergeAttrs
|
||||
config = let
|
||||
processComponent = x:
|
||||
(
|
||||
if isAttrs x
|
||||
then processTableComponent
|
||||
else id
|
||||
)
|
||||
x;
|
||||
processTableComponent = {
|
||||
name,
|
||||
icons_enabled,
|
||||
icon,
|
||||
separator,
|
||||
extraConfig,
|
||||
}:
|
||||
mergeAttrs
|
||||
{
|
||||
"@" = name;
|
||||
inherit icons_enabled icon separator;
|
||||
|
@ -146,9 +160,8 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraConfigLua =
|
||||
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
extraPlugins = [cfg.package];
|
||||
extraPackages = [pkgs.git];
|
||||
extraConfigLua = ''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 = [
|
||||
./frecency.nix
|
||||
./fzf-native.nix
|
||||
|
@ -33,13 +32,13 @@ in
|
|||
enabledExtensions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "A list of enabled extensions. Don't use this directly";
|
||||
default = [ ];
|
||||
default = [];
|
||||
};
|
||||
|
||||
extensionConfig = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
description = "Configuration for the extensions. Don't use this directly";
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
defaults = mkOption {
|
||||
|
@ -50,13 +49,13 @@ in
|
|||
|
||||
extraOptions = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
default = {};
|
||||
description = "An attribute set, that lets you set extra options or override options set by nixvim";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPackages = [ pkgs.bat ];
|
||||
extraPackages = [pkgs.bat];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
|
@ -68,14 +67,14 @@ in
|
|||
let $BAT_THEME = '${cfg.highlightTheme}'
|
||||
'';
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
options = {
|
||||
extraConfigLua = let
|
||||
options =
|
||||
{
|
||||
extensions = cfg.extensionConfig;
|
||||
defaults = cfg.defaults;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
do
|
||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
enable = mkEnableOption "frecency";
|
||||
|
||||
|
@ -47,8 +50,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
configuration = {
|
||||
db_root = cfg.dbRoot;
|
||||
default_workspace = cfg.defaultWorkspace;
|
||||
|
@ -60,13 +62,13 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPackages = [ pkgs.sqlite ];
|
||||
extraPackages = [pkgs.sqlite];
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
sqlite-lua
|
||||
];
|
||||
|
||||
plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||
plugins.telescope.enabledExtensions = ["frecency"];
|
||||
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 = {
|
||||
enable = mkEnableOption "Enable fzf-native";
|
||||
|
||||
|
@ -26,7 +29,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
@ -38,10 +41,11 @@ in
|
|||
override_file_sorter = cfg.overrideFileSorter;
|
||||
case_mode = cfg.caseMode;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
plugins.telescope.enabledExtensions = [ "fzf" ];
|
||||
plugins.telescope.enabledExtensions = ["fzf"];
|
||||
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 = {
|
||||
enable = mkEnableOption "Enable fzy-native";
|
||||
|
||||
|
@ -24,10 +27,11 @@ in
|
|||
override_generic_sorter = cfg.overrideGenericSorter;
|
||||
override_file_sorter = cfg.overrideFileSorter;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
extraPlugins = [ pkgs.vimPlugins.telescope-fzy-native-nvim ];
|
||||
in
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 = {
|
||||
enable = mkEnableOption "Enable media_files extension for telescope";
|
||||
|
||||
|
@ -23,7 +26,7 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins.telescope.enabledExtensions = [ "media_files" ];
|
||||
plugins.telescope.enabledExtensions = ["media_files"];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
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 = {
|
||||
enable = mkEnableOption "project-nvim telescope extension";
|
||||
|
||||
};
|
||||
|
||||
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 = {
|
||||
plugins.comment-nvim = {
|
||||
enable = mkEnableOption "Enable comment-nvim";
|
||||
|
@ -27,7 +30,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
toggler = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
line = mkOption {
|
||||
type = types.str;
|
||||
|
@ -45,7 +48,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
opleader = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
line = mkOption {
|
||||
type = types.str;
|
||||
|
@ -63,7 +66,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
mappings = mkOption {
|
||||
type = types.nullOr (types.submodule ({ ... }: {
|
||||
type = types.nullOr (types.submodule ({...}: {
|
||||
options = {
|
||||
basic = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -88,8 +91,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = {
|
||||
padding = cfg.padding;
|
||||
sticky = cfg.sticky;
|
||||
|
@ -100,8 +102,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua =
|
||||
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = ''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!
|
||||
|
||||
options = {
|
||||
|
@ -16,6 +19,6 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.dashboard;
|
||||
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options = {
|
||||
plugins.dashboard = {
|
||||
enable = mkEnableOption "dashboard";
|
||||
|
@ -90,7 +93,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
hideStatusline = mkOption {
|
||||
|
@ -107,8 +110,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
custom_header = cfg.header;
|
||||
custom_footer = cfg.footer;
|
||||
|
@ -128,12 +130,11 @@ in
|
|||
filteredOptions = filterAttrs (_: v: !isNull v) options;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = ''
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
${toString (mapAttrsToList (n: v:
|
||||
"dashboard.${n} = ${helpers.toLuaObject v}\n")
|
||||
${toString (mapAttrsToList (n: v: "dashboard.${n} = ${helpers.toLuaObject v}\n")
|
||||
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 = {
|
||||
plugins.easyescape = {
|
||||
enable = mkEnableOption "Enable easyescape";
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
eitherAttrsStrInt = with types; let
|
||||
strInt = either str int;
|
||||
in either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||
in with helpers;
|
||||
mkPlugin attrs {
|
||||
in
|
||||
either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||
in
|
||||
with helpers;
|
||||
mkPlugin attrs {
|
||||
name = "emmet";
|
||||
description = "Enable emmet";
|
||||
package = pkgs.vimPlugins.emmet-vim;
|
||||
|
||||
options = {
|
||||
mode = mkDefaultOpt {
|
||||
type = types.enum [ "i" "n" "v" "a" ];
|
||||
type = types.enum ["i" "n" "v" "a"];
|
||||
global = "user_emmet_mode";
|
||||
description = "Mode where emmet will enable";
|
||||
};
|
||||
|
@ -31,4 +36,4 @@ mkPlugin attrs {
|
|||
description = "Emmet settings";
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "endwise";
|
||||
description = "Enable vim-endwise";
|
||||
package = pkgs.vimPlugins.vim-endwise;
|
||||
|
||||
# Yes it's really not configurable
|
||||
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 = {
|
||||
plugins.floaterm = {
|
||||
enable = mkEnableOption "floaterm";
|
||||
|
@ -21,7 +24,7 @@ in
|
|||
default = null;
|
||||
};
|
||||
winType = mkOption {
|
||||
type = types.nullOr (types.enum [ "float" "split" "vsplit" ]);
|
||||
type = types.nullOr (types.enum ["float" "split" "vsplit"]);
|
||||
default = null;
|
||||
};
|
||||
winWidth = mkOption {
|
||||
|
@ -45,17 +48,17 @@ in
|
|||
default = null;
|
||||
};
|
||||
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";
|
||||
default = null;
|
||||
};
|
||||
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.";
|
||||
default = null;
|
||||
};
|
||||
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.";
|
||||
default = null;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "goyo";
|
||||
description = "Enable goyo.vim";
|
||||
package = pkgs.vimPlugins.goyo-vim;
|
||||
|
@ -26,4 +31,4 @@ mkPlugin attrs {
|
|||
type = types.bool;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.harpoon;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
projectConfigModule = types.submodule {
|
||||
options = {
|
||||
|
@ -15,8 +19,7 @@ let
|
|||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.harpoon = {
|
||||
enable = mkEnableOption "harpoon";
|
||||
|
||||
|
@ -47,7 +50,7 @@ in
|
|||
'';
|
||||
|
||||
projects = mkOption {
|
||||
default = { };
|
||||
default = {};
|
||||
description = ''
|
||||
Predefined projetcs. The keys of this attrs should be the path to the project.
|
||||
$HOME is working.
|
||||
|
@ -73,21 +76,20 @@ in
|
|||
Menu window height
|
||||
'';
|
||||
|
||||
borderChars = helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
borderChars =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
"[ \"─\" \"│\" \"─\" \"│\" \"╭\" \"╮\" \"╯\" \"╰\" ]"
|
||||
"Border characters"
|
||||
;
|
||||
"Border characters";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
projects = builtins.mapAttrs
|
||||
config = let
|
||||
projects =
|
||||
builtins.mapAttrs
|
||||
(
|
||||
name: value: {
|
||||
term.cmds = value.termCommands;
|
||||
mark.marks = map (mark: { filename = mark; }) value.marks;
|
||||
mark.marks = map (mark: {filename = mark;}) value.marks;
|
||||
}
|
||||
)
|
||||
cfg.projects;
|
||||
|
@ -112,11 +114,10 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('harpoon').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.indent-blankline = {
|
||||
enable = mkEnableOption "indent-blankline.nvim";
|
||||
|
||||
|
@ -248,12 +248,11 @@ in
|
|||
helpers.defaultNullOpts.mkBool false "Turns deprecation warning messages off.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.indent-blankline;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
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 = {
|
||||
plugins.intellitab = {
|
||||
enable = mkEnableOption "intellitab.nvim";
|
||||
|
@ -15,7 +18,7 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
maps.insert."<Tab>" = "<CMD>lua require([[intellitab]]).indent()<CR>";
|
||||
plugins.treesitter = {
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.magma-nvim;
|
||||
plugins = import ../plugin-defs.nix { inherit pkgs; };
|
||||
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
||||
package = pkgs.fetchFromGitHub {
|
||||
owner = "dccsillag";
|
||||
repo = "magma-nvim";
|
||||
|
@ -14,11 +18,10 @@ in {
|
|||
plugins.magma-nvim = {
|
||||
enable = mkEnableOption "Enable magma-nvim?";
|
||||
image_provider = mkOption {
|
||||
type = types.enum [ "none" "ueberzug" "kitty" ];
|
||||
type = types.enum ["none" "ueberzug" "kitty"];
|
||||
default = "none";
|
||||
example = "ueberzug";
|
||||
description =
|
||||
" This configures how to display images. The following options are available:
|
||||
description = " This configures how to display images. The following options are available:
|
||||
none -- don't show imagesmagma_image_provider.
|
||||
ueberzug -- use Ueberzug to display images.
|
||||
kitty -- use the Kitty protocol to display images.";
|
||||
|
@ -27,8 +30,7 @@ in {
|
|||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then whenever you have an active cell its output window will be automatically shown.
|
||||
description = " 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.";
|
||||
};
|
||||
|
||||
|
@ -36,60 +38,54 @@ in {
|
|||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
||||
description = " If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
||||
};
|
||||
|
||||
output_window_borders = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
||||
description = " 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 {
|
||||
type = types.str;
|
||||
default = "CursorLine";
|
||||
# example = "";
|
||||
description =
|
||||
" The highlight group to be used for highlighting cells.";
|
||||
description = " The highlight group to be used for highlighting cells.";
|
||||
};
|
||||
save_path = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description =
|
||||
"Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
||||
description = "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.";
|
||||
};
|
||||
show_mimetype_debug = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description =
|
||||
" If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
||||
description = " 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.";
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
example =
|
||||
"package = pkgs.fetchFromGitHub {
|
||||
example = "package = pkgs.fetchFromGitHub {
|
||||
owner = \"WhiteBlackGoose\";
|
||||
repo = \"magma-nvim-goose\";
|
||||
rev = version;
|
||||
sha256 = \"sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=\";} ";
|
||||
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ (
|
||||
if cfg.package != null then plugins.magma-nvim.override {src = cfg.package;} else plugins.magma-nvim
|
||||
)];
|
||||
|
||||
extraPlugins = [
|
||||
(
|
||||
if cfg.package != null
|
||||
then plugins.magma-nvim.override {src = cfg.package;}
|
||||
else plugins.magma-nvim
|
||||
)
|
||||
];
|
||||
|
||||
globals = {
|
||||
magma_image_provider =
|
||||
|
@ -99,13 +95,11 @@ in {
|
|||
magma_wrap_output = mkIf (!cfg.wrap_output) cfg.wrap_output;
|
||||
magma_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;
|
||||
magma_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 = {
|
||||
enable = mkEnableOption "mark-radar";
|
||||
|
||||
|
@ -33,8 +35,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
opts = helpers.toLuaObject {
|
||||
inherit (cfg) highlight_group background_highlight_group;
|
||||
set_default_mappings = cfg.set_default_keybinds;
|
||||
|
@ -42,7 +43,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("mark-radar").setup(${opts})
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.notify;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
icon = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.notify = {
|
||||
enable = mkEnableOption "notify";
|
||||
|
||||
package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify;
|
||||
|
||||
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";
|
||||
default = null;
|
||||
};
|
||||
|
@ -45,12 +48,11 @@ in
|
|||
};
|
||||
});
|
||||
description = "Icons for the different levels";
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = with cfg; {
|
||||
stages = stages;
|
||||
timeout = timeout;
|
||||
|
@ -66,7 +68,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua = ''
|
||||
vim.notify = require('notify');
|
||||
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 = {
|
||||
enable = mkEnableOption "nvim-autopairs";
|
||||
|
||||
|
@ -41,8 +44,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
pairs_map = cfg.pairs;
|
||||
disable_filetype = cfg.disabledFiletypes;
|
||||
|
@ -52,7 +54,7 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-autopairs').setup(${helpers.toLuaObject options})
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-colorizer;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
colorizer-options = {
|
||||
RGB = mkOption {
|
||||
|
@ -53,7 +56,7 @@ let
|
|||
};
|
||||
mode = mkOption {
|
||||
description = "Set the display mode";
|
||||
type = types.nullOr (types.enum [ "foreground" "background" "virtualtext" ]);
|
||||
type = types.nullOr (types.enum ["foreground" "background" "virtualtext"]);
|
||||
default = null;
|
||||
};
|
||||
tailwind = mkOption {
|
||||
|
@ -61,7 +64,7 @@ let
|
|||
type = types.nullOr (
|
||||
types.oneOf [
|
||||
types.bool
|
||||
(types.enum [ "normal" "lsp" "both" ])
|
||||
(types.enum ["normal" "lsp" "both"])
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
|
@ -84,12 +87,9 @@ let
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.nvim-colorizer = {
|
||||
|
||||
enable = mkEnableOption "nvim-colorizer";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua;
|
||||
|
@ -100,11 +100,13 @@ in
|
|||
types.listOf (types.oneOf [
|
||||
types.str
|
||||
(types.submodule {
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
language = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
} // colorizer-options;
|
||||
}
|
||||
// colorizer-options;
|
||||
})
|
||||
])
|
||||
);
|
||||
|
@ -128,24 +130,26 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = let
|
||||
|
||||
filetypes = if (cfg.fileTypes != null)
|
||||
then (
|
||||
filetypes =
|
||||
if (cfg.fileTypes != null)
|
||||
then
|
||||
(
|
||||
let
|
||||
list = map (
|
||||
v: if builtins.isAttrs v
|
||||
then v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v [ "language" ])
|
||||
list =
|
||||
map (
|
||||
v:
|
||||
if builtins.isAttrs v
|
||||
then v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v ["language"])
|
||||
else "'${v}'"
|
||||
) cfg.fileTypes;
|
||||
in "{" + (concatStringsSep "," list) + "}"
|
||||
)
|
||||
else
|
||||
"nil"
|
||||
;
|
||||
|
||||
cfg.fileTypes;
|
||||
in
|
||||
"{" + (concatStringsSep "," list) + "}"
|
||||
)
|
||||
else "nil";
|
||||
in ''
|
||||
require("colorizer").setup({
|
||||
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 = [
|
||||
(optionWarnings.mkRenamedOption {
|
||||
option = basePluginPath ++ [ "updateCwd" ];
|
||||
newOption = basePluginPath ++ [ "syncRootWithCwd" ];
|
||||
option = basePluginPath ++ ["updateCwd"];
|
||||
newOption = basePluginPath ++ ["syncRootWithCwd"];
|
||||
})
|
||||
(optionWarnings.mkRenamedOption {
|
||||
option = basePluginPath ++ [ "updateFocusedFile" "updateCwd" ];
|
||||
newOption = basePluginPath ++ [ "updateFocusedFile" "updateRoot" ];
|
||||
option = basePluginPath ++ ["updateFocusedFile" "updateCwd"];
|
||||
newOption = basePluginPath ++ ["updateFocusedFile" "updateRoot"];
|
||||
})
|
||||
(optionWarnings.mkDeprecatedOption {
|
||||
option = basePluginPath ++ [ "openOnSetup" ];
|
||||
option = basePluginPath ++ ["openOnSetup"];
|
||||
alternative = [];
|
||||
})
|
||||
(optionWarnings.mkDeprecatedOption {
|
||||
option = basePluginPath ++ [ "ignoreFtOnSetup" ];
|
||||
option = basePluginPath ++ ["ignoreFtOnSetup"];
|
||||
alternative = [];
|
||||
})
|
||||
];
|
||||
|
@ -102,15 +105,14 @@ in
|
|||
description = "Enable diagnostics";
|
||||
};
|
||||
|
||||
icons =
|
||||
let
|
||||
diagnosticOption = desc: mkOption {
|
||||
icons = let
|
||||
diagnosticOption = desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = desc;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
hint = diagnosticOption "Hints";
|
||||
info = diagnosticOption "Info";
|
||||
warning = diagnosticOption "Warning";
|
||||
|
@ -233,8 +235,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
disable_netrw = cfg.disableNetrw;
|
||||
hijack_netrw = cfg.hijackNetrw;
|
||||
|
@ -294,6 +295,6 @@ in
|
|||
extraConfigLua = ''
|
||||
require('nvim-tree').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
extraPackages = [ pkgs.git ];
|
||||
extraPackages = [pkgs.git];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{ 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,
|
||||
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;
|
||||
|
@ -46,7 +51,7 @@ in
|
|||
};
|
||||
|
||||
scopeChdir = mkOption {
|
||||
type = types.nullOr (types.enum [ "global" "tab" "win" ]);
|
||||
type = types.nullOr (types.enum ["global" "tab" "win"]);
|
||||
default = null;
|
||||
};
|
||||
|
||||
|
@ -54,12 +59,11 @@ in
|
|||
type = types.nullOr (types.either types.str helpers.rawType);
|
||||
default = null;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
config = let
|
||||
options =
|
||||
{
|
||||
manual_mode = cfg.manualMode;
|
||||
detection_methods = cfg.detectionMethods;
|
||||
patterns = cfg.patterns;
|
||||
|
@ -69,10 +73,11 @@ in
|
|||
silent_chdir = cfg.silentChdir;
|
||||
scope_schdir = cfg.scopeChdir;
|
||||
data_path = cfg.dataPath;
|
||||
} // cfg.extraOptions;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
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 = {
|
||||
enable = mkEnableOption "specs-nvim";
|
||||
|
||||
|
@ -73,15 +76,16 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { builtin = "linear_fader"; };
|
||||
default = {builtin = "linear_fader";};
|
||||
};
|
||||
|
||||
resizer = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
builtin = mkOption {
|
||||
type = types.nullOr
|
||||
(types.enum [ "shrink_resizer" "slide_resizer" "empty_resizer" ]);
|
||||
type =
|
||||
types.nullOr
|
||||
(types.enum ["shrink_resizer" "slide_resizer" "empty_resizer"]);
|
||||
default = "shrink_resizer";
|
||||
};
|
||||
|
||||
|
@ -98,48 +102,53 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
default = { builtin = "shrink_resizer"; };
|
||||
default = {builtin = "shrink_resizer";};
|
||||
};
|
||||
|
||||
ignored_filetypes = mkOption {
|
||||
type = with types; listOf string;
|
||||
default = [ ];
|
||||
default = [];
|
||||
};
|
||||
|
||||
ignored_buffertypes = mkOption {
|
||||
type = with types; listOf string;
|
||||
default = [ "nofile" ];
|
||||
default = ["nofile"];
|
||||
};
|
||||
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setup = helpers.toLuaObject {
|
||||
inherit (cfg) show_jumps min_jump;
|
||||
ignore_filetypes = attrsets.listToAttrs
|
||||
ignore_filetypes =
|
||||
attrsets.listToAttrs
|
||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||
cfg.ignored_filetypes);
|
||||
ignore_buftypes = attrsets.listToAttrs
|
||||
ignore_buftypes =
|
||||
attrsets.listToAttrs
|
||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||
cfg.ignored_buffertypes);
|
||||
popup = {
|
||||
inherit (cfg) blend width;
|
||||
winhl = if (!isNull cfg.color) then "SpecsPopColor" else "PMenu";
|
||||
winhl =
|
||||
if (!isNull cfg.color)
|
||||
then "SpecsPopColor"
|
||||
else "PMenu";
|
||||
delay_ms = cfg.delay;
|
||||
inc_ms = cfg.increment;
|
||||
fader = helpers.mkRaw (if cfg.fader.builtin == null then
|
||||
cfg.fader.custom
|
||||
else
|
||||
''require("specs").${cfg.fader.builtin}'');
|
||||
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
|
||||
cfg.resizer.custom
|
||||
else
|
||||
''require("specs").${cfg.resizer.builtin}'');
|
||||
fader = helpers.mkRaw (
|
||||
if cfg.fader.builtin == null
|
||||
then cfg.fader.custom
|
||||
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
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{ pkgs, lib, ... }@args:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with lib; with helpers;
|
||||
mkPlugin args {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib;
|
||||
with helpers;
|
||||
mkPlugin args {
|
||||
name = "startify";
|
||||
description = "Enable startify";
|
||||
package = pkgs.vimPlugins.vim-startify;
|
||||
|
@ -17,7 +22,8 @@ mkPlugin args {
|
|||
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 {
|
||||
type = types.listOf (types.oneOf [
|
||||
(types.submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.str;
|
||||
|
@ -35,11 +41,18 @@ mkPlugin args {
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
}) types.str]);
|
||||
})
|
||||
types.str
|
||||
]);
|
||||
|
||||
value = val: let
|
||||
list = map (v: if builtins.isAttrs v then toLuaObject v else v) val;
|
||||
in "{" + (concatStringsSep "," list) + "}";
|
||||
list = map (v:
|
||||
if builtins.isAttrs v
|
||||
then toLuaObject v
|
||||
else v)
|
||||
val;
|
||||
in
|
||||
"{" + (concatStringsSep "," list) + "}";
|
||||
};
|
||||
|
||||
bookmarks = mkDefaultOpt {
|
||||
|
@ -51,7 +64,7 @@ mkPlugin args {
|
|||
commands = mkDefaultOpt {
|
||||
description = "A list of commands to execute on selection";
|
||||
global = "startify_commands";
|
||||
type = with types; listOf (oneOf [ str (listOf str) attrs ]);
|
||||
type = with types; listOf (oneOf [str (listOf str) attrs]);
|
||||
};
|
||||
|
||||
filesNumber = mkDefaultOpt {
|
||||
|
@ -105,7 +118,7 @@ mkPlugin args {
|
|||
changeCmd = mkDefaultOpt {
|
||||
description = "The default command for switching directories";
|
||||
global = "startify_change_cmd";
|
||||
type = types.enum [ "cd" "lcd" "tcd" ];
|
||||
type = types.enum ["cd" "lcd" "tcd"];
|
||||
};
|
||||
|
||||
skipList = mkDefaultOpt {
|
||||
|
@ -183,7 +196,7 @@ mkPlugin args {
|
|||
customHeader = mkDefaultOpt {
|
||||
description = "Define your own header";
|
||||
global = "startify_custom_header";
|
||||
type = types.oneOf [ types.str (types.listOf types.str) ];
|
||||
type = types.oneOf [types.str (types.listOf types.str)];
|
||||
};
|
||||
|
||||
customQuotes = mkDefaultOpt {
|
||||
|
@ -217,4 +230,4 @@ mkPlugin args {
|
|||
type = types.bool;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
mkPlugin attrs {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "surround";
|
||||
description = "Enable surround.vim";
|
||||
package = pkgs.vimPlugins.surround;
|
||||
|
||||
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 = {
|
||||
plugins.undotree = {
|
||||
enable = mkEnableOption "Enable undotree";
|
||||
|
@ -110,7 +113,7 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
globals = {
|
||||
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
|
||||
|
|
|
@ -14,19 +14,27 @@
|
|||
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
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
pkgs-stable = import nixpkgs-stable { inherit system; };
|
||||
(system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
pkgs-stable = import nixpkgs-stable {inherit system;};
|
||||
build = nixvim.legacyPackages.${system}.makeNixvim;
|
||||
build-stable = nixvim-stable.legacyPackages.${system}.makeNixvim;
|
||||
in
|
||||
rec {
|
||||
in rec {
|
||||
# A plain nixvim configuration
|
||||
packages = {
|
||||
plain = build { };
|
||||
plain = build {};
|
||||
|
||||
# Should print "Hello!" when starting up
|
||||
hello = build {
|
||||
|
@ -34,11 +42,11 @@
|
|||
};
|
||||
|
||||
simple-plugin = build {
|
||||
extraPlugins = [ pkgs.vimPlugins.vim-surround ];
|
||||
extraPlugins = [pkgs.vimPlugins.vim-surround];
|
||||
};
|
||||
|
||||
gruvbox = build {
|
||||
extraPlugins = [ pkgs.vimPlugins.gruvbox ];
|
||||
extraPlugins = [pkgs.vimPlugins.gruvbox];
|
||||
colorscheme = "gruvbox";
|
||||
};
|
||||
|
||||
|
@ -118,7 +126,6 @@
|
|||
rnix-lsp.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
options = {
|
||||
|
@ -196,17 +203,16 @@
|
|||
};
|
||||
enable = true;
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{name = "nvim_lsp";}
|
||||
{
|
||||
name = "luasnip";
|
||||
option = {
|
||||
show_autosnippets = true;
|
||||
};
|
||||
}
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
|
||||
};
|
||||
barbar.enable = true;
|
||||
};
|
||||
|
@ -250,8 +256,8 @@
|
|||
autoCmd = build {
|
||||
autoCmd = [
|
||||
{
|
||||
event = [ "BufEnter" "BufWinEnter" ];
|
||||
pattern = [ "*.c" "*.h" ];
|
||||
event = ["BufEnter" "BufWinEnter"];
|
||||
pattern = ["*.c" "*.h"];
|
||||
command = "echo 'Entering a C or C++ file'";
|
||||
}
|
||||
{
|
||||
|
@ -275,22 +281,22 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
})) // {
|
||||
}))
|
||||
// {
|
||||
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
({ pkgs, ... }: {
|
||||
({pkgs, ...}: {
|
||||
environment.systemPackages = [
|
||||
(nixvim.build pkgs { colorschemes.gruvbox.enable = true; })
|
||||
(nixvim.build pkgs {colorschemes.gruvbox.enable = true;})
|
||||
];
|
||||
})
|
||||
];
|
||||
};
|
||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules =
|
||||
[
|
||||
({ pkgs, ... }: {
|
||||
modules = [
|
||||
({pkgs, ...}: {
|
||||
boot.isContainer = true;
|
||||
|
||||
# Let 'nixos-version --json' know about the Git revision
|
||||
|
|
|
@ -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 {
|
||||
type = mkOptionType {
|
||||
name = "helpers";
|
||||
|
@ -11,6 +12,6 @@ in
|
|||
check = builtins.isAttrs;
|
||||
};
|
||||
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:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
config.wrapRc = mkForce true;
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable mkMerge [
|
||||
{
|
||||
environment.systemPackages = [ cfg.finalPackage ];
|
||||
environment.systemPackages = [cfg.finalPackage];
|
||||
}
|
||||
{
|
||||
warnings = cfg.warnings;
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{ home.packages = [ cfg.finalPackage ]; }
|
||||
{home.packages = [cfg.finalPackage];}
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
||||
})
|
||||
({
|
||||
{
|
||||
warnings = cfg.warnings;
|
||||
assertions = cfg.assertions;
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,31 +1,36 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{ environment.systemPackages = [ cfg.finalPackage ]; }
|
||||
{environment.systemPackages = [cfg.finalPackage];}
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
environment.etc."nvim/sysinit.lua".text = cfg.initContent;
|
||||
environment.variables."VIM" = "/etc/nvim";
|
||||
})
|
||||
({
|
||||
{
|
||||
warnings = cfg.warnings;
|
||||
assertions = cfg.assertions;
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
default_pkgs: modules: {pkgs ? default_pkgs, module}:
|
||||
|
||||
let
|
||||
|
||||
default_pkgs: modules: {
|
||||
pkgs ? default_pkgs,
|
||||
module,
|
||||
}: let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
wrap = { wrapRc = true; };
|
||||
wrap = {wrapRc = true;};
|
||||
|
||||
eval = lib.evalModules {
|
||||
modules = (modules pkgs) ++ [ module wrap ];
|
||||
modules = (modules pkgs) ++ [module wrap];
|
||||
};
|
||||
|
||||
in eval.config.finalPackage
|
||||
in
|
||||
eval.config.finalPackage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue