Skip to content

Commit

Permalink
kakoune: Added missing ui options
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Zivota committed Apr 4, 2019
1 parent 9fbc188 commit 55a70bb
Showing 1 changed file with 63 additions and 6 deletions.
69 changes: 63 additions & 6 deletions modules/programs/kakoune.nix
Expand Up @@ -133,6 +133,48 @@ let
Enable mouse support.
'';
};

changeColors = mkOption {
type = types.bool;
default = true;
description = ''
Change color palette.
'';
};

wheelDownButton = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Button to send for wheel down events.
'';
};

wheelUpButton = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Button to send for wheel up events.
'';
};

shiftFunctionKeys = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
description = ''
Amount by which shifted function keys are offset.
I.e., if the terminal sends F13 for Shift-F1, this
should be <literal>12</literal>.
'';
};

useBuiltinKeyParser = mkOption {
type = types.bool;
default = false;
description = ''
Bypass ncurses key parser and use an internal one.
'';
};
};
});

Expand Down Expand Up @@ -438,12 +480,20 @@ let
"${optionalString (separator != null) " -separator ${separator}"}"
];

uiOptions = with ui; concatStringsSep " " (map (s: "ncurses_"+ s) [
"set_title=${if setTitle then "true" else "false"}"
"status_on_top=${if (statusLine == "top") then "true" else "false"}"
"assistant=${assistant}"
"enable_mouse=${if enableMouse then "true" else "false"}"
]);
uiOptions = with ui; concatStringsSep " " [
"ncurses_set_title=${if setTitle then "true" else "false"}"
"ncurses_status_on_top=${if (statusLine == "top") then "true" else "false"}"
"ncurses_assistant=${assistant}"
"ncurses_enable_mouse=${if enableMouse then "true" else "false"}"
"ncurses_change_colors=${if changeColors then "true" else "false"}"
"${optionalString (wheelDownButton != null)
"ncurses_wheel_down_button=${wheelDownButton}"}"
"${optionalString (wheelUpButton != null)
"ncurses_wheel_up_button=${wheelUpButton}"}"
"${optionalString (shiftFunctionKeys != null)
"ncurses_shift_function_key=${toString shiftFunctionKeys}"}"
"ncurses_builtin_key_parser=${if useBuiltinKeyParser then "true" else "false"}"
];

keyMappingString = km: concatStringsSep " " [
"map global"
Expand All @@ -458,6 +508,7 @@ let
"%{ ${h.commands} }"
];
in ''
# Generated by home-manager
${optionalString (tabStop != null) "set-option global tabstop ${toString tabStop}"}
${optionalString (indentWidth != null) "set-option global indentwidth ${toString indentWidth}"}
${optionalString (!incrementalSearch) "set-option global incsearch false"}
Expand All @@ -471,8 +522,14 @@ let
${optionalString showMatching "add-highlighter global/ show-matching"}
${optionalString (scrollOff != null)
"set-option global scrolloff ${toString scrollOff.lines},${toString scrollOff.columns}"}
# UI options
${optionalString (ui != null) "set-option global ui_options ${uiOptions}"}
# Key mappings
${concatStringsSep "\n" (map keyMappingString keyMappings)}
# Hooks
${concatStringsSep "\n" (map hookString hooks)}
'' else "") + "\n" + cfg.extraConfig);

Expand Down

0 comments on commit 55a70bb

Please sign in to comment.