Skip to content

Instantly share code, notes, and snippets.

@mjs2600
Created April 9, 2018 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjs2600/002769f559a52b4bf26c35f408a8d1e3 to your computer and use it in GitHub Desktop.
Save mjs2600/002769f559a52b4bf26c35f408a8d1e3 to your computer and use it in GitHub Desktop.
My Fish Theme
# Theme based on Bira theme from oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/bira.zsh-theme
# Some code stolen from oh-my-fish clearance theme: https://github.com/bpinto/oh-my-fish/blob/master/themes/clearance/
function __user_host
set -l content
if [ (id -u) = "0" ];
echo -n (set_color --bold red)
else
echo -n (set_color --bold green)
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 _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _git_is_dirty
echo (command git status -s --ignore-submodules=dirty ^/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 __elixir_version
set elixir_version (asdf local elixir)
echo -n (set_color purple) ‹$elixir_version› (set_color normal)
end
function fish_prompt
echo -n (set_color white)"╭─"(set_color normal)
__user_host
__current_path
__elixir_version
__git_status
echo -e ''
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