Skip to content

Commit

Permalink
Add escapeValue option and fix brackets.characters option for kate (#307
Browse files Browse the repository at this point in the history
)
  • Loading branch information
magnouvean authored Aug 9, 2024
1 parent 5ab818b commit 22bea90
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
9 changes: 9 additions & 0 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ let
plasma-manager will leave it unchanged after activation.
'';
};
escapeValue = lib.mkOption {
type = bool;
default = true;
description = ''
Whether to escape the value according to kde's escape-format. See:
https://github.com/KDE/kconfig/blob/44f98ff5cb9008436ba5ba385cae03bbd0ab33e6/src/core/kconfigini.cpp#L882
for info about this format.
'';
};
};
});
coercedSettingsType = with lib.types;
Expand Down
22 changes: 12 additions & 10 deletions modules/apps/kate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,17 @@ in
type = lib.types.bool;
};

inputMode = let
enumVals = [ "normal" "vi" ];
in lib.mkOption {
type = lib.types.enum enumVals;
description = "The input mode for the editor.";
default = "normal";
example = "vi";
apply = getIndexFromEnum enumVals;
};
inputMode =
let
enumVals = [ "normal" "vi" ];
in
lib.mkOption {
type = lib.types.enum enumVals;
description = "The input mode for the editor.";
default = "normal";
example = "vi";
apply = getIndexFromEnum enumVals;
};

font = lib.mkOption {
type = fontType;
Expand Down Expand Up @@ -476,7 +478,7 @@ in
};

"KTextEditor View" = {
"Chars To Enclose Selection" = cfg.editor.brackets.characters;
"Chars To Enclose Selection" = { value = cfg.editor.brackets.characters; escapeValue = false; };
"Bracket Match Preview" = cfg.editor.brackets.highlightMatching;
"Auto Brackets" = cfg.editor.brackets.automaticallyAddClosing;
"Input Mode" = cfg.editor.inputMode;
Expand Down
2 changes: 1 addition & 1 deletion script/write_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def from_json(cls, value: dict) -> Self:
else str(value["value"]).lower()
)
return cls(
value=escape(key_value),
value=escape(key_value) if value["escapeValue"] else key_value,
immutable=value["immutable"],
shellExpand=value["shellExpand"],
)
Expand Down

0 comments on commit 22bea90

Please sign in to comment.