improve prompt a bit more
This commit is contained in:
parent
c6983b6f5a
commit
9d51d447f3
2 changed files with 18 additions and 7 deletions
|
@ -1,12 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config) conf;
|
||||
inherit (config.conf) keys;
|
||||
inherit (lib.strings) concatMapStrings;
|
||||
in {
|
||||
programs.fish.enable = true;
|
||||
users.defaultUserShell = pkgs.fish;
|
||||
|
|
|
@ -5,7 +5,7 @@ if test $last_status -ne 0
|
|||
set stat (set_color -o red)"[$last_status] "(set_color normal)
|
||||
end
|
||||
|
||||
set -l path (set_color -i blue)(prompt_pwd -D 4096)(set_color normal)
|
||||
set -l path (set_color -i blue)"$(prompt_pwd -D 4096) "(set_color normal)
|
||||
|
||||
set -l prompt (set_color -o magenta)"> "(set_color normal)
|
||||
|
||||
|
@ -16,12 +16,25 @@ end
|
|||
|
||||
set -l ssh
|
||||
if test -n "$SSH_CLIENT"
|
||||
set ssh (set_color brblack)"\t$USER@$hostname"(set_color normal)
|
||||
set ssh (set_color brblack)"$USER@$hostname "(set_color normal)
|
||||
end
|
||||
|
||||
set -l git
|
||||
set -l IS_GIT_REPO (command git rev-parse --is-inside-work-tree &>/dev/null)
|
||||
if test -n "$IS_GIT_REPO"
|
||||
set -l is_git (command git rev-parse --is-inside-work-tree 2>/dev/null)
|
||||
if test -n "$is_git"
|
||||
|
||||
set -l branch (git branch --show-current)
|
||||
if test -z $branch
|
||||
set branch "detached HEAD"
|
||||
end
|
||||
|
||||
set -l clean
|
||||
set -l is_dirty (command git status --porcelain)
|
||||
if test -n "$is_dirty"
|
||||
set clean "*"
|
||||
end
|
||||
|
||||
set git (set_color brblack)"$clean$branch "(set_color normal)
|
||||
end
|
||||
|
||||
string join "" -- $stat $path $ssh \n $nix $prompt
|
||||
string join "" -- $stat $path $git $ssh \n $nix $prompt
|
||||
|
|
Loading…
Add table
Reference in a new issue