Last active
October 5, 2019 16:47
-
-
Save piotrgredowski/81e4a75d3f586cbe8417d00711261e9b to your computer and use it in GitHub Desktop.
Mix of themes Bira and Candy for Fish shell
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
# Theme based on Candy and Bira theme from oh-my-zsh: | |
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/bira.zsh-theme | |
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/candy.zsh-theme | |
# Some code stolen from oh-my-fish clearance theme: https://github.com/bpinto/oh-my-fish/blob/master/themes/clearance/ | |
# Preview | |
# ✪ pg@liege [18:27:11] /home/pg/.local/share/omf/themes/81e4a75d3f586cbe8417d00711261e9b <master*> | |
# $ rm -rf / # yolo | |
# Some configuration | |
set user_color brgreen | |
set root_color red | |
set show_current_time true | |
set fancy_char_before_user ✪ | |
set fancy_char_before_root ☢ | |
set is_root [ (id -u) = "0" ] | |
function __user_host | |
set -l content | |
if eval $is_root; | |
echo -n (set_color --bold $root_color) | |
else | |
echo -n (set_color --bold $user_color) | |
end | |
echo -n $USER@(hostname|cut -d . -f 1) (set color normal) | |
end | |
function __current_path | |
echo -n (set_color --bold blue) (pwd) (set_color normal) | |
end | |
function __current_time | |
echo -n (set_color --bold white)" ["(date '+%H:%M:%S')"]"(set_color normal) | |
end | |
function _git_branch_name | |
echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||') | |
end | |
function _git_is_dirty | |
echo (command git status -s --ignore-submodules=dirty 2> /dev/null) | |
end | |
function __git_status | |
if [ (_git_branch_name) ] | |
set -l git_branch (_git_branch_name) | |
if [ (_git_is_dirty) ] | |
set git_info '<'$git_branch"*"'>' | |
else | |
set git_info '<'$git_branch'>' | |
end | |
echo -n (set_color yellow) $git_info (set_color normal) | |
end | |
end | |
function __fancy_char_before_user_or_root | |
if eval $is_root | |
echo -n (set_color red)"$fancy_char_before_root " | |
else | |
echo -n (set_color white)"$fancy_char_before_user " | |
end | |
echo -n (set_color normal) | |
end | |
function fish_prompt | |
__fancy_char_before_user_or_root | |
__user_host | |
if eval $show_current_time | |
__current_time | |
end | |
__current_path | |
set _is_root true | |
__git_status | |
echo -e '' | |
set _is_root false | |
echo (set_color white)""(set_color --bold white)"\$ "(set_color normal) | |
end | |
function fish_right_prompt | |
set -l st $status | |
if [ $st != 0 ]; | |
echo (set_color red) ↵ $st(set_color normal) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment