mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-07 11:25:06 +02:00
merge main
This commit is contained in:
parent
cfc826546c
commit
aa54bbcde3
12 changed files with 865 additions and 144 deletions
|
@ -73,6 +73,8 @@ rec {
|
||||||
description = desc;
|
description = desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkIfNonNull = c: mkIf (!isNull c) c;
|
||||||
|
|
||||||
defaultNullOpts = rec {
|
defaultNullOpts = rec {
|
||||||
mkNullable = type: default: desc: mkNullOrOption type (
|
mkNullable = type: default: desc: mkNullOrOption type (
|
||||||
let
|
let
|
||||||
|
@ -87,7 +89,7 @@ rec {
|
||||||
|
|
||||||
mkInt = default: mkNullable lib.types.int (toString default);
|
mkInt = default: mkNullable lib.types.int (toString default);
|
||||||
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
|
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
|
||||||
mkStr = default: mkNullable lib.types.str ''"${default}"'';
|
mkStr = default: mkNullable lib.types.str ''${builtins.toString default}'';
|
||||||
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
||||||
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,93 +1,99 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
helpers = import ../plugins/helpers.nix { inherit lib; };
|
helpers = import ../lib/helpers.nix { inherit lib; };
|
||||||
|
|
||||||
autoCmdOption = types.submodule {
|
autoGroupOption = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
event = mkOption {
|
clear = mkOption {
|
||||||
type = types.oneOf [
|
type = types.bool;
|
||||||
types.str
|
description = "Clear existing commands if the group already exists.";
|
||||||
(types.listOf types.str)
|
default = true;
|
||||||
];
|
|
||||||
description = "The event or events to register this autocommand.";
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
type = types.nullOr (types.oneOf [
|
|
||||||
types.str
|
|
||||||
types.int
|
|
||||||
]);
|
|
||||||
description = "The autocommand group name or id to match against.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
pattern = mkOption {
|
|
||||||
type = types.nullOr (types.oneOf [
|
|
||||||
types.str
|
|
||||||
(types.listOf types.str)
|
|
||||||
]);
|
|
||||||
description = "Pattern or patterns to match literally against.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
buffer = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
description = "Buffer number for buffer local autocommands |autocmd-buflocal|. Cannot be used with <pattern>.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
description = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "A textual description of this autocommand.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
callback = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of a Vimscript function to call when this autocommand is triggered. Cannot be used with <command>.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
command = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "Vim command to execute on event. Cannot be used with <callback>";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
once = mkOption {
|
|
||||||
type = types.nullOr types.bool;
|
|
||||||
description = "Run the autocommand only once";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
nested = mkOption {
|
|
||||||
type = types.nullOr types.bool;
|
|
||||||
description = "Run nested autocommands.";
|
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
autoCmdOption = types.submodule {
|
||||||
options.autoCmd = mkOption {
|
options = {
|
||||||
type = types.listOf autoCmdOption;
|
event = helpers.mkNullOrOption (types.either types.str (types.listOf types.str)) ''
|
||||||
default = [ ];
|
The event or events to register this autocommand.
|
||||||
description = "autocmd definitions";
|
'';
|
||||||
example = ''
|
|
||||||
autoCmd = [
|
group = helpers.mkNullOrOption (types.either types.str types.int) ''
|
||||||
{
|
The autocommand group name or id to match against.
|
||||||
event = [ "BufEnter" "BufWinEnter" ];
|
'';
|
||||||
pattern = [ "*.c" "*.h" ];
|
|
||||||
command = "echo 'Entering a C or C++ file'";
|
pattern = helpers.mkNullOrOption (types.either types.str (types.listOf types.str)) ''
|
||||||
}
|
Pattern or patterns to match literally against.
|
||||||
];
|
'';
|
||||||
'';
|
|
||||||
|
buffer = helpers.defaultNullOpts.mkInt "" ''
|
||||||
|
Buffer number for buffer local autocommands |autocmd-buflocal|.
|
||||||
|
Cannot be used with <pattern>.
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = helpers.defaultNullOpts.mkStr "" "A textual description of this autocommand.";
|
||||||
|
|
||||||
|
callback = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
The name of a Vimscript function to call when this autocommand is triggered. Cannot be used with <command>.
|
||||||
|
'';
|
||||||
|
|
||||||
|
command = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Vim command to execute on event. Cannot be used with <callback>
|
||||||
|
'';
|
||||||
|
|
||||||
|
once = helpers.defaultNullOpts.mkBool false "Run the autocommand only once";
|
||||||
|
|
||||||
|
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
in
|
||||||
extraConfigLua = optionalString (config.autoCmd != [ ]) ''
|
{
|
||||||
-- Set up autocommands {{{
|
options = {
|
||||||
|
autoGroups = mkOption {
|
||||||
|
type = types.attrsOf autoGroupOption;
|
||||||
|
default = { };
|
||||||
|
description = "augroup definitions";
|
||||||
|
example = ''
|
||||||
|
autoGroups = {
|
||||||
|
my_augroup = {
|
||||||
|
clear = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
autoCmd = mkOption {
|
||||||
|
type = types.listOf autoCmdOption;
|
||||||
|
default = [ ];
|
||||||
|
description = "autocmd definitions";
|
||||||
|
example = ''
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = [ "BufEnter" "BufWinEnter" ];
|
||||||
|
pattern = [ "*.c" "*.h" ];
|
||||||
|
command = "echo 'Entering a C or C++ file'";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf (config.autoGroups != { } || config.autoCmd != { }) {
|
||||||
|
extraConfigLuaPost = (optionalString (config.autoGroups != { }) ''
|
||||||
|
-- Set up autogroups {{
|
||||||
|
do
|
||||||
|
local __nixvim_autogroups = ${helpers.toLuaObject config.autoGroups}
|
||||||
|
|
||||||
|
for group_name, options in pairs(__nixvim_autogroups) do
|
||||||
|
vim.api.nvim_create_augroup(group_name, options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}
|
||||||
|
'') +
|
||||||
|
(optionalString (config.autoCmd != [ ]) ''
|
||||||
|
-- Set up autocommands {{
|
||||||
do
|
do
|
||||||
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
||||||
|
|
||||||
|
@ -107,7 +113,7 @@ in
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}
|
||||||
'';
|
'');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ in
|
||||||
local nixvim_options = ${helpers.toLuaObject config.options}
|
local nixvim_options = ${helpers.toLuaObject config.options}
|
||||||
|
|
||||||
for k,v in pairs(nixvim_options) do
|
for k,v in pairs(nixvim_options) do
|
||||||
vim.o[k] = v
|
vim.opt[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
|
@ -263,10 +263,7 @@ in
|
||||||
middle_mouse_command = cfg.middleMouseCommand;
|
middle_mouse_command = cfg.middleMouseCommand;
|
||||||
# deprecated, but might still work
|
# deprecated, but might still work
|
||||||
indicator_icon = cfg.indicatorIcon;
|
indicator_icon = cfg.indicatorIcon;
|
||||||
indicator = {
|
indicator = cfg.indicator;
|
||||||
icon = cfg.indicator.icon;
|
|
||||||
style = cfg.indicator.style;
|
|
||||||
};
|
|
||||||
buffer_close_icon = cfg.bufferCloseIcon;
|
buffer_close_icon = cfg.bufferCloseIcon;
|
||||||
modified_icon = cfg.modifiedIcon;
|
modified_icon = cfg.modifiedIcon;
|
||||||
close_icon = cfg.closeIcon;
|
close_icon = cfg.closeIcon;
|
||||||
|
|
|
@ -1,75 +1,56 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs
|
||||||
with lib;
|
, config
|
||||||
let
|
, lib
|
||||||
|
, ...
|
||||||
|
}@args:
|
||||||
|
with lib; let
|
||||||
cfg = config.colorschemes.tokyonight;
|
cfg = config.colorschemes.tokyonight;
|
||||||
style = types.enum [ "storm" "night" "day" ];
|
helpers = import ../helpers.nix args;
|
||||||
helpers = import ../helpers.nix { inherit lib; };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
colorschemes.tokyonight = {
|
colorschemes.tokyonight = {
|
||||||
enable = mkEnableOption "tokyonight";
|
enable = mkEnableOption "tokyonight";
|
||||||
package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
|
package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
|
||||||
style = mkOption {
|
style = helpers.defaultNullOpts.mkEnumFirstDefault [ "storm" "night" "day" ] "Theme style";
|
||||||
type = style;
|
terminalColors =
|
||||||
default = "storm";
|
helpers.defaultNullOpts.mkBool true
|
||||||
description = "Theme style";
|
"Configure the colors used when opening a :terminal in Neovim";
|
||||||
};
|
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
||||||
terminalColors = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = "Configure the colors used when opening a :terminal in Neovim";
|
|
||||||
};
|
|
||||||
transparent = mkEnableOption "disable setting the background color";
|
|
||||||
styles =
|
styles =
|
||||||
let
|
let
|
||||||
mkBackgroundStyle = name: mkOption {
|
mkBackgroundStyle = name:
|
||||||
type = types.enum [ "dark" "transparent" "normal" ];
|
helpers.defaultNullOpts.mkEnumFirstDefault [ "dark" "transparent" "normal" ]
|
||||||
description = "Background style for ${name}";
|
"Background style for ${name}";
|
||||||
default = "dark";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
comments = mkOption {
|
comments =
|
||||||
type = types.attrsOf types.anything;
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||||
description = "Define comments highlight properties";
|
"Define comments highlight properties";
|
||||||
default = { italic = true; };
|
keywords =
|
||||||
};
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||||
keywords = mkOption {
|
"Define keywords highlight properties";
|
||||||
type = types.attrsOf types.anything;
|
functions =
|
||||||
description = "Define keywords highlight properties";
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
||||||
default = { italic = true; };
|
"Define functions highlight properties";
|
||||||
};
|
variables =
|
||||||
functions = mkOption {
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
||||||
type = types.attrsOf types.anything;
|
"Define variables highlight properties";
|
||||||
description = "Define functions highlight properties";
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
variables = mkOption {
|
|
||||||
type = types.attrsOf types.anything;
|
|
||||||
description = "Define variables highlight properties";
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
sidebars = mkBackgroundStyle "sidebars";
|
sidebars = mkBackgroundStyle "sidebars";
|
||||||
floats = mkBackgroundStyle "floats";
|
floats = mkBackgroundStyle "floats";
|
||||||
};
|
};
|
||||||
sidebars = mkOption {
|
sidebars =
|
||||||
type = types.listOf types.str;
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["qf" "help"]''
|
||||||
default = [ "qf" "help" ];
|
"Set a darker background on sidebar-like windows";
|
||||||
description = "Set a darker background on sidebar-like windows";
|
dayBrightness =
|
||||||
example = ''["qf" "vista_kind" "terminal" "packer"]'';
|
helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3"
|
||||||
};
|
"Adjusts the brightness of the colors of the **Day** style";
|
||||||
dayBrightness = mkOption {
|
|
||||||
type = types.numbers.between 0.0 1.0;
|
|
||||||
default = 0.3;
|
|
||||||
description = "Adjusts the brightness of the colors of the **Day** style";
|
|
||||||
};
|
|
||||||
hideInactiveStatusline =
|
hideInactiveStatusline =
|
||||||
mkEnableOption
|
helpers.defaultNullOpts.mkBool false
|
||||||
"Enabling this option will hide inactive statuslines and replace them with a thin border";
|
"Enabling this option will hide inactive statuslines and replace them with a thin border";
|
||||||
dimInactive = mkEnableOption "dims inactive windows";
|
dimInactive = helpers.defaultNullOpts.mkBool false "dims inactive windows";
|
||||||
lualineBold =
|
lualineBold =
|
||||||
mkEnableOption
|
helpers.defaultNullOpts.mkBool false
|
||||||
"When true, section headers in the lualine theme will be bold";
|
"When true, section headers in the lualine theme will be bold";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,10 +18,13 @@
|
||||||
|
|
||||||
./git/fugitive.nix
|
./git/fugitive.nix
|
||||||
./git/gitgutter.nix
|
./git/gitgutter.nix
|
||||||
|
./git/gitmessenger.nix
|
||||||
./git/gitsigns.nix
|
./git/gitsigns.nix
|
||||||
./git/neogit.nix
|
./git/neogit.nix
|
||||||
|
|
||||||
|
./languages/clangd-extensions.nix
|
||||||
./languages/ledger.nix
|
./languages/ledger.nix
|
||||||
|
./languages/markdown-preview.nix
|
||||||
./languages/nix.nix
|
./languages/nix.nix
|
||||||
./languages/plantuml-syntax.nix
|
./languages/plantuml-syntax.nix
|
||||||
./languages/rust.nix
|
./languages/rust.nix
|
||||||
|
@ -55,6 +58,7 @@
|
||||||
./utils/floaterm.nix
|
./utils/floaterm.nix
|
||||||
./utils/goyo.nix
|
./utils/goyo.nix
|
||||||
./utils/harpoon.nix
|
./utils/harpoon.nix
|
||||||
|
./utils/indent-blankline.nix
|
||||||
./utils/intellitab.nix
|
./utils/intellitab.nix
|
||||||
./utils/mark-radar.nix
|
./utils/mark-radar.nix
|
||||||
./utils/notify.nix
|
./utils/notify.nix
|
||||||
|
|
117
plugins/git/gitmessenger.nix
Normal file
117
plugins/git/gitmessenger.nix
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
{ pkgs
|
||||||
|
, lib
|
||||||
|
, config
|
||||||
|
, ...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../helpers.nix args;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.plugins.gitmessenger = {
|
||||||
|
enable = mkEnableOption "Enable the gitmessenger plugin";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "git-messenger" pkgs.vimPlugins.git-messenger-vim;
|
||||||
|
|
||||||
|
closeOnCursorMoved = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
A popup window is no longer closed automatically when moving a cursor after the window is
|
||||||
|
shown up.
|
||||||
|
'';
|
||||||
|
includeDiff = helpers.defaultNullOpts.mkEnumFirstDefault [ "none" "current" "all" ] ''
|
||||||
|
When this value is not set to "none", a popup window includes diff hunks of the commit at
|
||||||
|
showing up. "current" includes diff hunks of only current file in the commit. "all" includes
|
||||||
|
all diff hunks in the commit.
|
||||||
|
|
||||||
|
Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this
|
||||||
|
value is set to "none".
|
||||||
|
'';
|
||||||
|
gitCommand =
|
||||||
|
helpers.defaultNullOpts.mkStr "git"
|
||||||
|
"git command to retrieve commit messages.";
|
||||||
|
noDefaultMappings =
|
||||||
|
helpers.defaultNullOpts.mkBool false
|
||||||
|
"When this value is set, it does not define any key mappings";
|
||||||
|
intoPopupAfterShow = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after
|
||||||
|
showing a popup does not move the cursor in the window.
|
||||||
|
'';
|
||||||
|
alwaysIntoPopup = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
When this value is set to v:true, the cursor goes into a popup window when running
|
||||||
|
:GitMessenger or <Plug>(git-messenger).
|
||||||
|
'';
|
||||||
|
extraBlameArgs = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
When this variable is set the contents will be appended to the git blame command. Use it to
|
||||||
|
add options (like -w).
|
||||||
|
'';
|
||||||
|
previewMods = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
This variable is effective only when opening preview window (on Neovim (0.3.0 or earlier)
|
||||||
|
or Vim).
|
||||||
|
|
||||||
|
Command modifiers for opening preview window. The value will be passed as prefix of :pedit
|
||||||
|
command. For example, setting "botright" to the variable opens a preview window at bottom of
|
||||||
|
the current window. Please see :help <mods> for more details.
|
||||||
|
'';
|
||||||
|
|
||||||
|
maxPopupHeight = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Max lines of popup window in an integer value. Setting null means no limit.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
maxPopupWidth = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Max characters of popup window in an integer value. Setting null means no limit.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
dateFormat = helpers.defaultNullOpts.mkStr "%c" ''
|
||||||
|
String value to format dates in popup window. Please see :help strftime() to know the details
|
||||||
|
of the format.
|
||||||
|
'';
|
||||||
|
|
||||||
|
concealWordDiffMarker = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
When this value is set to v:true, markers for word diffs like [-, -], {+, +} are concealed.
|
||||||
|
Set false when you don't want to hide them.
|
||||||
|
|
||||||
|
Note: Word diff is enabled by typing "r" in a popup window.
|
||||||
|
'';
|
||||||
|
|
||||||
|
floatingWinOps = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}" ''
|
||||||
|
Options passed to nvim_open_win() on opening a popup window. This is useful when you want to
|
||||||
|
override some window options.
|
||||||
|
'';
|
||||||
|
|
||||||
|
popupContentMargins = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Setting true means adding margins in popup window. Blank lines at the top and bottom of popup
|
||||||
|
content are inserted. And every line is indented with one whitespace character. Setting false
|
||||||
|
to this variable removes all the margins.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
cfg = config.plugins.gitmessenger;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [ cfg.package ];
|
||||||
|
globals = {
|
||||||
|
git_messenger_close_on_cursor_moved = cfg.closeOnCursorMoved;
|
||||||
|
git_messenger_include_diff = cfg.includeDiff;
|
||||||
|
git_messenger_git_command = cfg.gitCommand;
|
||||||
|
git_messenger_no_default_mappings = cfg.noDefaultMappings;
|
||||||
|
git_messenger_into_popup_after_show = cfg.intoPopupAfterShow;
|
||||||
|
git_messenger_always_into_popup = cfg.alwaysIntoPopup;
|
||||||
|
git_messenger_extra_blame_args = cfg.extraBlameArgs;
|
||||||
|
git_messenger_preview_mods = cfg.previewMods;
|
||||||
|
git_messenger_max_popup_height = cfg.maxPopupHeight;
|
||||||
|
git_messenger_max_popup_width = cfg.maxPopupWidth;
|
||||||
|
git_messenger_date_format = cfg.dateFormat;
|
||||||
|
git_messenger_conceal_word_diff_marker = cfg.concealWordDiffMarker;
|
||||||
|
git_messenger_floating_win_opts = cfg.floatingWinOps;
|
||||||
|
git_messenger_popup_content_margins = cfg.popupContentMargins;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
186
plugins/languages/clangd-extensions.nix
Normal file
186
plugins/languages/clangd-extensions.nix
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
helpers = import ../helpers.nix {inherit lib;};
|
||||||
|
in
|
||||||
|
with lib; let
|
||||||
|
borderOpt = let
|
||||||
|
bordersTy =
|
||||||
|
types.enum ["double" "rounded" "single" "shadow" "none"];
|
||||||
|
in
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.either bordersTy (types.listOf bordersTy))
|
||||||
|
''"none"'' "";
|
||||||
|
in {
|
||||||
|
options.plugins.clangd-extensions = {
|
||||||
|
enable = mkEnableOption "clangd_extensions, plugin implementing clangd LSP extensions";
|
||||||
|
|
||||||
|
package =
|
||||||
|
helpers.mkPackageOption "clangd_extensions.nvim" pkgs.vimPlugins.clangd_extensions-nvim;
|
||||||
|
|
||||||
|
enableOffsetEncodingWorkaround = mkEnableOption ''
|
||||||
|
utf-16 offset encoding. This is used to work around the warning:
|
||||||
|
"multiple different client offset_encodings detected for buffer, this is not supported yet"
|
||||||
|
'';
|
||||||
|
|
||||||
|
server = {
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.clang-tools;
|
||||||
|
description = "Package to use for clangd";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraOptions = mkOption {
|
||||||
|
type = types.attrsOf types.anything;
|
||||||
|
default = {};
|
||||||
|
description = "Extra options to pass to nvim-lspconfig. You should not need to use this directly";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extensions = {
|
||||||
|
autoSetHints = helpers.defaultNullOpts.mkBool true "Automatically set inlay hints (type hints)";
|
||||||
|
inlayHints = {
|
||||||
|
onlyCurrentLine =
|
||||||
|
helpers.defaultNullOpts.mkBool false
|
||||||
|
"Only show inlay hints for the current line";
|
||||||
|
onlyCurrentLineAutocmd = helpers.defaultNullOpts.mkStr "CursorHold" ''
|
||||||
|
Event which triggers a refersh of the inlay hints.
|
||||||
|
You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
||||||
|
not that this may cause higher CPU usage.
|
||||||
|
This option is only respected when only_current_line and
|
||||||
|
autoSetHints both are true.
|
||||||
|
'';
|
||||||
|
showParameterHints =
|
||||||
|
helpers.defaultNullOpts.mkBool true
|
||||||
|
"whether to show parameter hints with the inlay hints or not";
|
||||||
|
parameterHintsPrefix = helpers.defaultNullOpts.mkStr "<- " "prefix for parameter hints";
|
||||||
|
otherHintsPrefix =
|
||||||
|
helpers.defaultNullOpts.mkStr "=> "
|
||||||
|
"prefix for all the other hints (type, chaining)";
|
||||||
|
maxLenAlign =
|
||||||
|
helpers.defaultNullOpts.mkBool false
|
||||||
|
"whether to align to the length of the longest line in the file";
|
||||||
|
maxLenAlignPadding =
|
||||||
|
helpers.defaultNullOpts.mkInt 1
|
||||||
|
"padding from the left if max_len_align is true";
|
||||||
|
rightAlign =
|
||||||
|
helpers.defaultNullOpts.mkBool false
|
||||||
|
"whether to align to the extreme right or not";
|
||||||
|
rightAlignPadding =
|
||||||
|
helpers.defaultNullOpts.mkInt 7
|
||||||
|
"padding from the right if right_align is true";
|
||||||
|
highlight =
|
||||||
|
helpers.defaultNullOpts.mkStr "Comment"
|
||||||
|
"The color of the hints";
|
||||||
|
priority = helpers.defaultNullOpts.mkInt 100 "The highlight group priority for extmark";
|
||||||
|
};
|
||||||
|
|
||||||
|
ast = {
|
||||||
|
roleIcons = {
|
||||||
|
type = helpers.defaultNullOpts.mkStr "🄣" "";
|
||||||
|
declaration = helpers.defaultNullOpts.mkStr "🄓" "";
|
||||||
|
expression = helpers.defaultNullOpts.mkStr "🄔" "";
|
||||||
|
statement = helpers.defaultNullOpts.mkStr ";" "";
|
||||||
|
specifier = helpers.defaultNullOpts.mkStr "🄢" "";
|
||||||
|
templateArgument = helpers.defaultNullOpts.mkStr "🆃" "";
|
||||||
|
};
|
||||||
|
|
||||||
|
kindIcons = {
|
||||||
|
compound = helpers.defaultNullOpts.mkStr "🄲" "";
|
||||||
|
recovery = helpers.defaultNullOpts.mkStr "🅁" "";
|
||||||
|
translationUnit = helpers.defaultNullOpts.mkStr "🅄" "";
|
||||||
|
packExpansion = helpers.defaultNullOpts.mkStr "🄿" "";
|
||||||
|
templateTypeParm = helpers.defaultNullOpts.mkStr "🅃" "";
|
||||||
|
templateTemplateParm = helpers.defaultNullOpts.mkStr "🅃" "";
|
||||||
|
templateParamObject = helpers.defaultNullOpts.mkStr "🅃" "";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlights = {
|
||||||
|
detail = helpers.defaultNullOpts.mkStr "Comment" "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
memoryUsage = {
|
||||||
|
border = borderOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
symbolInfo = {
|
||||||
|
border = borderOpt;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
cfg = config.plugins.clangd-extensions;
|
||||||
|
setupOptions = {
|
||||||
|
server = cfg.server.extraOptions;
|
||||||
|
extensions = {
|
||||||
|
autoSetHints = cfg.extensions.autoSetHints;
|
||||||
|
inlay_hints = {
|
||||||
|
only_current_line = cfg.extensions.inlayHints.onlyCurrentLine;
|
||||||
|
only_current_line_autocmd = cfg.extensions.inlayHints.onlyCurrentLineAutocmd;
|
||||||
|
show_parameter_hints = cfg.extensions.inlayHints.showParameterHints;
|
||||||
|
parameter_hints_prefix = cfg.extensions.inlayHints.parameterHintsPrefix;
|
||||||
|
other_hints_prefix = cfg.extensions.inlayHints.otherHintsPrefix;
|
||||||
|
max_len_align = cfg.extensions.inlayHints.maxLenAlign;
|
||||||
|
max_len_align_padding = cfg.extensions.inlayHints.maxLenAlignPadding;
|
||||||
|
right_align = cfg.extensions.inlayHints.rightAlign;
|
||||||
|
right_align_padding = cfg.extensions.inlayHints.rightAlignPadding;
|
||||||
|
highlight = cfg.extensions.inlayHints.highlight;
|
||||||
|
priority = cfg.extensions.inlayHints.priority;
|
||||||
|
};
|
||||||
|
ast = {
|
||||||
|
role_icons = {
|
||||||
|
type = cfg.extensions.ast.roleIcons.type;
|
||||||
|
declaration = cfg.extensions.ast.roleIcons.declaration;
|
||||||
|
expression = cfg.extensions.ast.roleIcons.expression;
|
||||||
|
statement = cfg.extensions.ast.roleIcons.statement;
|
||||||
|
specifier = cfg.extensions.ast.roleIcons.specifier;
|
||||||
|
"template argument" = cfg.extensions.ast.roleIcons.templateArgument;
|
||||||
|
};
|
||||||
|
kind_icons = {
|
||||||
|
Compound = cfg.extensions.ast.kindIcons.compound;
|
||||||
|
Recovery = cfg.extensions.ast.kindIcons.recovery;
|
||||||
|
TranslationUnit = cfg.extensions.ast.kindIcons.translationUnit;
|
||||||
|
PackExpansion = cfg.extensions.ast.kindIcons.packExpansion;
|
||||||
|
TemplateTypeParm = cfg.extensions.ast.kindIcons.templateTypeParm;
|
||||||
|
TemplateTemplateParm = cfg.extensions.ast.kindIcons.templateTemplateParm;
|
||||||
|
TemplateParamObject = cfg.extensions.ast.kindIcons.templateParamObject;
|
||||||
|
};
|
||||||
|
highlights = {
|
||||||
|
detail = cfg.extensions.ast.highlights.detail;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
memory_usage = {
|
||||||
|
border = cfg.extensions.memoryUsage.border;
|
||||||
|
};
|
||||||
|
symbol_info = {
|
||||||
|
border = cfg.extensions.symbolInfo.border;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPackages = [cfg.server.package];
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
|
||||||
|
plugins.clangd-extensions.server.extraOptions = mkIf cfg.enableOffsetEncodingWorkaround {
|
||||||
|
capabilities = {__raw = "__clangdCaps";};
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins.lsp.postConfig = let
|
||||||
|
extraCaps =
|
||||||
|
if cfg.enableOffsetEncodingWorkaround
|
||||||
|
then ''
|
||||||
|
local __clangdCaps = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
__clangdCaps.offsetEncoding = { "utf-16" }
|
||||||
|
''
|
||||||
|
else "";
|
||||||
|
in ''
|
||||||
|
${extraCaps}
|
||||||
|
require("clangd_extensions").setup(${helpers.toLuaObject setupOptions})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
121
plugins/languages/markdown-preview.nix
Normal file
121
plugins/languages/markdown-preview.nix
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.plugins.markdown-preview;
|
||||||
|
helpers = import ../helpers.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
plugins.markdown-preview = {
|
||||||
|
enable = mkEnableOption "markdown-preview";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "markdown-preview" pkgs.vimPlugins.markdown-preview-nvim;
|
||||||
|
|
||||||
|
autoStart = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Open the preview window after entering the markdown buffer
|
||||||
|
'';
|
||||||
|
|
||||||
|
autoClose = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Auto close current preview window when change from markdown buffer to another buffer
|
||||||
|
'';
|
||||||
|
|
||||||
|
refreshSlow = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Refresh markdown when save the buffer or leave from insert mode, default false is auto refresh markdown as you edit or move the cursor
|
||||||
|
'';
|
||||||
|
|
||||||
|
commandForGlobal = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Enable markdown preview for all files (by default, the plugin is only enabled for markdown files)
|
||||||
|
'';
|
||||||
|
|
||||||
|
openToTheWorld = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Make the preview server available to others in your network. By default, the server listens on localhost (127.0.0.1).
|
||||||
|
'';
|
||||||
|
|
||||||
|
openIp = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Custom IP used to open the preview page. This can be useful when you work in remote vim and preview on local browser.
|
||||||
|
For more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9.
|
||||||
|
'';
|
||||||
|
|
||||||
|
browser = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
The browser to open the preview page
|
||||||
|
'';
|
||||||
|
|
||||||
|
echoPreviewUrl = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Echo preview page url in command line when opening the preview page
|
||||||
|
'';
|
||||||
|
|
||||||
|
browserFunc = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
A custom vim function name to open preview page. This function will receive url as param.
|
||||||
|
'';
|
||||||
|
|
||||||
|
previewOptions = {
|
||||||
|
mkit = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it options for render";
|
||||||
|
katex = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "katex options for math";
|
||||||
|
uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options";
|
||||||
|
maid = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "mermaid options";
|
||||||
|
disable_sync_scroll = helpers.defaultNullOpts.mkBool false "Disable sync scroll";
|
||||||
|
sync_scroll_type = helpers.defaultNullOpts.mkNullable (types.enum [ "middle" "top" "relative" ]) "middle" ''
|
||||||
|
Scroll type:
|
||||||
|
- "middle": The cursor position is always shown at the middle of the preview page.
|
||||||
|
- "top": The vim top viewport is always shown at the top of the preview page.
|
||||||
|
- "relative": The cursor position is always shown at the relative positon of the preview page.
|
||||||
|
'';
|
||||||
|
hide_yaml_meta = helpers.defaultNullOpts.mkBool true "Hide yaml metadata.";
|
||||||
|
sequence_diagrams = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "js-sequence-diagrams options";
|
||||||
|
flowchart_diagrams = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "flowcharts diagrams options";
|
||||||
|
content_editable = helpers.defaultNullOpts.mkBool false "Content editable from the preview page";
|
||||||
|
disable_filename = helpers.defaultNullOpts.mkBool false "Disable filename header for the preview page";
|
||||||
|
toc = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "Toc options";
|
||||||
|
};
|
||||||
|
|
||||||
|
markdownCss = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Custom markdown style. Must be an absolute path like '/Users/username/markdown.css' or expand('~/markdown.css').
|
||||||
|
'';
|
||||||
|
|
||||||
|
highlightCss = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Custom highlight style. Must be an absolute path like '/Users/username/highlight.css' or expand('~/highlight.css').
|
||||||
|
'';
|
||||||
|
|
||||||
|
port = helpers.defaultNullOpts.mkStr "" "Custom port to start server or empty for random";
|
||||||
|
|
||||||
|
pageTitle = helpers.defaultNullOpts.mkStr "「\${name}」" ''
|
||||||
|
preview page title. $${name} will be replaced with the file name.
|
||||||
|
'';
|
||||||
|
|
||||||
|
fileTypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "['markdown']" ''
|
||||||
|
Recognized filetypes. These filetypes will have MarkdownPreview... commands.
|
||||||
|
'';
|
||||||
|
|
||||||
|
theme = helpers.defaultNullOpts.mkNullable (types.enum [ "dark" "light" ]) "dark" ''
|
||||||
|
Default theme (dark or light). By default the theme is define according to the preferences of the system.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
previewOptions = mapAttrs (name: value: cfg.previewOptions.${name}) cfg.previewOptions;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
mkdp_auto_start = mkIf (!isNull cfg.autoStart) cfg.autoStart;
|
||||||
|
mkdp_auto_close = mkIf (!isNull cfg.autoClose) cfg.autoClose;
|
||||||
|
mkdp_refresh_slow = mkIf (!isNull cfg.refreshSlow) cfg.refreshSlow;
|
||||||
|
mkdp_command_for_global = mkIf (!isNull cfg.commandForGlobal) cfg.commandForGlobal;
|
||||||
|
mkdp_open_to_the_world = mkIf (!isNull cfg.openToTheWorld) cfg.openToTheWorld;
|
||||||
|
mkdp_open_ip = mkIf (!isNull cfg.openIp) cfg.openIp;
|
||||||
|
mkdp_browser = mkIf (!isNull cfg.browser) cfg.browser;
|
||||||
|
mkdp_echo_preview_url = mkIf (!isNull cfg.echoPreviewUrl) cfg.echoPreviewUrl;
|
||||||
|
mkdp_browserfunc = mkIf (!isNull cfg.browserFunc) cfg.browserFunc;
|
||||||
|
mkdp_preview_options = mkIf (cfg.previewOptions != { }) previewOptions;
|
||||||
|
mkdp_markdown_css = mkIf (!isNull cfg.markdownCss) cfg.markdownCss;
|
||||||
|
mkdp_highlight_css = mkIf (!isNull cfg.highlightCss) cfg.highlightCss;
|
||||||
|
mkdp_port = mkIf (!isNull cfg.port) cfg.port;
|
||||||
|
mkdp_page_title = mkIf (!isNull cfg.pageTitle) cfg.pageTitle;
|
||||||
|
mkdp_filetypes = mkIf (!isNull cfg.fileTypes) cfg.fileTypes;
|
||||||
|
mkdp_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -125,7 +125,7 @@ let
|
||||||
name = "eslint";
|
name = "eslint";
|
||||||
description = "Enable eslint";
|
description = "Enable eslint";
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||||
cmd = cfg: [ "${cfg.package}/bin/vscode-eslint-langauge-server" "--stdio" ];
|
cmd = cfg: [ "${cfg.package}/bin/vscode-eslint-language-server" "--stdio" ];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "elixirls";
|
name = "elixirls";
|
||||||
|
|
297
plugins/utils/indent-blankline.nix
Normal file
297
plugins/utils/indent-blankline.nix
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
{ lib
|
||||||
|
, pkgs
|
||||||
|
, config
|
||||||
|
, ...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../helpers.nix args;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.plugins.indent-blankline = {
|
||||||
|
enable = mkEnableOption "indent-blankline.nvim";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "indent-blankline" pkgs.vimPlugins.indent-blankline-nvim;
|
||||||
|
|
||||||
|
char = helpers.defaultNullOpts.mkStr "│" ''
|
||||||
|
Specifies the character to be used as indent line. Not used if charList is not empty.
|
||||||
|
|
||||||
|
When set explicitly to empty string (""), no indentation character is displayed at all,
|
||||||
|
even when 'charList' is not empty. This can be useful in combination with
|
||||||
|
spaceCharHighlightList to only rely on different highlighting of different indentation
|
||||||
|
levels without needing to show a special character.
|
||||||
|
'';
|
||||||
|
|
||||||
|
charBlankline = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Specifies the character to be used as indent line for blanklines. Not used if
|
||||||
|
charListBlankline is not empty.
|
||||||
|
'';
|
||||||
|
|
||||||
|
charList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies a list of characters to be used as indent line for
|
||||||
|
each indentation level.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
charListBlankline = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies a list of characters to be used as indent line for
|
||||||
|
each indentation level on blanklines.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
charHighlightList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies the list of character highlights for each indentation level.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
spaceCharBlankline = helpers.defaultNullOpts.mkStr " " ''
|
||||||
|
Specifies the character to be used as the space value in between indent
|
||||||
|
lines when the line is blank.
|
||||||
|
'';
|
||||||
|
|
||||||
|
spaceCharHighlightList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies the list of space character highlights for each indentation
|
||||||
|
level.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
spaceCharBlanklineHighlightList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies the list of space character highlights for each indentation
|
||||||
|
level when the line is empty.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
useTreesitter =
|
||||||
|
helpers.defaultNullOpts.mkBool false
|
||||||
|
"Use treesitter to calculate indentation when possible.";
|
||||||
|
|
||||||
|
indentLevel = helpers.defaultNullOpts.mkInt 10 "Specifies the maximum indent level to display.";
|
||||||
|
|
||||||
|
maxIndentIncrease = helpers.defaultNullOpts.mkInt config.plugins.indent-blankline.indentLevel ''
|
||||||
|
The maximum indent level increase from line to line.
|
||||||
|
Set this option to 1 to make aligned trailing multiline comments not
|
||||||
|
create indentation.
|
||||||
|
'';
|
||||||
|
|
||||||
|
showFirstIndentLevel =
|
||||||
|
helpers.defaultNullOpts.mkBool true "Displays indentation in the first column.";
|
||||||
|
|
||||||
|
showTrailingBlanklineIndent = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Displays a trailing indentation guide on blank lines, to match the
|
||||||
|
indentation of surrounding code.
|
||||||
|
Turn this off if you want to use background highlighting instead of chars.
|
||||||
|
'';
|
||||||
|
|
||||||
|
showEndOfLine = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Displays the end of line character set by |listchars| instead of the
|
||||||
|
indent guide on line returns.
|
||||||
|
'';
|
||||||
|
|
||||||
|
showFoldtext = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Displays the full fold text instead of the indent guide on folded lines.
|
||||||
|
|
||||||
|
Note: there is no autocommand to subscribe to changes in folding. This
|
||||||
|
might lead to unexpected results. A possible solution for this is to
|
||||||
|
remap folding bindings to also call |IndentBlanklineRefresh|
|
||||||
|
'';
|
||||||
|
|
||||||
|
disableWithNolist = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
When true, automatically turns this plugin off when |nolist| is set.
|
||||||
|
When false, setting |nolist| will keep displaying indentation guides but
|
||||||
|
removes whitespace characters set by |listchars|.
|
||||||
|
'';
|
||||||
|
|
||||||
|
filetype = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies a list of |filetype| values for which this plugin is enabled.
|
||||||
|
All |filetypes| are enabled if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
filetypeExclude =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
|
''["lspinfo" "packer" "checkhealth" "help" "man" ""]'' ''
|
||||||
|
Specifies a list of |filetype| values for which this plugin is not enabled.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
buftypeExclude =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||||
|
''["terminal" "nofile" "quickfix" "prompt"]'' ''
|
||||||
|
Specifies a list of |buftype| values for which this plugin is not enabled.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
bufnameExclude = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies a list of buffer names (file name with full path) for which
|
||||||
|
this plugin is not enabled.
|
||||||
|
A name can be regular expression as well.
|
||||||
|
'';
|
||||||
|
|
||||||
|
strictTabs = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
When on, if there is a single tab in a line, only tabs are used to
|
||||||
|
calculate the indentation level.
|
||||||
|
When off, both spaces and tabs are used to calculate the indentation
|
||||||
|
level.
|
||||||
|
Only makes a difference if a line has a mix of tabs and spaces for
|
||||||
|
indentation.
|
||||||
|
'';
|
||||||
|
|
||||||
|
showCurrentContext = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
When on, use treesitter to determine the current context. Then show the
|
||||||
|
indent character in a different highlight.
|
||||||
|
|
||||||
|
Note: Requires https://github.com/nvim-treesitter/nvim-treesitter to be
|
||||||
|
installed
|
||||||
|
|
||||||
|
Note: With this option enabled, the plugin refreshes on |CursorMoved|,
|
||||||
|
which might be slower
|
||||||
|
'';
|
||||||
|
|
||||||
|
showCurrentContextStart = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Applies the |hl-IndentBlanklineContextStart| highlight group to the first
|
||||||
|
line of the current context.
|
||||||
|
By default this will underline.
|
||||||
|
|
||||||
|
Note: Requires https://github.com/nvim-treesitter/nvim-treesitter to be
|
||||||
|
installed
|
||||||
|
|
||||||
|
Note: You need to have set |gui-colors| and it depends on your terminal
|
||||||
|
emulator if this works as expected.
|
||||||
|
If you are using kitty and tmux, take a look at this article to
|
||||||
|
make it work
|
||||||
|
http://evantravers.com/articles/2021/02/05/curly-underlines-in-kitty-tmux-neovim/
|
||||||
|
'';
|
||||||
|
|
||||||
|
showCurrentContextStartOnCurrentLine = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Shows showCurrentContextStart even when the cursor is on the same line
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextChar = helpers.defaultNullOpts.mkStr config.plugins.indent-blankline.char ''
|
||||||
|
Specifies the character to be used for the current context indent line.
|
||||||
|
Not used if contextCharList is not empty.
|
||||||
|
|
||||||
|
Useful to have a greater distinction between the current context indent
|
||||||
|
line and others.
|
||||||
|
|
||||||
|
Also useful in combination with char set to empty string
|
||||||
|
(""), as this allows only the current context indent line to be shown.
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextCharBlankline = helpers.defaultNullOpts.mkStr "" ''
|
||||||
|
Equivalent of charBlankline for contextChar.
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextCharList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Equivalent of charList for contextChar.
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextCharListBlankline = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Equivalent of charListBlankline for contextChar.
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextHighlightList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||||
|
Specifies the list of character highlights for the current context at
|
||||||
|
each indentation level.
|
||||||
|
Ignored if the value is an empty list.
|
||||||
|
'';
|
||||||
|
|
||||||
|
charPriority = helpers.defaultNullOpts.mkInt 1 "Specifies the |extmarks| priority for chars.";
|
||||||
|
|
||||||
|
contextStartPriority =
|
||||||
|
helpers.defaultNullOpts.mkInt 10000
|
||||||
|
"Specifies the |extmarks| priority for the context start.";
|
||||||
|
|
||||||
|
contextPatterns = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''
|
||||||
|
[
|
||||||
|
"class"
|
||||||
|
"^func"
|
||||||
|
"method"
|
||||||
|
"^if"
|
||||||
|
"while"
|
||||||
|
"for"
|
||||||
|
"with"
|
||||||
|
"try"
|
||||||
|
"except"
|
||||||
|
"arguments"
|
||||||
|
"argument_list"
|
||||||
|
"object"
|
||||||
|
"dictionary"
|
||||||
|
"element"
|
||||||
|
"table"
|
||||||
|
"tuple"
|
||||||
|
"do_block"
|
||||||
|
]'' ''
|
||||||
|
Specifies a list of lua patterns that are used to match against the
|
||||||
|
treesitter |tsnode:type()| at the cursor position to find the current
|
||||||
|
context.
|
||||||
|
|
||||||
|
To learn more about how lua pattern work, see here:
|
||||||
|
https://www.lua.org/manual/5.1/manual.html#5.4.1
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
useTreesitterScope = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Instead of using contextPatters use the current scope defined by nvim-treesitter as the
|
||||||
|
context
|
||||||
|
'';
|
||||||
|
|
||||||
|
contextPatternHighlight = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) "{}" ''
|
||||||
|
Specifies a map of patterns set in contextPatterns to highlight groups.
|
||||||
|
When the current matching context pattern is in the map, the context
|
||||||
|
will be highlighted with the corresponding highlight group.
|
||||||
|
'';
|
||||||
|
|
||||||
|
viewportBuffer = helpers.defaultNullOpts.mkInt 10 ''
|
||||||
|
Sets the buffer of extra lines before and after the current viewport that
|
||||||
|
are considered when generating indentation and the context.
|
||||||
|
'';
|
||||||
|
|
||||||
|
disableWarningMessage =
|
||||||
|
helpers.defaultNullOpts.mkBool false "Turns deprecation warning messages off.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
cfg = config.plugins.indent-blankline;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
indent_blankline_char = cfg.char;
|
||||||
|
indent_blankline_char_blankline = cfg.charBlankline;
|
||||||
|
indent_blankline_char_list = cfg.charList;
|
||||||
|
indent_blankline_char_list_blankline = cfg.charListBlankline;
|
||||||
|
indent_blankline_char_highlight_list = cfg.charHighlightList;
|
||||||
|
indent_blankline_space_char_blankline = cfg.spaceCharBlankline;
|
||||||
|
indent_blankline_space_char_highlight_list = cfg.spaceCharHighlightList;
|
||||||
|
indent_blankline_space_char_blankline_highlight_list = cfg.spaceCharBlanklineHighlightList;
|
||||||
|
indent_blankline_use_treesitter = cfg.useTreesitter;
|
||||||
|
indent_blankline_indent_level = cfg.indentLevel;
|
||||||
|
indent_blankline_max_indent_increase = cfg.maxIndentIncrease;
|
||||||
|
indent_blankline_show_first_indent_level = cfg.showFirstIndentLevel;
|
||||||
|
indent_blankline_show_trailing_blankline_indent = cfg.showTrailingBlanklineIndent;
|
||||||
|
indent_blankline_show_end_of_line = cfg.showEndOfLine;
|
||||||
|
indent_blankline_show_foldtext = cfg.showFoldtext;
|
||||||
|
indent_blankline_disable_with_nolist = cfg.disableWithNolist;
|
||||||
|
indent_blankline_filetype = cfg.filetype;
|
||||||
|
indent_blankline_filetype_exclude = cfg.filetypeExclude;
|
||||||
|
indent_blankline_buftype_exclude = cfg.buftypeExclude;
|
||||||
|
indent_blankline_bufname_exclude = cfg.bufnameExclude;
|
||||||
|
indent_blankline_strict_tabs = cfg.strictTabs;
|
||||||
|
indent_blankline_show_current_context = cfg.showCurrentContext;
|
||||||
|
indent_blankline_show_current_context_start = cfg.showCurrentContextStart;
|
||||||
|
indent_blankline_show_current_context_start_on_current_line = cfg.showCurrentContextStartOnCurrentLine;
|
||||||
|
indent_blankline_context_char = cfg.contextChar;
|
||||||
|
indent_blankline_context_char_blankline = cfg.contextCharBlankline;
|
||||||
|
indent_blankline_context_char_list = cfg.contextCharList;
|
||||||
|
indent_blankline_context_char_list_blankline = cfg.contextCharListBlankline;
|
||||||
|
indent_blankline_context_highlight_list = cfg.contextHighlightList;
|
||||||
|
indent_blankline_char_priority = cfg.charPriority;
|
||||||
|
indent_blankline_context_start_priority = cfg.contextStartPriority;
|
||||||
|
indent_blankline_context_patterns = cfg.contextPatterns;
|
||||||
|
indent_blankline_use_treesitter_scope = cfg.useTreesitterScope;
|
||||||
|
indent_blankline_context_pattern_highlight = cfg.contextPatternHighlight;
|
||||||
|
indent_blankline_viewport_buffer = cfg.viewportBuffer;
|
||||||
|
indent_blankline_disable_warning_message = cfg.disableWarningMessage;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -16,6 +16,14 @@ in
|
||||||
option = basePluginPath ++ [ "updateFocusedFile" "updateCwd" ];
|
option = basePluginPath ++ [ "updateFocusedFile" "updateCwd" ];
|
||||||
newOption = basePluginPath ++ [ "updateFocusedFile" "updateRoot" ];
|
newOption = basePluginPath ++ [ "updateFocusedFile" "updateRoot" ];
|
||||||
})
|
})
|
||||||
|
(optionWarnings.mkDeprecatedOption {
|
||||||
|
option = basePluginPath ++ [ "openOnSetup" ];
|
||||||
|
alternative = [];
|
||||||
|
})
|
||||||
|
(optionWarnings.mkDeprecatedOption {
|
||||||
|
option = basePluginPath ++ [ "ignoreFtOnSetup" ];
|
||||||
|
alternative = [];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
options.plugins.nvim-tree = {
|
options.plugins.nvim-tree = {
|
||||||
|
@ -35,12 +43,14 @@ in
|
||||||
description = "Hijack netrw";
|
description = "Hijack netrw";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# deprecated
|
||||||
openOnSetup = mkOption {
|
openOnSetup = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Open on setup";
|
description = "Open on setup";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# deprecated
|
||||||
ignoreFtOnSetup = mkOption {
|
ignoreFtOnSetup = mkOption {
|
||||||
type = types.nullOr (types.listOf types.str);
|
type = types.nullOr (types.listOf types.str);
|
||||||
default = null;
|
default = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue