Add bass and change theme to l #fishshell
This commit is contained in:
@ -1,29 +1,37 @@
|
||||
# To show the right prompt please set
|
||||
# set theme_display_rbenv 'yes' (config.fish)
|
||||
# set theme_display_rbenv_gemset 'yes' (config.fish)
|
||||
# set theme_display_rbenv_with_gemfile_only 'yes' (config.fish)
|
||||
|
||||
function get_git_status -d "Gets the current git status"
|
||||
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||
set -l dirty (command git status -s --ignore-submodules=dirty | wc -l | sed -e 's/^ *//' -e 's/ *$//' 2> /dev/null)
|
||||
set -l ref (command git describe --tags --exact-match ^/dev/null ; or command git symbolic-ref --short HEAD 2> /dev/null ; or command git rev-parse --short HEAD 2> /dev/null)
|
||||
|
||||
if [ "$dirty" != "0" ]
|
||||
set_color -b normal
|
||||
set_color red
|
||||
echo "$dirty changed file"
|
||||
if [ "$dirty" != "1" ]
|
||||
echo "s"
|
||||
end
|
||||
echo " "
|
||||
set_color -b red
|
||||
set_color white
|
||||
else
|
||||
set_color -b cyan
|
||||
set_color white
|
||||
end
|
||||
|
||||
echo " $ref "
|
||||
set_color normal
|
||||
end
|
||||
function _ruby_version
|
||||
echo (command rbenv version-name | sed 's/\n//')
|
||||
end
|
||||
|
||||
function fish_right_prompt -d "Prints right prompt"
|
||||
get_git_status
|
||||
end
|
||||
function _ruby_gemset
|
||||
echo (command rbenv gemset active ^/dev/null | sed -e 's| global||')
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
if [ "$theme_display_rbenv" = 'yes' ]
|
||||
set -l red (set_color red)
|
||||
set -l normal (set_color normal)
|
||||
set ruby_info $red(_ruby_version)
|
||||
|
||||
if [ "$theme_display_rbenv_gemset" = 'yes' ]
|
||||
if [ (_ruby_gemset) ]
|
||||
set -l ruby_gemset $red(_ruby_gemset)
|
||||
set ruby_info "$ruby_info@$ruby_gemset"
|
||||
end
|
||||
end
|
||||
|
||||
if [ "$theme_display_rbenv_with_gemfile_only" = 'yes' ]
|
||||
if test -f Gemfile
|
||||
echo -n -s $ruby_info $normal
|
||||
else
|
||||
echo -n -s $normal
|
||||
end
|
||||
else
|
||||
echo -n -s $ruby_info $normal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user