Move to new theme for #fish
This commit is contained in:
@ -1 +0,0 @@
|
|||||||
fisher copy-user-key-bindings
|
|
||||||
@ -2,5 +2,4 @@ edc/bass
|
|||||||
jethrokuan/fzf
|
jethrokuan/fzf
|
||||||
2m/fish-gpg-tty
|
2m/fish-gpg-tty
|
||||||
oh-my-fish/plugin-direnv
|
oh-my-fish/plugin-direnv
|
||||||
oh-my-fish/theme-bobthefish
|
oh-my-fish/theme-scorphish
|
||||||
oh-my-fish/theme-batman
|
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
function fish_greeting
|
function fish_greeting -d "what's up, fish?"
|
||||||
echo (__batman_color_dim)(uname -mnprs)(__batman_color_off)
|
set_color $fish_color_autosuggestion[1]
|
||||||
|
uname -npsr
|
||||||
|
uptime
|
||||||
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
|
|
||||||
#
|
|
||||||
# If you want to override this with your own mode prompt, disable bobthefish's
|
|
||||||
# built-in mode prompt in your fish config:
|
|
||||||
#
|
|
||||||
# set -g theme_display_vi no
|
|
||||||
|
|
||||||
function fish_mode_prompt
|
function fish_mode_prompt
|
||||||
|
# Turns off mode indicator
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,20 +1,149 @@
|
|||||||
|
# name: scorphish
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
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)
|
||||||
|
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_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)
|
||||||
|
|
||||||
|
for remote in (git remote | grep 'origin\|upstream')
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
test $status -ne 0;
|
set -l exit_code $status
|
||||||
and set -l colors 600 900 c00
|
|
||||||
or set -l colors 333 666 aaa
|
|
||||||
|
|
||||||
set -l pwd (prompt_pwd)
|
set -l gray (set_color 666)
|
||||||
set -l base (basename "$pwd")
|
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 -l expr "s|~|"(__batman_color_fst)"^^"(__batman_color_off)"|g; \
|
set_color -o 666
|
||||||
s|/|"(__batman_color_snd)"/"(__batman_color_off)"|g; \
|
printf '['
|
||||||
s|"$base"|"(__batman_color_fst)$base(__batman_color_off)" |g"
|
|
||||||
|
|
||||||
echo -n (echo "$pwd" | sed -e $expr)(__batman_color_off)
|
_prompt_whoami $gray $green
|
||||||
|
|
||||||
for color in $colors
|
set_color -o cyan
|
||||||
echo -n (set_color $color)">"
|
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
|
end
|
||||||
|
|
||||||
echo -n " "
|
_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
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,43 +1,14 @@
|
|||||||
function git::is_stashed
|
|
||||||
command git rev-parse --verify --quiet refs/stash >/dev/null
|
|
||||||
end
|
|
||||||
|
|
||||||
function git::get_ahead_count
|
|
||||||
echo (command git log 2> /dev/null | grep '^commit' | wc -l | tr -d " ")
|
|
||||||
end
|
|
||||||
|
|
||||||
function git::branch_name
|
|
||||||
command git symbolic-ref --short HEAD
|
|
||||||
end
|
|
||||||
|
|
||||||
function git::is_touched
|
|
||||||
test -n (echo (command git status --porcelain))
|
|
||||||
end
|
|
||||||
|
|
||||||
function fish_right_prompt
|
function fish_right_prompt
|
||||||
set -l code $status
|
set -l exit_code $status
|
||||||
test $code -ne 0; and echo (__batman_color_dim)"("(__batman_color_trd)"$code"(__batman_color_dim)") "(__batman_color_off)
|
if test $exit_code -ne 0
|
||||||
|
set_color red
|
||||||
if test -n "$SSH_CONNECTION"
|
else
|
||||||
printf (__batman_color_trd)":"(__batman_color_dim)"$HOSTNAME "(__batman_color_off)
|
set_color green
|
||||||
end
|
|
||||||
|
|
||||||
if git rev-parse 2> /dev/null
|
|
||||||
git::is_stashed; and echo (__batman_color_trd)"^"(__batman_color_off)
|
|
||||||
printf (__batman_color_snd)"("(begin
|
|
||||||
if git::is_touched
|
|
||||||
echo (__batman_color_trd)"*"(__batman_color_off)
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
end
|
|
||||||
end)(__batman_color_fst)(git::branch_name)(__batman_color_snd)(begin
|
|
||||||
set -l count (git::get_ahead_count)
|
|
||||||
if test $count -eq 0
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo (__batman_color_trd)"+"(__batman_color_fst)$count
|
|
||||||
end
|
|
||||||
end)(__batman_color_snd)") "(__batman_color_off)
|
|
||||||
end
|
end
|
||||||
printf (__batman_color_dim)(date +%H(__batman_color_fst):(__batman_color_dim)%M(__batman_color_fst):(__batman_color_dim)%S)(__batman_color_off)" "
|
printf '%d' $exit_code
|
||||||
|
set_color -o 666
|
||||||
|
echo '|'
|
||||||
|
set_color -o 777
|
||||||
|
printf '%s' (date +%H:%M:%S)
|
||||||
|
set_color normal
|
||||||
end
|
end
|
||||||
@ -1,3 +1,4 @@
|
|||||||
function fish_title
|
function fish_title
|
||||||
echo "$PWD | $_" | sed "s|$HOME|~|g"
|
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]; and printf '%s %s' $_ (pwd); and return
|
||||||
|
printf '%s %s' (basename "$VIRTUAL_ENV") (pwd)
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user