mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 00:51:04 +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, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.programs.helix;
|
cfg = config.programs.helix;
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
@ -26,6 +24,20 @@ in {
|
||||||
description = "Extra packages available to hx.";
|
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 {
|
defaultEditor = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
@ -200,7 +212,9 @@ in {
|
||||||
xdg.configFile = let
|
xdg.configFile = let
|
||||||
settings = {
|
settings = {
|
||||||
"helix/config.toml" = mkIf (cfg.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 != { }) {
|
"helix/languages.toml" = mkIf (cfg.languages != { }) {
|
||||||
source = tomlFormat.generate "helix-languages-config" 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" {
|
nameValuePair "helix/themes/${n}.toml" {
|
||||||
source = tomlFormat.generate "helix-theme-${n}" v;
|
source = tomlFormat.generate "helix-theme-${n}" v;
|
||||||
}) cfg.themes);
|
}) cfg.themes;
|
||||||
in settings // themes;
|
in settings // themes;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
{ config, ... }:
|
{ config, ... }: {
|
||||||
|
|
||||||
{
|
|
||||||
programs.helix = {
|
programs.helix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
@ -18,6 +16,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
[keys.normal.G]
|
||||||
|
G = "goto_file_end"
|
||||||
|
g = "goto_file_start"
|
||||||
|
'';
|
||||||
|
|
||||||
languages = {
|
languages = {
|
||||||
language-server.typescript-language-server = let
|
language-server.typescript-language-server = let
|
||||||
typescript-language-server = config.lib.test.mkStubPackage {
|
typescript-language-server = config.lib.test.mkStubPackage {
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,7 @@ esc = ["collapse_selection", "keep_primary_selection"]
|
||||||
q = ":q"
|
q = ":q"
|
||||||
space = "file_picker"
|
space = "file_picker"
|
||||||
w = ":w"
|
w = ":w"
|
||||||
|
|
||||||
|
[keys.normal.G]
|
||||||
|
G = "goto_file_end"
|
||||||
|
g = "goto_file_start"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue