This commit is contained in:
Pedro Alves 2023-02-20 10:43:13 +00:00
parent 8798a622cf
commit 3e73b2900c

View file

@ -1,12 +1,12 @@
{ pkgs
, config
, lib
, ...
{
pkgs,
config,
lib,
...
} @ args:
with lib; let
helpers = import ../helpers.nix args;
in
{
in {
options.plugins.vim-matchup = {
enable = mkEnableOption "Enable vim-matchup";
@ -16,7 +16,7 @@ in
enable = mkEnableOption "Enable treesitter integration";
disable =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]"
"Languages for each to disable this module";
"Languages for each to disable this module";
disableVirtualText = helpers.defaultNullOpts.mkBool false ''
Do not use virtual text to highlight the virtual end of a block, for languages without
@ -37,34 +37,34 @@ in
singleton =
helpers.defaultNullOpts.mkBool false
"Whether to highlight known words even if there is no match";
"Whether to highlight known words even if there is no match";
offscreen =
helpers.defaultNullOpts.mkNullable
(types.submodule {
options = {
method = helpers.defaultNullOpts.mkEnumFirstDefault [ "status" "popup" "status_manual" ] ''
'status': Replace the status-line for off-screen matches.
(types.submodule {
options = {
method = helpers.defaultNullOpts.mkEnumFirstDefault ["status" "popup" "status_manual"] ''
'status': Replace the status-line for off-screen matches.
If a match is off of the screen, the line belonging to that match will be displayed
syntax-highlighted in the status line along with the line number (if line numbers
are enabled). If the match is above the screen border, an additional Δ symbol will
be shown to indicate that the matching line is really above the cursor line.
If a match is off of the screen, the line belonging to that match will be displayed
syntax-highlighted in the status line along with the line number (if line numbers
are enabled). If the match is above the screen border, an additional Δ symbol will
be shown to indicate that the matching line is really above the cursor line.
'popup': Show off-screen matches in a popup (vim) or floating (neovim) window.
'popup': Show off-screen matches in a popup (vim) or floating (neovim) window.
'status_manual': Compute the string which would be displayed in the status-line or
popup, but do not display it. The function MatchupStatusOffscreen() can be used to
get the text.
'';
scrolloff = helpers.defaultNullOpts.mkBool false ''
When enabled, off-screen matches will not be shown in the statusline while the
cursor is at the screen edge (respects the value of 'scrolloff').
This is intended to prevent flickering while scrolling with j and k.
'';
};
})
''{method = "status";}'' "Dictionary controlling the behavior with off-screen matches.";
'status_manual': Compute the string which would be displayed in the status-line or
popup, but do not display it. The function MatchupStatusOffscreen() can be used to
get the text.
'';
scrolloff = helpers.defaultNullOpts.mkBool false ''
When enabled, off-screen matches will not be shown in the statusline while the
cursor is at the screen edge (respects the value of 'scrolloff').
This is intended to prevent flickering while scrolling with j and k.
'';
};
})
''{method = "status";}'' "Dictionary controlling the behavior with off-screen matches.";
stopline = helpers.defaultNullOpts.mkInt 400 ''
The number of lines to search in either direction while highlighting matches.
@ -73,11 +73,11 @@ in
timeout =
helpers.defaultNullOpts.mkInt 300
"Adjust timeouts in milliseconds for matchparen highlighting";
"Adjust timeouts in milliseconds for matchparen highlighting";
insertTimeout =
helpers.defaultNullOpts.mkInt 60
"Adjust timeouts in milliseconds for matchparen highlighting";
"Adjust timeouts in milliseconds for matchparen highlighting";
deffered = {
enable = helpers.defaultNullOpts.mkBool false ''
@ -123,12 +123,12 @@ in
linewiseOperators =
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
''["d" "y"]'' "Modify the set of operators which may operate line-wise";
''["d" "y"]'' "Modify the set of operators which may operate line-wise";
};
enableSurround =
helpers.defaultNullOpts.mkBool false
"To enable the delete surrounding (ds%) and change surrounding (cs%) maps";
"To enable the delete surrounding (ds%) and change surrounding (cs%) maps";
enableTransmute =
helpers.defaultNullOpts.mkBool false "To enable the experimental transmute module";
@ -138,7 +138,7 @@ in
objects. Does not apply to match highlighting (see matchParenStopline instead)
'';
delimNoSkips = helpers.defaultNullOpts.mkNullable (types.enum [ 0 1 2 ]) "0" ''
delimNoSkips = helpers.defaultNullOpts.mkNullable (types.enum [0 1 2]) "0" ''
To disable matching within strings and comments:
- 0: matching is enabled within strings and comments
- 1: recognize symbols within comments
@ -146,12 +146,11 @@ in
'';
};
config =
let
cfg = config.plugins.vim-matchup;
in
config = let
cfg = config.plugins.vim-matchup;
in
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraPlugins = [cfg.package];
plugins.treesitter.moduleConfig.matchup = mkIf cfg.treesitterIntegration.enable {
inherit (cfg.treesitterIntegration) enable disable;