Simplifies the git_ family of functions to make fish_right_prompt more readable. git_prompt function is added, which prints the relevant git prompt information. The git_ family of functions is moved into the git_prompt function, and fish_right_prompt calls git_prompt Going forward I'm trying to have modules in charge of the data for other modules, so I moved the nnn alias call from fish to n, and added a handy "extraFunctions" config option to fish. Maintaining the fish module's control of the functions, but allowing others to add stuff in
34 lines
926 B
Nix
34 lines
926 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
options.fish = {
|
|
enable = lib.mkEnableOption "Enables fish";
|
|
extraFunctions = lib.mkOption {
|
|
type = with lib.types; attrsOf lines;
|
|
default = {};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.fish.enable {
|
|
programs.fish = {
|
|
enable = true;
|
|
functions = {
|
|
fish_greeting = "";
|
|
fish_prompt = ''
|
|
if test $status -eq 0
|
|
echo -n -s (set_color blue -o) τ " " (set_color normal)
|
|
else
|
|
echo -n -s (set_color red -o) τ " " (set_color normal)
|
|
end
|
|
'';
|
|
fish_right_prompt = ''
|
|
git_prompt
|
|
echo -n -s (set_color blue) (prompt_pwd) " "
|
|
echo -n -s (set_color yellow) $CMD_DURATION ms
|
|
echo -n -s (set_color normal)
|
|
'';
|
|
git_prompt = ''${builtins.readFile ./functions/git_prompt.fish}'';
|
|
} // config.fish.extraFunctions;
|
|
};
|
|
};
|
|
}
|