Switch to using a fish theme with a hostname #fishshell

This commit is contained in:
Colin Powell
2018-12-12 22:39:41 -05:00
parent b3896c39b1
commit 2c3e0d9f79
2 changed files with 11 additions and 36 deletions

View File

@ -4,4 +4,4 @@ fishgretel/fasd
2m/fish-gpg-tty
asdf-vm/asdf
edc/bass
oh-my-fish/theme-l
oh-my-fish/theme-mtahmed

View File

@ -1,37 +1,12 @@
# 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 _ruby_version
echo (command rbenv version-name | sed 's/\n//')
end
function _ruby_gemset
echo (command rbenv gemset active ^/dev/null | sed -e 's| global||')
end
# name: mtahmed
# Left prompt:
# - First 10 characters of hostname if ssh'ed
# - Current directory name
# - ─╼
# Right prompt:
# - Exit code of the previous command
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
set -l last_status $status
set_color $fish_color_cwd
printf $last_status
end