Created
January 19, 2019 04:06
-
-
Save mustofa-id/677e65655da6db14bf854740960459dd to your computer and use it in GitHub Desktop.
JavaScript object style for fish-shell prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
set -l _ob (set_color yellow)'{ '(set_color normal) | |
set -l _cb (set_color yellow)' }'(set_color normal) | |
set -l _c1 "┏┈$_ob" | |
# User | |
set -l _usr (set_color cyan)'usr: '(set_color green)'\'hm\''(set_color normal)', ' | |
# Git | |
set -l _git | |
set -l branch (git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
if test $branch | |
set _git (set_color cyan)'git: '(set_color green)"'$branch'"(set_color normal)', ' | |
end | |
# Directory | |
set -l _dir (set_color cyan)'dir: '(set_color green)"'"(basename $PWD)"'"(set_color normal) | |
if not test $last_status -eq 0 | |
set_color $fish_color_error | |
end | |
set -l _c2 "$_cb\n┗┈┈┈┈╼"(set_color yellow)'ᚧ '(set_color normal) | |
printf "\n$_c1$_usr$_git$_dir$_c2" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment