mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 00:48:58 +02:00
plugins/nvim-autopairs: cleanup + fix mistyped option + tests (#280)
This commit is contained in:
parent
c300601dce
commit
961da92d2c
2 changed files with 40 additions and 31 deletions
|
@ -3,22 +3,11 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-autopairs;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||
basePluginPath = ["plugins" "nvim-autopairs"];
|
||||
in {
|
||||
imports = [
|
||||
(optionWarnings.mkRemovedOption {
|
||||
option = basePluginPath ++ ["breakLineFiletypes"];
|
||||
})
|
||||
(optionWarnings.mkRemovedOption {
|
||||
option = basePluginPath ++ ["htmlFiletypes"];
|
||||
})
|
||||
];
|
||||
|
||||
options.plugins.nvim-autopairs =
|
||||
helpers.extraOptionsOptions
|
||||
// {
|
||||
|
@ -30,24 +19,10 @@ in {
|
|||
|
||||
disabledFiletypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.attrsOf types.str)
|
||||
"[ \"TelescopePrompt\" ]"
|
||||
(types.listOf types.str)
|
||||
''[ "TelescopePrompt" "spectre_panel" ]''
|
||||
"Disabled filetypes";
|
||||
|
||||
# TODO remove this option at some point (it has been marked as removed since XX-XX-2023)
|
||||
breakLineFiletypes = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = "Filetypes to break lines on";
|
||||
};
|
||||
|
||||
# TODO remove this option at some point (it has been marked as removed since XX-XX-2023)
|
||||
htmlFiletypes = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
description = "Filetypes to treat as HTML";
|
||||
};
|
||||
|
||||
disableInMacro = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable when recording or executing a macro.
|
||||
'';
|
||||
|
@ -107,9 +82,8 @@ in {
|
|||
disable_in_visualblock = cfg.disableInVisualblock;
|
||||
disable_in_replace_mode = cfg.disableInReplaceMode;
|
||||
ignored_next_char =
|
||||
if isNull cfg.ignoredNextChar
|
||||
then null
|
||||
else helpers.mkRaw cfg.ignoredNextChar;
|
||||
helpers.ifNonNull' cfg.ignoredNextChar
|
||||
(helpers.mkRaw cfg.ignoredNextChar);
|
||||
enable_moveright = cfg.enableMoveright;
|
||||
enable_afterquote = cfg.enableAfterQuote;
|
||||
enable_check_bracket_line = cfg.enableCheckBracketLine;
|
||||
|
|
35
tests/plugins/nvim-autopairs.nix
Normal file
35
tests/plugins/nvim-autopairs.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
# Empty configuration
|
||||
empty = {
|
||||
plugins.nvim-autopairs.enable = true;
|
||||
};
|
||||
|
||||
# All the upstream default options of trouble
|
||||
defaults = {
|
||||
plugins.nvim-autopairs = {
|
||||
enable = true;
|
||||
|
||||
pairs = null;
|
||||
disabledFiletypes = ["TelescopePrompt" "spectre_panel"];
|
||||
disableInMacro = false;
|
||||
disableInVisualblock = false;
|
||||
disableInReplaceMode = true;
|
||||
ignoredNextChar = "[=[[%w%%%'%[%\"%.%`%$]]=]";
|
||||
enableMoveright = true;
|
||||
enableAfterQuote = true;
|
||||
enableCheckBracketLine = true;
|
||||
enableBracketInQuote = true;
|
||||
enableAbbr = false;
|
||||
breakUndo = true;
|
||||
checkTs = false;
|
||||
tsConfig = {
|
||||
lua = ["string" "source"];
|
||||
javascript = ["string" "template_string"];
|
||||
};
|
||||
mapCr = true;
|
||||
mapBs = true;
|
||||
mapCH = false;
|
||||
mapCW = false;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue