From 4833a8b532e92bad14f5e8867c27488e72eac955 Mon Sep 17 00:00:00 2001 From: Ryan Orendorff Date: Mon, 23 Sep 2019 22:11:58 -0700 Subject: [PATCH] fish: add section headers to generated config The section headers help show where each section came from when looking at the generated config. Added a note about how the config was generated in the generated file. --- modules/programs/fish.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 9ae350c29..50cee2c06 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -212,9 +212,12 @@ in ''; xdg.configFile."fish/config.fish".text = '' - # ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated automatically. + # ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated + # automatically by home-manager. + # if we haven't sourced the general config, do it if not set -q __fish_general_config_sourced + set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path fenv source ${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh > /dev/null set -e fish_function_path[1] @@ -223,31 +226,43 @@ in # and leave a note so we don't source this config section again from # this very shell (children will source the general config anew) set -g __fish_general_config_sourced 1 + end + # if we haven't sourced the login config, do it status --is-login; and not set -q __fish_login_config_sourced and begin + # Login shell initialisation ${cfg.loginShellInit} + # and leave a note so we don't source this config section again from # this very shell (children will source the general config anew) set -g __fish_login_config_sourced 1 + end + # if we haven't sourced the interactive config, do it status --is-interactive; and not set -q __fish_interactive_config_sourced and begin - # Abbrs + + # Abbreviations ${abbrsStr} # Aliases ${aliasesStr} + # Prompt initialisation ${cfg.promptInit} + + # Interactive shell intialisation ${cfg.interactiveShellInit} + # and leave a note so we don't source this config section again from # this very shell (children will source the general config anew, # allowing configuration changes in, e.g, aliases, to propagate) set -g __fish_interactive_config_sourced 1 + end ''; } {