Skip to content

Instantly share code, notes, and snippets.

@manse
Last active May 14, 2017 17:44
Show Gist options
  • Save manse/436e3eb2d76320010f9b236cd4386c3d to your computer and use it in GitHub Desktop.
Save manse/436e3eb2d76320010f9b236cd4386c3d to your computer and use it in GitHub Desktop.
set PATH $HOME/.nodebrew/current/bin $PATH >/dev/null ^&1
set PATH $HOME/.rbenv/shims $PATH >/dev/null ^&1
rbenv init - | source
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set red (set_color red)
set gray (set_color -o black)
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_branch yellow
set __fish_git_prompt_color_upstream_ahead green
set __fish_git_prompt_color_dirtystate red
set __fish_git_prompt_color_stagedstate red
set __fish_git_prompt_color_untrackedfiles red
set __fish_git_prompt_color_upstream_behind red
# Status Chars
set __fish_git_prompt_char_dirtystate '✚ '
set __fish_git_prompt_char_stagedstate '● '
set __fish_git_prompt_char_untrackedfiles '…'
set __fish_git_prompt_char_stashstate '↩ '
set __fish_git_prompt_char_upstream_ahead '👆 '
set __fish_git_prompt_char_upstream_equal '👌 '
set __fish_git_prompt_char_upstream_behind '👇 '
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname | string split '.')[1]
end
function prompt_hostname
echo $__fish_prompt_hostname
end
function fish_prompt
test $SSH_TTY
and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' '
test $USER = 'root'
and echo (set_color red)"#"
echo -n (set_color cyan)(prompt_pwd) (set_color green)'❯ '
set_color normal
end
function fish_right_prompt
printf '%s ' (__fish_git_prompt)
set_color normal
end
function cd
if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
end
# Avoid set completions.
set -l previous $PWD
if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
end
builtin cd $argv
set -l cd_status $status
# Log history
if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g dirprev $dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
end
if test $cd_status -ne 0
return 1
end
ls
return $status
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment