mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +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
|
in
|
||||||
{
|
{
|
||||||
options.plugins.barbar = {
|
options.plugins.barbar = {
|
||||||
enable = mkEnableOption "Enable barbar.nvim";
|
enable = mkEnableOption "barbar.nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -32,13 +32,13 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
icons = mkOption {
|
icons = mkOption {
|
||||||
type = with types; nullOr (oneOf [bool (enum ["numbers both"])]);
|
type = with types; nullOr (oneOf [ bool (enum [ "numbers both" ]) ]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Enable/disable icons";
|
description = "Enable/disable icons";
|
||||||
};
|
};
|
||||||
|
|
||||||
iconCustomColors = mkOption {
|
iconCustomColors = mkOption {
|
||||||
type = with types; nullOr (oneOf [bool str]);
|
type = with types; nullOr (oneOf [ bool str ]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Sets the icon highlight group";
|
description = "Sets the icon highlight group";
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,8 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package nvim-web-devicons
|
cfg.package
|
||||||
|
nvim-web-devicons
|
||||||
];
|
];
|
||||||
|
|
||||||
# maps = genMaps cfg.keys;
|
# maps = genMaps cfg.keys;
|
||||||
|
|
|
@ -25,7 +25,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.bufferline = {
|
plugins.bufferline = {
|
||||||
enable = mkEnableOption "Enable bufferline";
|
enable = mkEnableOption "bufferline";
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
description = "Plugin to use for bufferline";
|
description = "Plugin to use for bufferline";
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.base16 = {
|
colorschemes.base16 = {
|
||||||
enable = mkEnableOption "Enable base16";
|
enable = mkEnableOption "base16";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.gruvbox = {
|
colorschemes.gruvbox = {
|
||||||
enable = mkEnableOption "Enable gruvbox";
|
enable = mkEnableOption "gruvbox";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -15,10 +15,10 @@ in
|
||||||
description = "Plugin to use for gruvbox";
|
description = "Plugin to use for gruvbox";
|
||||||
};
|
};
|
||||||
|
|
||||||
italics = mkEnableOption "Enable italics";
|
italics = mkEnableOption "italics";
|
||||||
bold = mkEnableOption "Enable bold";
|
bold = mkEnableOption "bold";
|
||||||
underline = mkEnableOption "Enable underlined text";
|
underline = mkEnableOption "underlined text";
|
||||||
undercurl = mkEnableOption "Enable undercurled text";
|
undercurl = mkEnableOption "undercurled text";
|
||||||
|
|
||||||
contrastDark = mkOption {
|
contrastDark = mkOption {
|
||||||
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
type = types.nullOr (types.enum [ "soft" "medium" "hard" ]);
|
||||||
|
@ -110,9 +110,9 @@ in
|
||||||
description = "Improved warnings";
|
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 = {
|
options = {
|
||||||
colorschemes.nord = {
|
colorschemes.nord = {
|
||||||
enable = mkEnableOption "Enable nord";
|
enable = mkEnableOption "nord";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.one = {
|
colorschemes.one = {
|
||||||
enable = mkEnableOption "Enable vim-one";
|
enable = mkEnableOption "vim-one";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.onedark = {
|
colorschemes.onedark = {
|
||||||
enable = mkEnableOption "Enable onedark";
|
enable = mkEnableOption "onedark";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -8,7 +8,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.tokyonight = {
|
colorschemes.tokyonight = {
|
||||||
enable = mkEnableOption "Enable tokyonight";
|
enable = mkEnableOption "tokyonight";
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.vimPlugins.tokyonight-nvim;
|
default = pkgs.vimPlugins.tokyonight-nvim;
|
||||||
|
@ -24,8 +24,7 @@ in
|
||||||
default = true;
|
default = true;
|
||||||
description = "Configure the colors used when opening a :terminal in Neovim";
|
description = "Configure the colors used when opening a :terminal in Neovim";
|
||||||
};
|
};
|
||||||
transparent =
|
transparent = mkEnableOption "disable setting the background color";
|
||||||
mkEnableOption "Enable this to disable setting the background color";
|
|
||||||
styles =
|
styles =
|
||||||
let
|
let
|
||||||
mkBackgroundStyle = name: mkOption {
|
mkBackgroundStyle = name: mkOption {
|
||||||
|
|
|
@ -6,7 +6,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.copilot = {
|
plugins.copilot = {
|
||||||
enable = mkEnableOption "Enable copilot";
|
enable = mkEnableOption "copilot";
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
description = "The copilot plugin package to use";
|
description = "The copilot plugin package to use";
|
||||||
|
|
|
@ -9,7 +9,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.coq-nvim = {
|
plugins.coq-nvim = {
|
||||||
enable = mkEnableOption "Enable coq-nvim";
|
enable = mkEnableOption "coq-nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -15,7 +15,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.nvim-cmp = {
|
options.plugins.nvim-cmp = {
|
||||||
enable = mkEnableOption "Enable nvim-cmp";
|
enable = mkEnableOption "nvim-cmp";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.gitgutter = {
|
plugins.gitgutter = {
|
||||||
enable = mkEnableOption "Enable gitgutter";
|
enable = mkEnableOption "gitgutter";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{ config
|
||||||
config,
|
, lib
|
||||||
lib,
|
, pkgs
|
||||||
pkgs,
|
, helpers
|
||||||
helpers,
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
signOptions = defaults:
|
signOptions = defaults:
|
||||||
|
@ -28,7 +27,7 @@ with lib; let
|
||||||
description = "Specifies the highlight group to use for the line";
|
description = "Specifies the highlight group to use for the line";
|
||||||
default = defaults.linehl;
|
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: {
|
signSetupOptions = values: {
|
||||||
inherit (values) hl text numhl linehl;
|
inherit (values) hl text numhl linehl;
|
||||||
|
@ -41,7 +40,8 @@ with lib; let
|
||||||
description = "Lua function definition";
|
description = "Lua function definition";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.plugins.gitsigns = {
|
options.plugins.gitsigns = {
|
||||||
enable = mkEnableOption "Enable gitsigns plugin";
|
enable = mkEnableOption "Enable gitsigns plugin";
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
@ -87,18 +87,19 @@ in {
|
||||||
linehl = "GitSignsAddLn";
|
linehl = "GitSignsAddLn";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
worktrees = let
|
worktrees =
|
||||||
worktreeModule = {
|
let
|
||||||
options = {
|
worktreeModule = {
|
||||||
toplevel = mkOption {
|
options = {
|
||||||
type = types.str;
|
toplevel = mkOption {
|
||||||
};
|
type = types.str;
|
||||||
gitdir = mkOption {
|
};
|
||||||
type = types.str;
|
gitdir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.nullOr (types.listOf (types.submodule worktreeModule));
|
type = types.nullOr (types.listOf (types.submodule worktreeModule));
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -166,58 +167,59 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
numhl = mkEnableOption ''
|
numhl = mkEnableOption ''
|
||||||
Enable/disable line number highlights.
|
line number highlights.
|
||||||
|
|
||||||
When enabled the highlights defined in `signs.*.numhl` are used. If
|
When enabled the highlights defined in `signs.*.numhl` are used. If
|
||||||
the highlight group does not exist, then it is automatically defined
|
the highlight group does not exist, then it is automatically defined
|
||||||
and linked to the corresponding highlight group in `signs.*.hl`.
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||||
'';
|
'';
|
||||||
linehl = mkEnableOption ''
|
linehl = mkEnableOption ''
|
||||||
Enable/disable line highlights.
|
line highlights.
|
||||||
|
|
||||||
When enabled the highlights defined in `signs.*.linehl` are used. If
|
When enabled the highlights defined in `signs.*.linehl` are used. If
|
||||||
the highlight group does not exist, then it is automatically defined
|
the highlight group does not exist, then it is automatically defined
|
||||||
and linked to the corresponding highlight group in `signs.*.hl`.
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
||||||
'';
|
'';
|
||||||
showDeleted = mkEnableOption ''
|
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`.
|
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||||
'';
|
'';
|
||||||
diffOpts = let
|
diffOpts =
|
||||||
diffOptModule = {
|
let
|
||||||
options = {
|
diffOptModule = {
|
||||||
algorithm = mkOption {
|
options = {
|
||||||
type = types.enum ["myers" "minimal" "patience" "histogram"];
|
algorithm = mkOption {
|
||||||
default = "myers";
|
type = types.enum [ "myers" "minimal" "patience" "histogram" ];
|
||||||
description = "Diff algorithm to use";
|
default = "myers";
|
||||||
};
|
description = "Diff algorithm to use";
|
||||||
internal = mkOption {
|
};
|
||||||
type = types.bool;
|
internal = mkOption {
|
||||||
default = false;
|
type = types.bool;
|
||||||
description = "Use Neovim's built in xdiff library for running diffs";
|
default = false;
|
||||||
};
|
description = "Use Neovim's built in xdiff library for running diffs";
|
||||||
indentHeuristic = mkOption {
|
};
|
||||||
type = types.bool;
|
indentHeuristic = mkOption {
|
||||||
default = false;
|
type = types.bool;
|
||||||
description = "Use the indent heuristic for the internal diff library.";
|
default = false;
|
||||||
};
|
description = "Use the indent heuristic for the internal diff library.";
|
||||||
vertical = mkOption {
|
};
|
||||||
type = types.bool;
|
vertical = mkOption {
|
||||||
default = true;
|
type = types.bool;
|
||||||
description = "Start diff mode with vertical splits";
|
default = true;
|
||||||
};
|
description = "Start diff mode with vertical splits";
|
||||||
linematch = mkOption {
|
};
|
||||||
type = types.nullOr types.int;
|
linematch = mkOption {
|
||||||
default = null;
|
type = types.nullOr types.int;
|
||||||
description = ''
|
default = null;
|
||||||
Enable second-stage diff on hunks to align lines.
|
description = ''
|
||||||
Requires `internal=true`.
|
Enable second-stage diff on hunks to align lines.
|
||||||
'';
|
Requires `internal=true`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
in
|
||||||
in
|
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.nullOr (types.submodule diffOptModule);
|
type = types.nullOr (types.submodule diffOptModule);
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -307,7 +309,7 @@ in {
|
||||||
description = "Whether to show a virtual text blame annotation";
|
description = "Whether to show a virtual text blame annotation";
|
||||||
};
|
};
|
||||||
virtTextPos = mkOption {
|
virtTextPos = mkOption {
|
||||||
type = types.enum ["eol" "overlay" "right_align"];
|
type = types.enum [ "eol" "overlay" "right_align" ];
|
||||||
default = "eol";
|
default = "eol";
|
||||||
description = "Blame annotation position";
|
description = "Blame annotation position";
|
||||||
};
|
};
|
||||||
|
@ -352,7 +354,7 @@ in {
|
||||||
window.
|
window.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
yadm.enable = mkEnableOption "Enable YADM support";
|
yadm.enable = mkEnableOption "YADM support";
|
||||||
wordDiff = mkEnableOption ''
|
wordDiff = mkEnableOption ''
|
||||||
Highlight intra-line word differences in the buffer.
|
Highlight intra-line word differences in the buffer.
|
||||||
Requires `config.diff_opts.internal = true`.
|
Requires `config.diff_opts.internal = true`.
|
||||||
|
@ -363,76 +365,84 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
cfg = config.plugins.gitsigns;
|
let
|
||||||
in
|
cfg = config.plugins.gitsigns;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
cfg.package
|
cfg.package
|
||||||
];
|
];
|
||||||
extraConfigLua = let
|
extraConfigLua =
|
||||||
luaFnOrStrToObj = val:
|
let
|
||||||
if builtins.isString val
|
luaFnOrStrToObj = val:
|
||||||
then val
|
if builtins.isString val
|
||||||
else {__raw = val.function;};
|
then val
|
||||||
setupOptions = {
|
else { __raw = val.function; };
|
||||||
inherit (cfg) worktrees signcolumn numhl linehl trouble yadm;
|
setupOptions = {
|
||||||
signs = mapAttrs (_: signSetupOptions) cfg.signs;
|
inherit (cfg) worktrees signcolumn numhl linehl trouble yadm;
|
||||||
on_attach =
|
signs = mapAttrs (_: signSetupOptions) cfg.signs;
|
||||||
if cfg.onAttach != null
|
on_attach =
|
||||||
then {__raw = cfg.onAttach.function;}
|
if cfg.onAttach != null
|
||||||
else null;
|
then { __raw = cfg.onAttach.function; }
|
||||||
watch_gitdir = {
|
else null;
|
||||||
inherit (cfg.watchGitDir) enable interval;
|
watch_gitdir = {
|
||||||
follow_files = cfg.watchGitDir.followFiles;
|
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;
|
|
||||||
};
|
};
|
||||||
count_chars = let
|
sign_priority = cfg.signPriority;
|
||||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
show_deleted = cfg.showDeleted;
|
||||||
in {
|
diff_opts =
|
||||||
__raw =
|
if cfg.diffOpts == null
|
||||||
"{"
|
then null
|
||||||
+ (concatStringsSep "," (
|
else {
|
||||||
lib.mapAttrsToList (
|
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||||
name: value:
|
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||||
if isStrInt name
|
};
|
||||||
then "[${name}] = ${helpers.toLuaObject value}"
|
count_chars =
|
||||||
else "[${helpers.toLuaObject name}] = ${helpers.toLuaObject value}"
|
let
|
||||||
)
|
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||||
cfg.countChars
|
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;};
|
in
|
||||||
max_file_length = cfg.maxFileLength;
|
''
|
||||||
preview_config = cfg.previewConfig;
|
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||||
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})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.neogit = {
|
plugins.neogit = {
|
||||||
enable = mkEnableOption "Enable neogit";
|
enable = mkEnableOption "neogit";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, lib
|
||||||
lib,
|
, config
|
||||||
config,
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib; {
|
||||||
options.plugins.plantuml-syntax = {
|
options.plugins.plantuml-syntax = {
|
||||||
enable = mkEnableOption "Enable plantuml syntax support";
|
enable = mkEnableOption "plantuml syntax support";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -26,9 +25,10 @@ with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
cfg = config.plugins.plantuml-syntax;
|
let
|
||||||
in
|
cfg = config.plugins.plantuml-syntax;
|
||||||
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
|
|
|
@ -1,218 +1,229 @@
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, config
|
||||||
config,
|
, lib
|
||||||
lib,
|
, helpers
|
||||||
helpers,
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib; {
|
||||||
options.plugins.rust-tools = let
|
options.plugins.rust-tools =
|
||||||
mkNullableOptionWithDefault = {
|
let
|
||||||
type,
|
mkNullableOptionWithDefault =
|
||||||
description,
|
{ type
|
||||||
default,
|
, description
|
||||||
}:
|
, default
|
||||||
mkOption {
|
,
|
||||||
type = types.nullOr type;
|
}:
|
||||||
default = null;
|
mkOption {
|
||||||
description = ''
|
type = types.nullOr type;
|
||||||
${description}
|
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:
|
executor = mkNullableOptionWithDefault {
|
||||||
mkNullableOptionWithDefault {
|
type = types.enum [ "termopen" "quickfix" ];
|
||||||
inherit description;
|
default = ''"termopen"'';
|
||||||
type = types.bool;
|
description = "how to execute terminal commands";
|
||||||
default = toString default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mkNullableStrDefault = default: description:
|
onIntialized = mkOption {
|
||||||
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 {
|
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
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 = ''
|
description = ''
|
||||||
List of backends found on: https://graphviz.org/docs/outputs/
|
Callback to execute once rust-analyzer is done initializing the workspace
|
||||||
Is used for input validation and autocompletion
|
The callback receives one parameter indicating the `health` of the server:
|
||||||
|
"ok" | "warning" | "error"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
server =
|
reloadWorkspaceFromCargoToml = mkNullableBoolDefault true ''
|
||||||
{
|
Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
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})
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
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; {
|
with lib; {
|
||||||
options.plugins.treesitter-context = {
|
options.plugins.treesitter-context = {
|
||||||
enable = mkEnableOption "Enable nvim-treesitter-context";
|
enable = mkEnableOption "nvim-treesitter-context";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -15,7 +15,7 @@ with lib; {
|
||||||
{
|
{
|
||||||
enable =
|
enable =
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -39,7 +39,7 @@ with lib; {
|
||||||
};
|
};
|
||||||
highlightCurrentScope = {
|
highlightCurrentScope = {
|
||||||
inherit disable;
|
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 = {
|
smartRename = {
|
||||||
inherit disable;
|
inherit disable;
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.treesitter = {
|
plugins.treesitter = {
|
||||||
enable = mkEnableOption "Enable tree-sitter syntax highlighting";
|
enable = mkEnableOption "tree-sitter syntax highlighting";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -66,7 +66,7 @@ in
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
enable = mkEnableOption "Incremental selection based on the named nodes from the grammar";
|
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
||||||
keymaps = {
|
keymaps = {
|
||||||
initSelection = keymap "gnn";
|
initSelection = keymap "gnn";
|
||||||
nodeIncremental = keymap "grn";
|
nodeIncremental = keymap "grn";
|
||||||
|
@ -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 {
|
grammarPackages = mkOption {
|
||||||
type = with types; listOf package;
|
type = with types; listOf package;
|
||||||
|
|
|
@ -10,7 +10,7 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
options.plugins.null-ls = {
|
options.plugins.null-ls = {
|
||||||
enable = mkEnableOption "Enable null-ls";
|
enable = mkEnableOption "null-ls";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
mkServer =
|
mkServer =
|
||||||
{ name
|
{ name
|
||||||
, sourceType
|
, sourceType
|
||||||
, description ? "Enable ${name} source, for null-ls."
|
, description ? "${name} source, for null-ls."
|
||||||
, package ? null
|
, package ? null
|
||||||
, extraPackages ? [ ]
|
, extraPackages ? [ ]
|
||||||
, ...
|
, ...
|
||||||
|
|
|
@ -11,7 +11,7 @@ in
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
enable = mkEnableOption "Enable neovim's built-in LSP";
|
enable = mkEnableOption "neovim's built-in LSP";
|
||||||
|
|
||||||
enabledServers = mkOption {
|
enabledServers = mkOption {
|
||||||
type = with types; listOf (oneOf [
|
type = with types; listOf (oneOf [
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.lspsaga = {
|
plugins.lspsaga = {
|
||||||
enable = mkEnableOption "Enable lspsava.nvim";
|
enable = mkEnableOption "lspsaga.nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -111,27 +111,29 @@ in
|
||||||
description = "Maximum finder preview lines";
|
description = "Maximum finder preview lines";
|
||||||
};
|
};
|
||||||
|
|
||||||
keys = let
|
keys =
|
||||||
defaultKeyOpt = desc: mkOption {
|
let
|
||||||
description = desc;
|
defaultKeyOpt = desc: mkOption {
|
||||||
type = types.nullOr types.str;
|
description = desc;
|
||||||
default = null;
|
type = types.nullOr types.str;
|
||||||
};
|
default = null;
|
||||||
in {
|
};
|
||||||
finderAction = {
|
in
|
||||||
open = defaultKeyOpt "Open from finder";
|
{
|
||||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
finderAction = {
|
||||||
split = defaultKeyOpt "Horizontal split in finder";
|
open = defaultKeyOpt "Open from finder";
|
||||||
quit = defaultKeyOpt "Quit finder";
|
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
split = defaultKeyOpt "Horizontal split in finder";
|
||||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
quit = defaultKeyOpt "Quit finder";
|
||||||
};
|
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||||
|
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||||
|
};
|
||||||
|
|
||||||
codeAction = {
|
codeAction = {
|
||||||
quit = defaultKeyOpt "Quit code actions menu";
|
quit = defaultKeyOpt "Quit code actions menu";
|
||||||
exec = defaultKeyOpt "Execute code action";
|
exec = defaultKeyOpt "Execute code action";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
borderStyle = mkOption {
|
borderStyle = mkOption {
|
||||||
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
||||||
|
@ -147,67 +149,76 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
notDefault = default: opt: if (opt != default) then opt else null;
|
let
|
||||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != {}) then opt else null;
|
notDefault = default: opt: if (opt != default) then opt else null;
|
||||||
notNull = opt: opt;
|
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != { }) then opt else null;
|
||||||
lspsagaConfig = {
|
notNull = opt: opt;
|
||||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
lspsagaConfig = {
|
||||||
error_sign = notNull cfg.signs.error;
|
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||||
warn_sign = notNull cfg.signs.warning;
|
error_sign = notNull cfg.signs.error;
|
||||||
hint_sign = notNull cfg.signs.hint;
|
warn_sign = notNull cfg.signs.warning;
|
||||||
infor_sign = notNull cfg.signs.info;
|
hint_sign = notNull cfg.signs.hint;
|
||||||
|
infor_sign = notNull cfg.signs.info;
|
||||||
|
|
||||||
# TODO Fix this!
|
# TODO Fix this!
|
||||||
# error_header = notNull cfg.headers.error;
|
# error_header = notNull cfg.headers.error;
|
||||||
# warn_header = notNull cfg.headers.warning;
|
# warn_header = notNull cfg.headers.warning;
|
||||||
# hint_header = notNull cfg.headers.hint;
|
# hint_header = notNull cfg.headers.hint;
|
||||||
# infor_header = notNull cfg.headers.info;
|
# infor_header = notNull cfg.headers.info;
|
||||||
|
|
||||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||||
|
|
||||||
code_action_icon = notNull cfg.icons.codeAction;
|
code_action_icon = notNull cfg.icons.codeAction;
|
||||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||||
finder_reference_icon = notNull cfg.icons.findReference;
|
finder_reference_icon = notNull cfg.icons.findReference;
|
||||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||||
|
|
||||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||||
|
|
||||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||||
|
|
||||||
border_style = let
|
border_style =
|
||||||
borderStyle = if cfg.borderStyle == "thin" then 1
|
let
|
||||||
else if cfg.borderStyle == "rounded" then 2
|
borderStyle =
|
||||||
else if cfg.borderStyle == "thick" then 3
|
if cfg.borderStyle == "thin" then 1
|
||||||
else null;
|
else if cfg.borderStyle == "rounded" then 2
|
||||||
in borderStyle;
|
else if cfg.borderStyle == "thick" then 3
|
||||||
|
else null;
|
||||||
|
in
|
||||||
|
borderStyle;
|
||||||
|
|
||||||
finder_action_keys = let
|
finder_action_keys =
|
||||||
keys = {
|
let
|
||||||
open = notNull cfg.keys.finderAction.open;
|
keys = {
|
||||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
open = notNull cfg.keys.finderAction.open;
|
||||||
split = notNull cfg.keys.finderAction.split;
|
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||||
quit = notNull cfg.keys.finderAction.quit;
|
split = notNull cfg.keys.finderAction.split;
|
||||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
quit = notNull cfg.keys.finderAction.quit;
|
||||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||||
};
|
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||||
in notEmpty keys;
|
};
|
||||||
|
in
|
||||||
|
notEmpty keys;
|
||||||
|
|
||||||
code_action_keys = let
|
code_action_keys =
|
||||||
keys = {
|
let
|
||||||
quit = notNull cfg.keys.codeAction.quit;
|
keys = {
|
||||||
exec = notNull cfg.keys.codeAction.exec;
|
quit = notNull cfg.keys.codeAction.quit;
|
||||||
};
|
exec = notNull cfg.keys.codeAction.exec;
|
||||||
in notEmpty keys;
|
};
|
||||||
|
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 = {
|
options = {
|
||||||
plugins.packer = {
|
plugins.packer = {
|
||||||
enable = mkEnableOption "Enable packer.nvim";
|
enable = mkEnableOption "packer.nvim";
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
type = types.listOf (types.oneOf [
|
type = types.listOf (types.oneOf [
|
||||||
|
|
|
@ -14,7 +14,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.airline = {
|
plugins.airline = {
|
||||||
enable = mkEnableOption "Enable airline";
|
enable = mkEnableOption "airline";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.lightline = {
|
plugins.lightline = {
|
||||||
enable = mkEnableOption "Enable lightline";
|
enable = mkEnableOption "lightline";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -56,7 +56,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.lualine = {
|
plugins.lualine = {
|
||||||
enable = mkEnableOption "Enable lualine";
|
enable = mkEnableOption "lualine";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -16,7 +16,7 @@ in
|
||||||
# TODO:add support for aditional filetypes. This requires autocommands!
|
# TODO:add support for aditional filetypes. This requires autocommands!
|
||||||
|
|
||||||
options.plugins.telescope = {
|
options.plugins.telescope = {
|
||||||
enable = mkEnableOption "Enable telescope.nvim";
|
enable = mkEnableOption "telescope.nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -68,21 +68,23 @@ in
|
||||||
let $BAT_THEME = '${cfg.highlightTheme}'
|
let $BAT_THEME = '${cfg.highlightTheme}'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extraConfigLua = let
|
extraConfigLua =
|
||||||
options = {
|
let
|
||||||
extensions = cfg.extensionConfig;
|
options = {
|
||||||
defaults = cfg.defaults;
|
extensions = cfg.extensionConfig;
|
||||||
} // cfg.extraOptions;
|
defaults = cfg.defaults;
|
||||||
in ''
|
} // cfg.extraOptions;
|
||||||
do
|
in
|
||||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
''
|
||||||
|
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
|
for i, extension in ipairs(__telescopeExtensions) do
|
||||||
require('telescope').load_extension(extension)
|
require('telescope').load_extension(extension)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
'';
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.telescope.extensions.frecency = {
|
options.plugins.telescope.extensions.frecency = {
|
||||||
enable = mkEnableOption "Enable frecency";
|
enable = mkEnableOption "frecency";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -50,24 +50,26 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
configuration = {
|
let
|
||||||
db_root = cfg.dbRoot;
|
configuration = {
|
||||||
default_workspace = cfg.defaultWorkspace;
|
db_root = cfg.dbRoot;
|
||||||
ignore_patterns = cfg.ignorePatterns;
|
default_workspace = cfg.defaultWorkspace;
|
||||||
show_scores = cfg.showScores;
|
ignore_patterns = cfg.ignorePatterns;
|
||||||
workspaces = cfg.workspaces;
|
show_scores = cfg.showScores;
|
||||||
show_unindexed = cfg.showUnindexed;
|
workspaces = cfg.workspaces;
|
||||||
devicons_disabled = cfg.deviconsDisabled;
|
show_unindexed = cfg.showUnindexed;
|
||||||
};
|
devicons_disabled = cfg.deviconsDisabled;
|
||||||
in mkIf cfg.enable {
|
};
|
||||||
extraPackages = [ pkgs.sqlite ];
|
in
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
mkIf cfg.enable {
|
||||||
cfg.package
|
extraPackages = [ pkgs.sqlite ];
|
||||||
sqlite-lua
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
];
|
cfg.package
|
||||||
|
sqlite-lua
|
||||||
|
];
|
||||||
|
|
||||||
plugins.telescope.enabledExtensions = [ "frecency" ];
|
plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||||
plugins.telescope.extensionConfig."frecency" = configuration;
|
plugins.telescope.extensionConfig."frecency" = configuration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{ pkgs, config, lib, ...}:
|
{ pkgs, config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.plugins.telescope.extensions.project-nvim;
|
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.telescope.extensions.project-nvim = {
|
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 = {
|
options = {
|
||||||
plugins.commentary = {
|
plugins.commentary = {
|
||||||
enable = mkEnableOption "Enable commentary";
|
enable = mkEnableOption "commentary";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.vimPlugins.vim-commentary;
|
default = pkgs.vimPlugins.vim-commentary;
|
||||||
description = "Plugin to use for vim-commentary";
|
description = "Plugin to use for vim-commentary";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.dashboard = {
|
plugins.dashboard = {
|
||||||
enable = mkEnableOption "Enable dashboard";
|
enable = mkEnableOption "dashboard";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -7,7 +7,7 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
plugins.floaterm = {
|
plugins.floaterm = {
|
||||||
enable = mkEnableOption "Enable floaterm";
|
enable = mkEnableOption "floaterm";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -8,7 +8,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.mark-radar = {
|
options.plugins.mark-radar = {
|
||||||
enable = mkEnableOption "Enable mark-radar";
|
enable = mkEnableOption "mark-radar";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -10,7 +10,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.notify = {
|
options.plugins.notify = {
|
||||||
enable = mkEnableOption "Enable notify";
|
enable = mkEnableOption "notify";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.nvim-autopairs = {
|
options.plugins.nvim-autopairs = {
|
||||||
enable = mkEnableOption "Enable nvim-autopairs";
|
enable = mkEnableOption "nvim-autopairs";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.nvim-tree = {
|
options.plugins.nvim-tree = {
|
||||||
enable = mkEnableOption "Enable nvim-tree";
|
enable = mkEnableOption "nvim-tree";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.project-nvim = helpers.extraOptionsOptions // {
|
options.plugins.project-nvim = helpers.extraOptionsOptions // {
|
||||||
enable = mkEnableOption "Enable project.nvim";
|
enable = mkEnableOption "project.nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.specs = {
|
options.plugins.specs = {
|
||||||
enable = mkEnableOption "Enable specs-nvim";
|
enable = mkEnableOption "specs-nvim";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue