ソースを参照

Switch to using a fish theme with a hostname #fishshell

Colin Powell 6 年 前
コミット
2c3e0d9f79
2 ファイル変更11 行追加36 行削除
  1. 1 1
      config/fish/fishfile
  2. 10 35
      config/fish/functions/fish_right_prompt.fish

+ 1 - 1
config/fish/fishfile

@@ -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

+ 10 - 35
config/fish/functions/fish_right_prompt.fish

@@ -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