mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
misc: fix mkEnableOption descriptions
This commit is contained in:
parent
23327700e2
commit
238f0c590e
39 changed files with 525 additions and 489 deletions
|
@ -5,7 +5,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.barbar = {
|
||||
enable = mkEnableOption "Enable barbar.nvim";
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -32,13 +32,13 @@ in
|
|||
};
|
||||
|
||||
icons = mkOption {
|
||||
type = with types; nullOr (oneOf [bool (enum ["numbers both"])]);
|
||||
type = with types; nullOr (oneOf [ bool (enum [ "numbers both" ]) ]);
|
||||
default = null;
|
||||
description = "Enable/disable icons";
|
||||
};
|
||||
|
||||
iconCustomColors = mkOption {
|
||||
type = with types; nullOr (oneOf [bool str]);
|
||||
type = with types; nullOr (oneOf [ bool str ]);
|
||||
default = null;
|
||||
description = "Sets the icon highlight group";
|
||||
};
|
||||
|
@ -56,7 +56,8 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package nvim-web-devicons
|
||||
cfg.package
|
||||
nvim-web-devicons
|
||||
];
|
||||
|
||||
# maps = genMaps cfg.keys;
|
||||
|
|
|
@ -25,7 +25,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.bufferline = {
|
||||
enable = mkEnableOption "Enable bufferline";
|
||||
enable = mkEnableOption "bufferline";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Plugin to use for bufferline";
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.base16 = {
|
||||
enable = mkEnableOption "Enable base16";
|
||||
enable = mkEnableOption "base16";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.gruvbox = {
|
||||
enable = mkEnableOption "Enable gruvbox";
|
||||
enable = mkEnableOption "gruvbox";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -15,10 +15,10 @@ in
|
|||
description = "Plugin to use for gruvbox";
|
||||
};
|
||||
|
||||
italics = mkEnableOption "Enable italics";
|
||||
bold = mkEnableOption "Enable bold";
|
||||
underline = mkEnableOption "Enable underlined text";
|
||||
undercurl = mkEnableOption "Enable undercurled text";
|
||||
italics = mkEnableOption "italics";
|
||||
bold = mkEnableOption "bold";
|
||||
underline = mkEnableOption "underlined text";
|
||||
undercurl = mkEnableOption "undercurled text";
|
||||
|
||||
contrastDark = mkOption {
|
||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
||||
|
@ -110,9 +110,9 @@ in
|
|||
description = "Improved warnings";
|
||||
};
|
||||
|
||||
transparentBg = mkEnableOption "Transparent background";
|
||||
transparentBg = mkEnableOption "transparent background";
|
||||
|
||||
trueColor = mkEnableOption "Enable true color support";
|
||||
trueColor = mkEnableOption "true color support";
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.nord = {
|
||||
enable = mkEnableOption "Enable nord";
|
||||
enable = mkEnableOption "nord";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.one = {
|
||||
enable = mkEnableOption "Enable vim-one";
|
||||
enable = mkEnableOption "vim-one";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.onedark = {
|
||||
enable = mkEnableOption "Enable onedark";
|
||||
enable = mkEnableOption "onedark";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -8,7 +8,7 @@ in
|
|||
{
|
||||
options = {
|
||||
colorschemes.tokyonight = {
|
||||
enable = mkEnableOption "Enable tokyonight";
|
||||
enable = mkEnableOption "tokyonight";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.vimPlugins.tokyonight-nvim;
|
||||
|
@ -24,8 +24,7 @@ in
|
|||
default = true;
|
||||
description = "Configure the colors used when opening a :terminal in Neovim";
|
||||
};
|
||||
transparent =
|
||||
mkEnableOption "Enable this to disable setting the background color";
|
||||
transparent = mkEnableOption "disable setting the background color";
|
||||
styles =
|
||||
let
|
||||
mkBackgroundStyle = name: mkOption {
|
||||
|
|
|
@ -6,7 +6,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.copilot = {
|
||||
enable = mkEnableOption "Enable copilot";
|
||||
enable = mkEnableOption "copilot";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "The copilot plugin package to use";
|
||||
|
|
|
@ -9,7 +9,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.coq-nvim = {
|
||||
enable = mkEnableOption "Enable coq-nvim";
|
||||
enable = mkEnableOption "coq-nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -15,7 +15,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.nvim-cmp = {
|
||||
enable = mkEnableOption "Enable nvim-cmp";
|
||||
enable = mkEnableOption "nvim-cmp";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.gitgutter = {
|
||||
enable = mkEnableOption "Enable gitgutter";
|
||||
enable = mkEnableOption "gitgutter";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
helpers,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, helpers
|
||||
, ...
|
||||
}:
|
||||
with lib; let
|
||||
signOptions = defaults:
|
||||
|
@ -28,7 +27,7 @@ with lib; let
|
|||
description = "Specifies the highlight group to use for the line";
|
||||
default = defaults.linehl;
|
||||
};
|
||||
showCount = mkEnableOption "Enable showing count of hunk, e.g. number of deleted lines";
|
||||
showCount = mkEnableOption "showing count of hunk, e.g. number of deleted lines";
|
||||
};
|
||||
signSetupOptions = values: {
|
||||
inherit (values) hl text numhl linehl;
|
||||
|
@ -41,7 +40,8 @@ with lib; let
|
|||
description = "Lua function definition";
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.gitsigns = {
|
||||
enable = mkEnableOption "Enable gitsigns plugin";
|
||||
package = mkOption {
|
||||
|
@ -87,18 +87,19 @@ in {
|
|||
linehl = "GitSignsAddLn";
|
||||
};
|
||||
};
|
||||
worktrees = let
|
||||
worktreeModule = {
|
||||
options = {
|
||||
toplevel = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
gitdir = mkOption {
|
||||
type = types.str;
|
||||
worktrees =
|
||||
let
|
||||
worktreeModule = {
|
||||
options = {
|
||||
toplevel = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
gitdir = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
in
|
||||
mkOption {
|
||||
type = types.nullOr (types.listOf (types.submodule worktreeModule));
|
||||
default = null;
|
||||
|
@ -166,58 +167,59 @@ in {
|
|||
'';
|
||||
};
|
||||
numhl = mkEnableOption ''
|
||||
Enable/disable line number highlights.
|
||||
line number highlights.
|
||||
|
||||
When enabled the highlights defined in `signs.*.numhl` are used. If
|
||||
the highlight group does not exist, then it is automatically defined
|
||||
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||
'';
|
||||
linehl = mkEnableOption ''
|
||||
Enable/disable line highlights.
|
||||
line highlights.
|
||||
|
||||
When enabled the highlights defined in `signs.*.linehl` are used. If
|
||||
the highlight group does not exist, then it is automatically defined
|
||||
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||
'';
|
||||
showDeleted = mkEnableOption ''
|
||||
Show the old version of hunks inline in the buffer (via virtual lines).
|
||||
showing the old version of hunks inline in the buffer (via virtual lines).
|
||||
|
||||
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||
'';
|
||||
diffOpts = let
|
||||
diffOptModule = {
|
||||
options = {
|
||||
algorithm = mkOption {
|
||||
type = types.enum ["myers" "minimal" "patience" "histogram"];
|
||||
default = "myers";
|
||||
description = "Diff algorithm to use";
|
||||
};
|
||||
internal = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Use Neovim's built in xdiff library for running diffs";
|
||||
};
|
||||
indentHeuristic = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Use the indent heuristic for the internal diff library.";
|
||||
};
|
||||
vertical = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Start diff mode with vertical splits";
|
||||
};
|
||||
linematch = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Enable second-stage diff on hunks to align lines.
|
||||
Requires `internal=true`.
|
||||
'';
|
||||
diffOpts =
|
||||
let
|
||||
diffOptModule = {
|
||||
options = {
|
||||
algorithm = mkOption {
|
||||
type = types.enum [ "myers" "minimal" "patience" "histogram" ];
|
||||
default = "myers";
|
||||
description = "Diff algorithm to use";
|
||||
};
|
||||
internal = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Use Neovim's built in xdiff library for running diffs";
|
||||
};
|
||||
indentHeuristic = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Use the indent heuristic for the internal diff library.";
|
||||
};
|
||||
vertical = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Start diff mode with vertical splits";
|
||||
};
|
||||
linematch = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Enable second-stage diff on hunks to align lines.
|
||||
Requires `internal=true`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
in
|
||||
mkOption {
|
||||
type = types.nullOr (types.submodule diffOptModule);
|
||||
default = null;
|
||||
|
@ -307,7 +309,7 @@ in {
|
|||
description = "Whether to show a virtual text blame annotation";
|
||||
};
|
||||
virtTextPos = mkOption {
|
||||
type = types.enum ["eol" "overlay" "right_align"];
|
||||
type = types.enum [ "eol" "overlay" "right_align" ];
|
||||
default = "eol";
|
||||
description = "Blame annotation position";
|
||||
};
|
||||
|
@ -352,7 +354,7 @@ in {
|
|||
window.
|
||||
'';
|
||||
};
|
||||
yadm.enable = mkEnableOption "Enable YADM support";
|
||||
yadm.enable = mkEnableOption "YADM support";
|
||||
wordDiff = mkEnableOption ''
|
||||
Highlight intra-line word differences in the buffer.
|
||||
Requires `config.diff_opts.internal = true`.
|
||||
|
@ -363,76 +365,84 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.plugins.gitsigns;
|
||||
in
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.gitsigns;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
];
|
||||
extraConfigLua = let
|
||||
luaFnOrStrToObj = val:
|
||||
if builtins.isString val
|
||||
then val
|
||||
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;}
|
||||
else null;
|
||||
watch_gitdir = {
|
||||
inherit (cfg.watchGitDir) enable interval;
|
||||
follow_files = cfg.watchGitDir.followFiles;
|
||||
};
|
||||
sign_priority = cfg.signPriority;
|
||||
show_deleted = cfg.showDeleted;
|
||||
diff_opts =
|
||||
if cfg.diffOpts == null
|
||||
then null
|
||||
else {
|
||||
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||
extraConfigLua =
|
||||
let
|
||||
luaFnOrStrToObj = val:
|
||||
if builtins.isString val
|
||||
then val
|
||||
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; }
|
||||
else null;
|
||||
watch_gitdir = {
|
||||
inherit (cfg.watchGitDir) enable interval;
|
||||
follow_files = cfg.watchGitDir.followFiles;
|
||||
};
|
||||
count_chars = let
|
||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||
in {
|
||||
__raw =
|
||||
"{"
|
||||
+ (concatStringsSep "," (
|
||||
lib.mapAttrsToList (
|
||||
name: value:
|
||||
if isStrInt name
|
||||
then "[${name}] = ${helpers.toLuaObject value}"
|
||||
else "[${helpers.toLuaObject name}] = ${helpers.toLuaObject value}"
|
||||
)
|
||||
cfg.countChars
|
||||
))
|
||||
+ "}";
|
||||
sign_priority = cfg.signPriority;
|
||||
show_deleted = cfg.showDeleted;
|
||||
diff_opts =
|
||||
if cfg.diffOpts == null
|
||||
then null
|
||||
else {
|
||||
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||
};
|
||||
count_chars =
|
||||
let
|
||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||
in
|
||||
{
|
||||
__raw =
|
||||
"{"
|
||||
+ (concatStringsSep "," (
|
||||
lib.mapAttrsToList
|
||||
(
|
||||
name: value:
|
||||
if isStrInt name
|
||||
then "[${name}] = ${helpers.toLuaObject value}"
|
||||
else "[${helpers.toLuaObject name}] = ${helpers.toLuaObject value}"
|
||||
)
|
||||
cfg.countChars
|
||||
))
|
||||
+ "}";
|
||||
};
|
||||
status_formatter = { __raw = cfg.statusFormatter.function; };
|
||||
max_file_length = cfg.maxFileLength;
|
||||
preview_config = cfg.previewConfig;
|
||||
attach_to_untracked = cfg.attachToUntracked;
|
||||
update_debounce = cfg.updateDebounce;
|
||||
current_line_blame = cfg.currentLineBlame;
|
||||
current_line_blame_opts =
|
||||
let
|
||||
cfgCl = cfg.currentLineBlameOpts;
|
||||
in
|
||||
{
|
||||
inherit (cfgCl) delay;
|
||||
virt_text = cfgCl.virtText;
|
||||
virt_text_pos = cfgCl.virtTextPos;
|
||||
ignore_whitespace = cfgCl.ignoreWhitespace;
|
||||
virt_text_priority = cfgCl.virtTextPriority;
|
||||
};
|
||||
current_line_blame_formatter = luaFnOrStrToObj cfg.currentLineBlameFormatter.normal;
|
||||
current_line_blame_formatter_nc = luaFnOrStrToObj cfg.currentLineBlameFormatter.nonCommitted;
|
||||
word_diff = cfg.wordDiff;
|
||||
debug_mode = cfg.debugMode;
|
||||
};
|
||||
status_formatter = {__raw = cfg.statusFormatter.function;};
|
||||
max_file_length = cfg.maxFileLength;
|
||||
preview_config = cfg.previewConfig;
|
||||
attach_to_untracked = cfg.attachToUntracked;
|
||||
update_debounce = cfg.updateDebounce;
|
||||
current_line_blame = cfg.currentLineBlame;
|
||||
current_line_blame_opts = let
|
||||
cfgCl = cfg.currentLineBlameOpts;
|
||||
in {
|
||||
inherit (cfgCl) delay;
|
||||
virt_text = cfgCl.virtText;
|
||||
virt_text_pos = cfgCl.virtTextPos;
|
||||
ignore_whitespace = cfgCl.ignoreWhitespace;
|
||||
virt_text_priority = cfgCl.virtTextPriority;
|
||||
};
|
||||
current_line_blame_formatter = luaFnOrStrToObj cfg.currentLineBlameFormatter.normal;
|
||||
current_line_blame_formatter_nc = luaFnOrStrToObj cfg.currentLineBlameFormatter.nonCommitted;
|
||||
word_diff = cfg.wordDiff;
|
||||
debug_mode = cfg.debugMode;
|
||||
};
|
||||
in ''
|
||||
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
in
|
||||
''
|
||||
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.neogit = {
|
||||
enable = mkEnableOption "Enable neogit";
|
||||
enable = mkEnableOption "neogit";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.plantuml-syntax = {
|
||||
enable = mkEnableOption "Enable plantuml syntax support";
|
||||
enable = mkEnableOption "plantuml syntax support";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -26,9 +25,10 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.plugins.plantuml-syntax;
|
||||
in
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.plantuml-syntax;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -1,218 +1,229 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, helpers
|
||||
, ...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.rust-tools = let
|
||||
mkNullableOptionWithDefault = {
|
||||
type,
|
||||
description,
|
||||
default,
|
||||
}:
|
||||
mkOption {
|
||||
type = types.nullOr type;
|
||||
default = null;
|
||||
description = ''
|
||||
${description}
|
||||
options.plugins.rust-tools =
|
||||
let
|
||||
mkNullableOptionWithDefault =
|
||||
{ type
|
||||
, description
|
||||
, default
|
||||
,
|
||||
}:
|
||||
mkOption {
|
||||
type = types.nullOr type;
|
||||
default = null;
|
||||
description = ''
|
||||
${description}
|
||||
|
||||
default: `${default}`
|
||||
'';
|
||||
default: `${default}`
|
||||
'';
|
||||
};
|
||||
|
||||
mkNullableBoolDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.bool;
|
||||
default = toString default;
|
||||
};
|
||||
|
||||
mkNullableStrDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.str;
|
||||
default = ''"${default}"'';
|
||||
};
|
||||
|
||||
mkNullableIntDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.int;
|
||||
default = toString default;
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = mkEnableOption "rust tools plugins";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.vimPlugins.rust-tools-nvim;
|
||||
description = "Package to use for rust-tools";
|
||||
};
|
||||
|
||||
mkNullableBoolDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.bool;
|
||||
default = toString default;
|
||||
executor = mkNullableOptionWithDefault {
|
||||
type = types.enum [ "termopen" "quickfix" ];
|
||||
default = ''"termopen"'';
|
||||
description = "how to execute terminal commands";
|
||||
};
|
||||
|
||||
mkNullableStrDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.str;
|
||||
default = ''"${default}"'';
|
||||
};
|
||||
|
||||
mkNullableIntDefault = default: description:
|
||||
mkNullableOptionWithDefault {
|
||||
inherit description;
|
||||
type = types.int;
|
||||
default = toString default;
|
||||
};
|
||||
in {
|
||||
enable = mkEnableOption "Enable rust tools plugins";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.vimPlugins.rust-tools-nvim;
|
||||
description = "Package to use for rust-tools";
|
||||
};
|
||||
|
||||
executor = mkNullableOptionWithDefault {
|
||||
type = types.enum ["termopen" "quickfix"];
|
||||
default = ''"termopen"'';
|
||||
description = "how to execute terminal commands";
|
||||
};
|
||||
|
||||
onIntialized = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Callback to execute once rust-analyzer is done initializing the workspace
|
||||
The callback receives one parameter indicating the `health` of the server:
|
||||
"ok" | "warning" | "error"
|
||||
'';
|
||||
};
|
||||
|
||||
reloadWorkspaceFromCargoToml = mkNullableBoolDefault true ''
|
||||
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
'';
|
||||
|
||||
inlayHints = {
|
||||
auto = mkNullableBoolDefault true "automatically set inlay hints (type hints)";
|
||||
|
||||
onlyCurrentLine = mkNullableBoolDefault false "Only show for current line";
|
||||
|
||||
showParameterHints =
|
||||
mkNullableBoolDefault true
|
||||
"whether to show parameter hints with the inlay hints or not";
|
||||
|
||||
parameterHintsPrefix = mkNullableStrDefault "<- " "prefix for parameter hints";
|
||||
otherHintsPrefix = mkNullableStrDefault "=> " "prefix for all the other hints (type, chaining)";
|
||||
|
||||
maxLenAlign =
|
||||
mkNullableBoolDefault false
|
||||
"whether to align to the length of the longest line in the file";
|
||||
|
||||
maxLenAlignPadding = mkNullableIntDefault 1 "padding from the left if max_len_align is true";
|
||||
|
||||
rightAlign = mkNullableBoolDefault false "whether to align to the extreme right or not";
|
||||
rightAlignPadding = mkNullableIntDefault 7 "padding from the right if right_align is true";
|
||||
|
||||
highlight = mkNullableStrDefault "Comment" "The color of the hints";
|
||||
};
|
||||
|
||||
hoverActions = {
|
||||
border = mkOption {
|
||||
type = types.nullOr types.anything;
|
||||
default = null;
|
||||
description = ''
|
||||
the border that is used for the hover window. see vim.api.nvim_open_win()
|
||||
'';
|
||||
};
|
||||
|
||||
maxWidth = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Maximal width of the hover window. Nil means no max.";
|
||||
};
|
||||
maxHeight = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Maximal height of the hover window. Nil means no max.";
|
||||
};
|
||||
|
||||
autoFocus = mkNullableBoolDefault false "whether the hover action window gets automatically focused";
|
||||
};
|
||||
|
||||
crateGraph = {
|
||||
backend = mkNullableStrDefault "x11" ''
|
||||
Backend used for displaying the graph
|
||||
see: https://graphviz.org/docs/outputs/
|
||||
'';
|
||||
|
||||
output = mkOption {
|
||||
onIntialized = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "where to store the output, nil for no output stored";
|
||||
};
|
||||
|
||||
full = mkNullableBoolDefault true ''
|
||||
true for all crates.io and external crates, false only the local crates
|
||||
'';
|
||||
|
||||
enabledGraphvizBackends = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of backends found on: https://graphviz.org/docs/outputs/
|
||||
Is used for input validation and autocompletion
|
||||
Callback to execute once rust-analyzer is done initializing the workspace
|
||||
The callback receives one parameter indicating the `health` of the server:
|
||||
"ok" | "warning" | "error"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
server =
|
||||
{
|
||||
standalone = mkNullableBoolDefault true ''
|
||||
standalone file support
|
||||
setting it to false may improve startup time
|
||||
'';
|
||||
}
|
||||
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
||||
};
|
||||
config = let
|
||||
cfg = config.plugins.rust-tools;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
|
||||
|
||||
plugins.lsp.postConfig = let
|
||||
setupOptions = {
|
||||
tools = {
|
||||
executor =
|
||||
if cfg.executor != null
|
||||
then {__raw = ''require("rust-tools.executors").${cfg.executor}'';}
|
||||
else null;
|
||||
|
||||
on_initialized =
|
||||
if cfg.onIntialized != null
|
||||
then {__raw = cfg.onIntialized;}
|
||||
else null;
|
||||
|
||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||
inlay_hints = let
|
||||
cfgIH = cfg.inlayHints;
|
||||
in {
|
||||
auto = cfgIH.auto;
|
||||
only_current_line = cfgIH.onlyCurrentLine;
|
||||
show_parameter_hints = cfgIH.showParameterHints;
|
||||
parameter_hints_prefix = cfgIH.parameterHintsPrefix;
|
||||
other_hints_prefix = cfgIH.otherHintsPrefix;
|
||||
max_len_align = cfgIH.maxLenAlign;
|
||||
max_len_align_padding = cfgIH.maxLenAlignPadding;
|
||||
right_align = cfgIH.rightAlign;
|
||||
right_align_padding = cfgIH.rightAlignPadding;
|
||||
highlight = cfgIH.highlight;
|
||||
};
|
||||
|
||||
hover_actions = let
|
||||
cfgHA = cfg.hoverActions;
|
||||
in {
|
||||
border = cfgHA.border;
|
||||
max_width = cfgHA.maxWidth;
|
||||
max_height = cfgHA.maxHeight;
|
||||
auto_focus = cfgHA.autoFocus;
|
||||
};
|
||||
|
||||
crate_graph = let
|
||||
cfgCG = cfg.crateGraph;
|
||||
in {
|
||||
backend = cfgCG.backend;
|
||||
output = cfgCG.output;
|
||||
full = cfgCG.full;
|
||||
enabled_graphviz_backends = cfgCG.enabledGraphvizBackends;
|
||||
};
|
||||
};
|
||||
server = {
|
||||
standalone = cfg.server.standalone;
|
||||
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
||||
on_attach = {__raw = "__lspOnAttach";};
|
||||
};
|
||||
};
|
||||
in ''
|
||||
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
||||
reloadWorkspaceFromCargoToml = mkNullableBoolDefault true ''
|
||||
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
'';
|
||||
|
||||
inlayHints = {
|
||||
auto = mkNullableBoolDefault true "automatically set inlay hints (type hints)";
|
||||
|
||||
onlyCurrentLine = mkNullableBoolDefault false "Only show for current line";
|
||||
|
||||
showParameterHints =
|
||||
mkNullableBoolDefault true
|
||||
"whether to show parameter hints with the inlay hints or not";
|
||||
|
||||
parameterHintsPrefix = mkNullableStrDefault "<- " "prefix for parameter hints";
|
||||
otherHintsPrefix = mkNullableStrDefault "=> " "prefix for all the other hints (type, chaining)";
|
||||
|
||||
maxLenAlign =
|
||||
mkNullableBoolDefault false
|
||||
"whether to align to the length of the longest line in the file";
|
||||
|
||||
maxLenAlignPadding = mkNullableIntDefault 1 "padding from the left if max_len_align is true";
|
||||
|
||||
rightAlign = mkNullableBoolDefault false "whether to align to the extreme right or not";
|
||||
rightAlignPadding = mkNullableIntDefault 7 "padding from the right if right_align is true";
|
||||
|
||||
highlight = mkNullableStrDefault "Comment" "The color of the hints";
|
||||
};
|
||||
|
||||
hoverActions = {
|
||||
border = mkOption {
|
||||
type = types.nullOr types.anything;
|
||||
default = null;
|
||||
description = ''
|
||||
the border that is used for the hover window. see vim.api.nvim_open_win()
|
||||
'';
|
||||
};
|
||||
|
||||
maxWidth = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Maximal width of the hover window. Nil means no max.";
|
||||
};
|
||||
maxHeight = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Maximal height of the hover window. Nil means no max.";
|
||||
};
|
||||
|
||||
autoFocus = mkNullableBoolDefault false "whether the hover action window gets automatically focused";
|
||||
};
|
||||
|
||||
crateGraph = {
|
||||
backend = mkNullableStrDefault "x11" ''
|
||||
Backend used for displaying the graph
|
||||
see: https://graphviz.org/docs/outputs/
|
||||
'';
|
||||
|
||||
output = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "where to store the output, nil for no output stored";
|
||||
};
|
||||
|
||||
full = mkNullableBoolDefault true ''
|
||||
true for all crates.io and external crates, false only the local crates
|
||||
'';
|
||||
|
||||
enabledGraphvizBackends = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of backends found on: https://graphviz.org/docs/outputs/
|
||||
Is used for input validation and autocompletion
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
server =
|
||||
{
|
||||
standalone = mkNullableBoolDefault true ''
|
||||
standalone file support
|
||||
setting it to false may improve startup time
|
||||
'';
|
||||
}
|
||||
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
||||
};
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.rust-tools;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [ nvim-lspconfig cfg.package ];
|
||||
|
||||
plugins.lsp.postConfig =
|
||||
let
|
||||
setupOptions = {
|
||||
tools = {
|
||||
executor =
|
||||
if cfg.executor != null
|
||||
then { __raw = ''require("rust-tools.executors").${cfg.executor}''; }
|
||||
else null;
|
||||
|
||||
on_initialized =
|
||||
if cfg.onIntialized != null
|
||||
then { __raw = cfg.onIntialized; }
|
||||
else null;
|
||||
|
||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||
inlay_hints =
|
||||
let
|
||||
cfgIH = cfg.inlayHints;
|
||||
in
|
||||
{
|
||||
auto = cfgIH.auto;
|
||||
only_current_line = cfgIH.onlyCurrentLine;
|
||||
show_parameter_hints = cfgIH.showParameterHints;
|
||||
parameter_hints_prefix = cfgIH.parameterHintsPrefix;
|
||||
other_hints_prefix = cfgIH.otherHintsPrefix;
|
||||
max_len_align = cfgIH.maxLenAlign;
|
||||
max_len_align_padding = cfgIH.maxLenAlignPadding;
|
||||
right_align = cfgIH.rightAlign;
|
||||
right_align_padding = cfgIH.rightAlignPadding;
|
||||
highlight = cfgIH.highlight;
|
||||
};
|
||||
|
||||
hover_actions =
|
||||
let
|
||||
cfgHA = cfg.hoverActions;
|
||||
in
|
||||
{
|
||||
border = cfgHA.border;
|
||||
max_width = cfgHA.maxWidth;
|
||||
max_height = cfgHA.maxHeight;
|
||||
auto_focus = cfgHA.autoFocus;
|
||||
};
|
||||
|
||||
crate_graph =
|
||||
let
|
||||
cfgCG = cfg.crateGraph;
|
||||
in
|
||||
{
|
||||
backend = cfgCG.backend;
|
||||
output = cfgCG.output;
|
||||
full = cfgCG.full;
|
||||
enabled_graphviz_backends = cfgCG.enabledGraphvizBackends;
|
||||
};
|
||||
};
|
||||
server = {
|
||||
standalone = cfg.server.standalone;
|
||||
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
|
||||
on_attach = { __raw = "__lspOnAttach"; };
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}:
|
||||
with lib; {
|
||||
options.plugins.treesitter-context = {
|
||||
enable = mkEnableOption "Enable nvim-treesitter-context";
|
||||
enable = mkEnableOption "nvim-treesitter-context";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -15,7 +15,7 @@ with lib; {
|
|||
{
|
||||
enable =
|
||||
mkEnableOption
|
||||
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -39,7 +39,7 @@ with lib; {
|
|||
};
|
||||
highlightCurrentScope = {
|
||||
inherit disable;
|
||||
enable = mkEnableOption "Highlights the block from the current scope where the cursor is.";
|
||||
enable = mkEnableOption "highlights the block from the current scope where the cursor is.";
|
||||
};
|
||||
smartRename = {
|
||||
inherit disable;
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.treesitter = {
|
||||
enable = mkEnableOption "Enable tree-sitter syntax highlighting";
|
||||
enable = mkEnableOption "tree-sitter syntax highlighting";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -66,7 +66,7 @@ in
|
|||
};
|
||||
in
|
||||
{
|
||||
enable = mkEnableOption "Incremental selection based on the named nodes from the grammar";
|
||||
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
||||
keymaps = {
|
||||
initSelection = keymap "gnn";
|
||||
nodeIncremental = keymap "grn";
|
||||
|
@ -75,9 +75,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
indent = mkEnableOption "Enable tree-sitter based indentation";
|
||||
indent = mkEnableOption "tree-sitter based indentation";
|
||||
|
||||
folding = mkEnableOption "Enable tree-sitter based folding";
|
||||
folding = mkEnableOption "tree-sitter based folding";
|
||||
|
||||
grammarPackages = mkOption {
|
||||
type = with types; listOf package;
|
||||
|
|
|
@ -10,7 +10,7 @@ in
|
|||
];
|
||||
|
||||
options.plugins.null-ls = {
|
||||
enable = mkEnableOption "Enable null-ls";
|
||||
enable = mkEnableOption "null-ls";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
mkServer =
|
||||
{ name
|
||||
, sourceType
|
||||
, description ? "Enable ${name} source, for null-ls."
|
||||
, description ? "${name} source, for null-ls."
|
||||
, package ? null
|
||||
, extraPackages ? [ ]
|
||||
, ...
|
||||
|
|
|
@ -11,7 +11,7 @@ in
|
|||
|
||||
options = {
|
||||
plugins.lsp = {
|
||||
enable = mkEnableOption "Enable neovim's built-in LSP";
|
||||
enable = mkEnableOption "neovim's built-in LSP";
|
||||
|
||||
enabledServers = mkOption {
|
||||
type = with types; listOf (oneOf [
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.lspsaga = {
|
||||
enable = mkEnableOption "Enable lspsava.nvim";
|
||||
enable = mkEnableOption "lspsaga.nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -111,27 +111,29 @@ in
|
|||
description = "Maximum finder preview lines";
|
||||
};
|
||||
|
||||
keys = let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in {
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
split = defaultKeyOpt "Horizontal split in finder";
|
||||
quit = defaultKeyOpt "Quit finder";
|
||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||
};
|
||||
keys =
|
||||
let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
split = defaultKeyOpt "Horizontal split in finder";
|
||||
quit = defaultKeyOpt "Quit finder";
|
||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||
};
|
||||
|
||||
codeAction = {
|
||||
quit = defaultKeyOpt "Quit code actions menu";
|
||||
exec = defaultKeyOpt "Execute code action";
|
||||
codeAction = {
|
||||
quit = defaultKeyOpt "Quit code actions menu";
|
||||
exec = defaultKeyOpt "Execute code action";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
borderStyle = mkOption {
|
||||
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
||||
|
@ -147,67 +149,76 @@ 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;
|
||||
notNull = opt: opt;
|
||||
lspsagaConfig = {
|
||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||
error_sign = notNull cfg.signs.error;
|
||||
warn_sign = notNull cfg.signs.warning;
|
||||
hint_sign = notNull cfg.signs.hint;
|
||||
infor_sign = notNull cfg.signs.info;
|
||||
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;
|
||||
error_sign = notNull cfg.signs.error;
|
||||
warn_sign = notNull cfg.signs.warning;
|
||||
hint_sign = notNull cfg.signs.hint;
|
||||
infor_sign = notNull cfg.signs.info;
|
||||
|
||||
# TODO Fix this!
|
||||
# error_header = notNull cfg.headers.error;
|
||||
# warn_header = notNull cfg.headers.warning;
|
||||
# hint_header = notNull cfg.headers.hint;
|
||||
# infor_header = notNull cfg.headers.info;
|
||||
# TODO Fix this!
|
||||
# error_header = notNull cfg.headers.error;
|
||||
# warn_header = notNull cfg.headers.warning;
|
||||
# hint_header = notNull cfg.headers.hint;
|
||||
# infor_header = notNull cfg.headers.info;
|
||||
|
||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||
|
||||
code_action_icon = notNull cfg.icons.codeAction;
|
||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||
finder_reference_icon = notNull cfg.icons.findReference;
|
||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||
code_action_icon = notNull cfg.icons.codeAction;
|
||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||
finder_reference_icon = notNull cfg.icons.findReference;
|
||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||
|
||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
|
||||
border_style = let
|
||||
borderStyle = if cfg.borderStyle == "thin" then 1
|
||||
else if cfg.borderStyle == "rounded" then 2
|
||||
else if cfg.borderStyle == "thick" then 3
|
||||
else null;
|
||||
in borderStyle;
|
||||
border_style =
|
||||
let
|
||||
borderStyle =
|
||||
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
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
split = notNull cfg.keys.finderAction.split;
|
||||
quit = notNull cfg.keys.finderAction.quit;
|
||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||
};
|
||||
in notEmpty keys;
|
||||
finder_action_keys =
|
||||
let
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
split = notNull cfg.keys.finderAction.split;
|
||||
quit = notNull cfg.keys.finderAction.quit;
|
||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||
};
|
||||
in
|
||||
notEmpty keys;
|
||||
|
||||
code_action_keys = let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
};
|
||||
in notEmpty keys;
|
||||
code_action_keys =
|
||||
let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
};
|
||||
in
|
||||
notEmpty keys;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
local saga = require 'lspsaga'
|
||||
|
||||
saga.init_lsp_saga(${helpers.toLuaObject lspsagaConfig})
|
||||
'';
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
local saga = require 'lspsaga'
|
||||
|
||||
saga.init_lsp_saga(${helpers.toLuaObject lspsagaConfig})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.packer = {
|
||||
enable = mkEnableOption "Enable packer.nvim";
|
||||
enable = mkEnableOption "packer.nvim";
|
||||
|
||||
plugins = mkOption {
|
||||
type = types.listOf (types.oneOf [
|
||||
|
|
|
@ -14,7 +14,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.airline = {
|
||||
enable = mkEnableOption "Enable airline";
|
||||
enable = mkEnableOption "airline";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.lightline = {
|
||||
enable = mkEnableOption "Enable lightline";
|
||||
enable = mkEnableOption "lightline";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -56,7 +56,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.lualine = {
|
||||
enable = mkEnableOption "Enable lualine";
|
||||
enable = mkEnableOption "lualine";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -16,7 +16,7 @@ in
|
|||
# TODO:add support for aditional filetypes. This requires autocommands!
|
||||
|
||||
options.plugins.telescope = {
|
||||
enable = mkEnableOption "Enable telescope.nvim";
|
||||
enable = mkEnableOption "telescope.nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -68,21 +68,23 @@ in
|
|||
let $BAT_THEME = '${cfg.highlightTheme}'
|
||||
'';
|
||||
|
||||
extraConfigLua = let
|
||||
options = {
|
||||
extensions = cfg.extensionConfig;
|
||||
defaults = cfg.defaults;
|
||||
} // cfg.extraOptions;
|
||||
in ''
|
||||
do
|
||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||
extraConfigLua =
|
||||
let
|
||||
options = {
|
||||
extensions = cfg.extensionConfig;
|
||||
defaults = cfg.defaults;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
do
|
||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||
|
||||
require('telescope').setup(${helpers.toLuaObject options})
|
||||
require('telescope').setup(${helpers.toLuaObject options})
|
||||
|
||||
for i, extension in ipairs(__telescopeExtensions) do
|
||||
require('telescope').load_extension(extension)
|
||||
for i, extension in ipairs(__telescopeExtensions) do
|
||||
require('telescope').load_extension(extension)
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.telescope.extensions.frecency = {
|
||||
enable = mkEnableOption "Enable frecency";
|
||||
enable = mkEnableOption "frecency";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -50,24 +50,26 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
configuration = {
|
||||
db_root = cfg.dbRoot;
|
||||
default_workspace = cfg.defaultWorkspace;
|
||||
ignore_patterns = cfg.ignorePatterns;
|
||||
show_scores = cfg.showScores;
|
||||
workspaces = cfg.workspaces;
|
||||
show_unindexed = cfg.showUnindexed;
|
||||
devicons_disabled = cfg.deviconsDisabled;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
extraPackages = [ pkgs.sqlite ];
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
sqlite-lua
|
||||
];
|
||||
config =
|
||||
let
|
||||
configuration = {
|
||||
db_root = cfg.dbRoot;
|
||||
default_workspace = cfg.defaultWorkspace;
|
||||
ignore_patterns = cfg.ignorePatterns;
|
||||
show_scores = cfg.showScores;
|
||||
workspaces = cfg.workspaces;
|
||||
show_unindexed = cfg.showUnindexed;
|
||||
devicons_disabled = cfg.deviconsDisabled;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPackages = [ pkgs.sqlite ];
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
cfg.package
|
||||
sqlite-lua
|
||||
];
|
||||
|
||||
plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||
plugins.telescope.extensionConfig."frecency" = configuration;
|
||||
};
|
||||
plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||
plugins.telescope.extensionConfig."frecency" = configuration;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{ pkgs, config, lib, ...}:
|
||||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||
in
|
||||
{
|
||||
options.plugins.telescope.extensions.project-nvim = {
|
||||
enable = mkEnableOption "Enable project-nvim telescope extension";
|
||||
enable = mkEnableOption "project-nvim telescope extension";
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ in
|
|||
|
||||
options = {
|
||||
plugins.commentary = {
|
||||
enable = mkEnableOption "Enable commentary";
|
||||
enable = mkEnableOption "commentary";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.vimPlugins.vim-commentary;
|
||||
default = pkgs.vimPlugins.vim-commentary;
|
||||
description = "Plugin to use for vim-commentary";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.dashboard = {
|
||||
enable = mkEnableOption "Enable dashboard";
|
||||
enable = mkEnableOption "dashboard";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.floaterm = {
|
||||
enable = mkEnableOption "Enable floaterm";
|
||||
enable = mkEnableOption "floaterm";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -8,7 +8,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.mark-radar = {
|
||||
enable = mkEnableOption "Enable mark-radar";
|
||||
enable = mkEnableOption "mark-radar";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -10,7 +10,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.notify = {
|
||||
enable = mkEnableOption "Enable notify";
|
||||
enable = mkEnableOption "notify";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.nvim-autopairs = {
|
||||
enable = mkEnableOption "Enable nvim-autopairs";
|
||||
enable = mkEnableOption "nvim-autopairs";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.nvim-tree = {
|
||||
enable = mkEnableOption "Enable nvim-tree";
|
||||
enable = mkEnableOption "nvim-tree";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.project-nvim = helpers.extraOptionsOptions // {
|
||||
enable = mkEnableOption "Enable project.nvim";
|
||||
enable = mkEnableOption "project.nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
in
|
||||
{
|
||||
options.plugins.specs = {
|
||||
enable = mkEnableOption "Enable specs-nvim";
|
||||
enable = mkEnableOption "specs-nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue