Change theme for fish, yet again #fishshell

This commit is contained in:
Colin Powell
2019-02-25 21:40:59 -05:00
parent ac22ba3f0b
commit 48d42c55a2
9 changed files with 436 additions and 153 deletions

View File

@ -0,0 +1,110 @@
function __fish_asdf_needs_command
set -l cmd (commandline -opc)
if test (count $cmd) -eq 1
return 0
end
return 1
end
function __fish_asdf_using_command -a current_command
set -l cmd (commandline -opc)
if test (count $cmd) -gt 1
if test $current_command = $cmd[2]
return 0
end
end
return 1
end
function __fish_asdf_arg_number -a number
set -l cmd (commandline -opc)
test (count $cmd) -eq $number
end
function __fish_asdf_arg_at -a number
set -l cmd (commandline -opc)
echo $cmd[$number]
end
function __fish_asdf_list_versions -a plugin
asdf list $plugin 2> /dev/null | sed -e 's/^\s*//'
end
function __fish_asdf_list_all -a plugin
asdf list-all $plugin 2> /dev/null
end
function __fish_asdf_plugin_list
asdf plugin-list 2> /dev/null
end
function __fish_asdf_plugin_list_all
asdf plugin-list-all 2> /dev/null
end
# plugin-add completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-add -d "Add git repo as plugin"
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list_all | grep -v \'*\' | awk \'{ print $1 }\')'
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 3' -a '(__fish_asdf_plugin_list_all | grep (__fish_asdf_arg_at 3) | awk \'{ print $2 }\')'
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 4'
# plugin-list completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list -d "List installed plugins"
# plugin-list-all completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list-all -d "List all existing plugins"
# plugin-remove completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-remove -d "Remove plugin and package versions"
complete -f -c asdf -n '__fish_asdf_using_command plugin-remove; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
# plugin-update completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-update -d "Update plugin"
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a --all
# install completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a install -d "Install a specific version of a package"
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_all (__fish_asdf_arg_at 3))'
# uninstall completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a uninstall -d "Remove a specific version of a package"
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
# current completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a current -d "Display version set or being used for package"
complete -f -c asdf -n '__fish_asdf_using_command current; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
# where completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a where -d "Display install path for an installed version"
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
# list completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a list -d "List installed versions of a package"
complete -f -c asdf -n '__fish_asdf_using_command list; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
# list-all completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a list-all -d "List all versions of a package"
complete -f -c asdf -n '__fish_asdf_using_command list-all; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
# reshim completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a reshim -d "Recreate shims for version of a package"
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
# local completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a local -d "Set local version for a plugin"
complete -f -c asdf -n '__fish_asdf_using_command local; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command local; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
# global completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a global -d "Set global version for a plugin"
complete -f -c asdf -n '__fish_asdf_using_command global; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command global; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
# misc
complete -f -c asdf -n '__fish_asdf_needs_command' -l "help" -d "Displays help"
complete -f -c asdf -n '__fish_asdf_needs_command' -l "version" -d "Displays asdf version"

View File

@ -1 +0,0 @@
fisher copy-user-key-bindings

View File

@ -1,2 +1,2 @@
source ~/.asdf/asdf.fish
thefuck --alias | source
source ~/.asdf/asdf.fish

View File

@ -3,3 +3,5 @@ jethrokuan/fzf
2m/fish-gpg-tty
oh-my-fish/plugin-direnv
oh-my-fish/theme-scorphish
oh-my-fish/theme-default
oh-my-fish/theme-qing

View File

@ -0,0 +1,167 @@
#!/bin/bash
# archey-osx 1.5.2 (https://github.com/obihann/archey-osx/)
# test to see if bash supports arrays
arraytest[0]='test' || (echo 'Error: Arrays are not supported in this version of
bash.' && exit 2)
# Detect the packager.
#if [ -x /usr/local/bin/brew ]; then
#detectedpackager=homebrew
#elif command -v port >/dev/null; then
#detectedpackager=macports
#else
#detectedpackager=none
#fi
# Get the command line options
opt_nocolor=f
opt_force_color=f
opt_offline=f
for arg in "$@"
do
case "${arg}" in
-p|--packager)
packager=$detectedpackager
;;
-m|--macports)
packager=macports
;;
-b|--nocolor)
opt_nocolor=t
;;
-c|--color)
opt_nocolor=f
opt_force_color=t
;;
-o|--offline)
opt_offline=t
;;
-h|--help)
echo "Archey OS X 1.5.2"
echo
echo "Usage: $0 [options]"
echo
echo " -p --packager Use auto detected package system (default packager: ${detectedpackager})."
echo " -m --macports Force use MacPorts as package system."
echo " -b --nocolor Turn color off."
echo " -c --color Force the color on (overrides --nocolor)."
echo " -o --offline Disable the IP address check."
exit 0
;;
*)
echo "Unknown argument: $1" 1>&2
echo "For help, use: $0 --help" 1>&2
exit 1
;;
esac
done
# System Variables
user=$(whoami)
hostname=$(hostname | sed 's/.local//g')
#if [[ "${opt_offline}" = f ]]; then
#ipfile="${HOME}/.archey-ip"
#if [ -a "$ipfile" ] && test `find "$ipfile" -mmin -360`; then
#while read -r line; do
#ip="$line"
#done < "$ipfile"
#else
#ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
#echo $ip > "$ipfile"
#fi
#fi
distro="OS X $(sw_vers -productVersion)"
kernel=$(uname)
uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
shell="$SHELL"
terminal="$TERM ${TERM_PROGRAM//_/ }"
cpu=$(sysctl -n machdep.cpu.brand_string)
#battery=$(ioreg -c AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
battery=$(pmset -g batt | xargs | egrep "\d+%" -o)
# removes (R) and (TM) from the CPU name so it fits in a standard 80 window
cpu=$(echo "$cpu" | awk '$1=$1' | sed 's/([A-Z]\{1,2\})//g')
ram="$(( $(sysctl -n hw.memsize) / 1024 ** 3 )) GB"
disk=$(df | head -2 | tail -1 | awk '{print $5}')
# Set up colors if:
# * stdout is a tty
# * the user hasn't turned it off
# * or if we're forcing color
if [[ ( -t 1 && "${opt_nocolor}" = f) || "${opt_force_color}" = t ]]
then
RED=$(tput setaf 1 2>/dev/null)
GREEN=$(tput setaf 2 2>/dev/null)
YELLOW=$(tput setaf 3 2>/dev/null)
BLUE=$(tput setaf 4 2>/dev/null)
PURPLE=$(tput setaf 5 2>/dev/null)
textColor=$(tput setaf 6 2>/dev/null)
normal=$(tput sgr0 2>/dev/null)
fi
case "${packager}" in
homebrew)
packagehandler=$(brew list -1 | wc -l | awk '{print $1 }')
;;
macports)
packagehandler=$(port installed | wc -l | awk '{print $1 }')
;;
*)
packagehandler=0
;;
esac
fieldlist[${#fieldlist[@]}]="${textColor}User:${normal} ${user}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Hostname:${normal} ${hostname}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Distro:${normal} ${distro}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Kernel:${normal} ${kernel}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Uptime:${normal} ${uptime}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Shell:${normal} ${shell}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Terminal:${normal} ${terminal}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Terminal Size:${normal} $(tput lines) x $(tput cols)"
#if [ ${packagehandler} -ne 0 ]; then
#fieldlist[${#fieldlist[@]}]="${textColor}Packages:${normal} ${packagehandler}${normal}"
#fi
fieldlist[${#fieldlist[@]}]="${textColor}CPU:${normal} ${cpu}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Memory:${normal} ${ram}${normal}"
fieldlist[${#fieldlist[@]}]="${textColor}Disk:${normal} ${disk}${normal}"
#if [ ! -z $battery ]; then
#fi
fieldlist[${#fieldlist[@]}]="${textColor}Battery:${normal} ${battery}${normal}"
#if [ "${opt_offline}" = f ]; then
#fieldlist[${#fieldlist[@]}]="${textColor}IP Address:${normal} ${ip}${normal}"
#fi
fieldlist[${#fieldlist[@]}]="${textColor}Date:${normal} $(date)${normal}"
logofile=${ARCHEY_LOGO_FILE:-"${HOME}/.config/archey-logo"}
if [ -a "$logofile" ]
then
source "$logofile"
else
# The ${foo# } is a cheat so that it lines up here as well
# as when run.
echo -e "
${GREEN# } ####### ${fieldlist[0]}
${GREEN# } ######## ${fieldlist[1]}
${GREEN# } ##### ${fieldlist[2]}
${GREEN# } ##### ${fieldlist[3]}
${YELLOW# } ###### ${fieldlist[4]}
${YELLOW# } ######## ${fieldlist[5]}
${RED# } ########### ${fieldlist[6]}
${RED# } ##### ##### ${fieldlist[7]}
${RED# } ##### ##### ${fieldlist[8]}
${PURPLE# } ##### ##### ${fieldlist[9]}
${PURPLE# } ##### ##### ## ${fieldlist[10]}
${BLUE# } ##### ########## ${fieldlist[11]}
${BLUE# } ##### ####### ${fieldlist[12]}
${normal}
"
fi

View File

@ -1,6 +1,13 @@
# Set global color styles, for example:
#
# function cyan_error
# set_color -o red
# end
#
# function cyan_normal
# set_color normal
#
function fish_greeting -d "what's up, fish?"
set_color $fish_color_autosuggestion[1]
uname -npsr
uptime
set_color normal
bash (dirname (status -f))/archey.sh
end

View File

@ -1,149 +1,60 @@
# name: scorphish
# name: cyan
set -g cyan (set_color 33FFFF)
set -g yellow (set_color CCFF00)
set -g red (set_color -o red)
set -g green (set_color -o green)
set -g white (set_color -o white)
set -g blue (set_color -o blue)
set -g magenta (set_color -o magenta)
set -g normal (set_color normal)
set -g purple (set_color -o purple)
function _prompt_rubies -a sep_color -a ruby_color -d 'Display current Ruby (rvm/rbenv)'
[ "$theme_display_ruby" = 'no' ]; and return
set -l ruby_version
if type rvm-prompt >/dev/null 2>&1
set ruby_version (rvm-prompt i v g)
else if type rbenv >/dev/null 2>&1
set ruby_version (rbenv version-name)
end
[ -z "$ruby_version" ]; and return
set -g FISH_GIT_PROMPT_EQUAL_REMOTE "$magenta=$normal"
set -g FISH_GIT_PROMPT_AHEAD_REMOTE "$magenta>$normal"
set -g FISH_GIT_PROMPT_BEHIND_REMOTE "$magenta<$normal"
set -g FISH_GIT_PROMPT_DIVERGED_REMOTE "$red<>$normal"
echo -n -s $sep_color '|' $ruby_color (echo -n -s $ruby_version | cut -d- -f2-)
end
function _prompt_virtualfish -a sep_color -a venv_color -d "Display activated virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)"
[ "$theme_display_virtualenv" = 'no' ]; and return
echo -n -s $sep_color '|' $venv_color $PYTHON_VERSION
[ -n "$VIRTUAL_ENV" ]; and echo -n -s '@'(basename "$VIRTUAL_ENV")
end
function _prompt_rust -a sep_color -a rust_color -d "Display current activated Rust"
[ "$theme_display_rust" != 'yes' ]; and return
echo -n -s $sep_color '|' $rust_color (rustc --version | cut -d\ -f2)
end
function _prompt_nvm -a sep_color -a nvm_color -d "Display current activated Node"
[ "$theme_display_nvm" != 'yes' -o -z "$NVM_VERSION" ]; and return
echo -n -s $sep_color '|' $nvm_color $NVM_VERSION
end
function _prompt_whoami -a sep_color -a whoami_color -d "Display user@host if on a SSH session"
if set -q SSH_TTY
echo -n -s $whoami_color (whoami)@(hostname) $sep_color '|'
end
end
function _git_branch_name
function _git_branch_name -d "Display current branch's name"
echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty 2> /dev/null)
function _git_short_sha -d "Display short hash"
echo (command git rev-parse --short HEAD 2> /dev/null)
end
function _git_ahead_count -a remote -a branch_name
echo (command git log $remote/$branch_name..HEAD 2> /dev/null | \
grep '^commit' | wc -l | tr -d ' ')
end
function _git_ahead -d "git repository is ahead or behind origin"
set -l commits (command git rev-list --left-right '@{upstream}...HEAD' 2> /dev/null)
function _git_dirty_remotes -a remote_color -a ahead_color
set current_branch (command git rev-parse --abbrev-ref HEAD 2> /dev/null)
set current_ref (command git rev-parse HEAD 2> /dev/null)
if [ $status != 0 ]
return
end
for remote in (git remote | grep 'origin\|upstream')
set -l behind (count (for arg in $commits; echo $arg; end | grep '^<'))
set -l ahead (count (for arg in $commits; echo $arg; end | grep -v '^<'))
set -l git_ahead_count (_git_ahead_count $remote $current_branch)
set remote_branch "refs/remotes/$remote/$current_branch"
set remote_ref (git for-each-ref --format='%(objectname)' $remote_branch)
if test "$remote_ref" != ''
if test "$remote_ref" != $current_ref
if [ $git_ahead_count != 0 ]
echo -n "$remote_color!"
echo -n "$ahead_color+$git_ahead_count$normal"
end
end
end
switch "$ahead $behind"
case '' # no upstream
echo ""
case '0 0' # equal to upstream
echo "$FISH_GIT_PROMPT_EQUAL_REMOTE"
case '* 0' # ahead of upstream
echo "$FISH_GIT_PROMPT_AHEAD_REMOTE"
case '0 *' # behind upstream
echo "$FISH_GIT_PROMPT_BEHIND_REMOTE"
case '*' # diverged from upstream
echo "$FISH_GIT_PROMPT_DIVERGED_REMOTE"
end
end
function fish_prompt
set -l exit_code $status
set -l cwd $green(basename (prompt_pwd))
if [ (command git rev-parse --git-dir 2> /dev/null) ]
set -l git_branch $yellow(_git_branch_name)
set -l git_sha $magenta(_git_short_sha)$normal
set -l git_branch_ahead (_git_ahead)
set -l gray (set_color 666)
set -l blue (set_color blue)
set -l red (set_color red)
set -l normal (set_color normal)
set -l yellow (set_color ffcc00)
set -l orange (set_color ffb300)
set -l green (set_color green)
set_color -o 666
printf '['
_prompt_whoami $gray $green
set_color -o cyan
printf '%s' (prompt_pwd)
_prompt_rubies $gray $red
if [ "$VIRTUAL_ENV" != "$LAST_VIRTUAL_ENV" -o -z "$PYTHON_VERSION" ]
set -gx PYTHON_VERSION (python --version 2>&1 | cut -d\ -f2)
set -gx LAST_VIRTUAL_ENV $VIRTUAL_ENV
end
_prompt_virtualfish $gray $blue
_prompt_rust $gray $orange
if [ "$NVM_BIN" != "$LAST_NVM_BIN" -o -z "$NVM_VERSION" ]
set -gx NVM_VERSION (node --version)
set -gx LAST_NVM_BIN $NVM_BIN
end
_prompt_nvm $gray $green
set_color -o 666
if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE
printf ']'
else
printf ']\n'
end
# Show git branch and dirty state
if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name)
set dirty_remotes (_git_dirty_remotes $red $orange)
if [ (_is_git_dirty) ]
echo -n -s $gray '' $yellow $git_branch $red '*' $dirty_remotes $gray '' $normal
else
echo -n -s $gray '' $yellow $git_branch $red $dirty_remotes $gray '' $normal
set git_info "$green($git_branch#$normal$git_sha$green)$normal $git_branch_ahead"
end
end
if test $exit_code -ne 0
set arrow_colors 600 900 c00 f00
else
set arrow_colors 060 090 0c0 0f0
end
if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE
printf '\n'
else
printf ' '
end
for arrow_color in $arrow_colors
set_color $arrow_color
printf '»'
end
printf ' '
set_color normal
echo -n -s $normal $cyan (whoami) '@' $normal $blue (hostname -s) $normal ' ' $cwd ' ' $git_info $yellow' ✗ '$normal
end

View File

@ -1,14 +1,102 @@
# Colors vary depending on time lapsed.
set -g FISH_GIT_TIME_SINCE_COMMIT_SHORT (set_color -o green)
set -g FISH_GIT_TIME_SHORT_COMMIT_MEDIUM (set_color -o yellow)
set -g FISH_GIT_TIME_SINCE_COMMIT_LONG (set_color CC0000)
set -g FISH_GIT_TIME_SINCE_COMMIT_NEUTRAL (set_color -o cyan)
set -g normal (set_color normal)
set -g cyan (set_color 33FFFF)
set -g yellow (set_color -o yellow)
set -g red (set_color CC0000)
set -g green (set_color -o green)
set -g white (set_color -o white)
set -g blue (set_color -o blue)
set -g magenta (set_color -o magenta)
set -g normal (set_color normal)
set -g purple (set_color -o purple)
set -g FISH_GIT_PROMPT_ADDED "$green$normal"
set -g FISH_GIT_PROMPT_MODIFIED "$blue""M""$normal"
set -g FISH_GIT_PROMPT_DELETED "$red$normal"
set -g FISH_GIT_PROMPT_RENAMED "$magenta$normal"
set -g FISH_GIT_PROMPT_UNMERGED "$yellow$normal"
set -g FISH_GIT_PROMPT_UNTRACKED "$cyan$normal"
set -g FISH_GIT_PROMPT_CLEAN "$green$normal"
function _git_status -d "git repo status about Untracked, new file and so on."
if [ (command git rev-parse --git-dir 2> /dev/null) ]
if [ (command git status | grep -c "working directory clean") -eq 1 ]
echo "$FISH_GIT_PROMPT_CLEAN"
else
if [ (command git status | grep -c "Untracked files:") -ne 0 ]
set output $FISH_GIT_PROMPT_UNTRACKED
end
if [ (command git status | grep -c "new file:") -ne 0 ]
set output "$output $FISH_GIT_PROMPT_ADDED"
end
if [ (command git status | grep -c "renamed:") -ne 0 ]
set output "$output $FISH_GIT_PROMPT_RENAMED"
end
if [ (command git status | grep -c "modified:") -ne 0 ]
set output "$output $FISH_GIT_PROMPT_MODIFIED"
end
if [ (command git status | grep -c "deleted:") -ne 0 ]
set output "$output $FISH_GIT_PROMPT_DELETED"
end
echo $output
end
end
end
function _git_time_since_commit -d "Display the time since last commit"
if [ (command git rev-parse --git-dir 2> /dev/null) ]
# Only proceed if there is actually a commit.
if [ (command git log 2>&1 > /dev/null | grep -c "^fatal:") -eq 0 ]
# Get the last commit.
set last_commit (command git log --pretty=format:'%at' -1 2> /dev/null)
set now (command date +%s)
set seconds_since_last_commit (math "$now-$last_commit")
# Totals
set MINUTES (math "$seconds_since_last_commit / 60")
set HOURS (math "$seconds_since_last_commit/3600")
# Sub-hours and sub-minutes
set DAYS (math "$seconds_since_last_commit / 86400")
set SUB_HOURS (math "$HOURS % 24")
set SUB_MINUTES (math "$MINUTES % 60")
if git status -s > /dev/null
if [ "$MINUTES" -gt 30 ]
set COLOR $FISH_GIT_TIME_SINCE_COMMIT_LONG
else if [ "$MINUTES" -gt 10 ]
set COLOR $FISH_GIT_TIME_SHORT_COMMIT_MEDIUM
else
set COLOR $FISH_GIT_TIME_SINCE_COMMIT_SHORT
end
else
set COLOR $ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
end
if [ "$HOURS" -gt 24 ]
echo "[$COLOR$DAYS""d""$SUB_HOURS""h""$SUB_MINUTES""m""$normal]"
else if [ "$MINUTES" -gt 60 ]
echo "[$COLOR$HOURS""h""$SUB_MINUTES""m""$normal]"
else
echo "[$COLOR$MINUTES""m""$normal]"
end
else
set COLOR $FISH_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "[$COLOR~$normal]"
end
end
end
function fish_right_prompt
set -l exit_code $status
if test $exit_code -ne 0
set_color red
else
set_color green
end
printf '%d' $exit_code
set_color -o 666
echo '|'
set_color -o 777
printf '%s' (date +%H:%M:%S)
set_color normal
end
set -l git_info (_git_time_since_commit)
set -l git_status (_git_status)
set git_info "$git_info$git_status"
echo -n -s $git_info
end

View File

@ -1,4 +1,3 @@
function fish_title
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]; and printf '%s %s' $_ (pwd); and return
printf '%s %s' (basename "$VIRTUAL_ENV") (pwd)
end
# Customize the title bar of the terminal window.
end