mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 17:11:03 +01:00
helix: add extraConfig option (#6575)
The extraConfig option can be used to append ordered lines to helix configuration. Helix depends on order for rendering minor mode menus.
This commit is contained in:
parent
2321c6889b
commit
0ff53f6d33
3 changed files with 30 additions and 8 deletions
|
|
@ -1,7 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.helix;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
|
@ -26,6 +24,20 @@ in {
|
|||
description = "Extra packages available to hx.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines to be appended to the config file.
|
||||
Use this if you would like to maintain order for helix settings (eg. for minor modes)
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[keys.normal.g] # Reverse Alphabetical Order
|
||||
G = "goto_file_end"
|
||||
g = "goto_file_start"
|
||||
'';
|
||||
};
|
||||
|
||||
defaultEditor = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
|
@ -200,7 +212,9 @@ in {
|
|||
xdg.configFile = let
|
||||
settings = {
|
||||
"helix/config.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "helix-config" cfg.settings;
|
||||
text =
|
||||
builtins.readFile (tomlFormat.generate "helix-config" cfg.settings)
|
||||
+ "\n" + cfg.extraConfig;
|
||||
};
|
||||
"helix/languages.toml" = mkIf (cfg.languages != { }) {
|
||||
source = tomlFormat.generate "helix-languages-config" cfg.languages;
|
||||
|
|
@ -210,10 +224,10 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
themes = (mapAttrs' (n: v:
|
||||
themes = mapAttrs' (n: v:
|
||||
nameValuePair "helix/themes/${n}.toml" {
|
||||
source = tomlFormat.generate "helix-theme-${n}" v;
|
||||
}) cfg.themes);
|
||||
}) cfg.themes;
|
||||
in settings // themes;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue