Skip to content

Instantly share code, notes, and snippets.

@knubie
Created July 25, 2016 12:57
Show Gist options
  • Save knubie/9884b6b78761cd12808d5e0ea4ee3a28 to your computer and use it in GitHub Desktop.
Save knubie/9884b6b78761cd12808d5e0ea4ee3a28 to your computer and use it in GitHub Desktop.
set -gx PATH $HOME/.bin $HOME/Library/Haskell/bin /usr/local/bin $HOME/.rbenv/bin $HOME/.rbenv/shims /usr/local/share/npm/bin /usr/local/heroku/bin /usr/local/opt/fzf/bin $PATH
# /usr/local/opt/coreutils/libexec/gnubin
set -gx EDITOR vim
set -gx FIGLET_FONTDIR $HOME/.figlet
# Pretty ls colors
set -x LSCOLORS Axhxaxaxaxaxaxaxaxaxax
# Variables used in the prompt
set -g git_status ''
set -g git_status_last ''
set -g git_branch ''
# More pretty colors
set fish_color_command -o black
set fish_color_param black
set fish_color_quote -o cyan
set fish_pager_color_prefix white
set fish_pager_color_completion cyan
set fish_color_autosuggestion white
function git
if test $argv[1] = "status"
command git $argv | grcat conf.git
else if test $argv[1] = "push"
command git $argv --progress 2>&1 | grcat conf.gitpush
else if test $argv[1] = "commit"
set git_status_last (command git status 2>/dev/null | tail -n 1)
else
command git $argv
end
end
function ssh
__fish_cursor_xterm block
set -lx TERM xterm
command ssh $argv
end
function pass
command security find-generic-password -s $argv -w
end
# -F show special character like '/' and '@'
# -G use colors
# 1 show one column
# a show invisibles
alias ls 'ls -FG1a'
#function cat
#command cat $argv | vimcat
#end
complete -c git -a 'graph' -d 'Show commit history'
complete -c git -a 'amend' -d 'Amend previous commit'
complete -c git -a 'count' -d 'Show commit count by user'
alias attach 'tmux attach -t'
complete -c attach -x -a '(tmux list-sessions -F "#S")' -d 'Session'
alias ... ../..
set fish_cursor_default block
set fish_cursor_normal block
set fish_cursor_insert line
set fish_cursor_visual block
#fish_vi_cursor
#function fish_vi_cursor_handle --on-variable fish_bind_mode
#set -l varname fish_cursor_$fish_bind_mode
#if not set -q $varname
#set varname fish_cursor_unknown
#end
#__fish_cursor_xterm $$varname
##$fcn \$\$varname
##$tmux_postfix
#end
#set fish_key_bindings fish_user_key_bindings
# Amazing prompt
function fish_prompt
set_color magenta
for i in (seq $COLUMNS)[2..-1]
echo -n '─'
end
printf "\n"
if test -n "$TMUX" #If inside tmux
else
set_color -o cyan
echo -n (hostname -s)
set_color normal
echo -n ' in '
set_color -o cyan
echo -n (pwd|sed "s=$HOME=~=")
if test -n "$git_status"
set_color normal
echo -n " on "
if test "$git_status_last" = "nothing to commit, working directory clean"
# Clean
set_color -o white
echo -n $git_branch
else
# Dirty
set_color -o black
echo -n $git_branch
end
end
end
set_color -o white
echo -n " ∴ "
end
set fish_greeting ""
function tmux_pwd --on-event fish_prompt
if test -n "$TMUX"
tmux setenv TMUXPWD_(command tmux display -p "#I") "$PWD"
bash tmux_set_status.sh
end
end
function cd
builtin cd $argv
set git_status (command git status 2>/dev/null | tail -n 2)
set git_status_last (command git status 2>/dev/null | tail -n 1)
if test -n "$git_status"
set git_branch (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
set git_status_last (command git status 2>/dev/null | tail -n 1)
if test -n "$git_branch"
else
set -l tag (command git describe --exact-match ^/dev/null)
if test -n "$tag"
set git_branch "$tag"
else
set git_branch (command git rev-parse --short HEAD ^/dev/null)
end
end
else
set git_branch ''
end
end
#function set_npm_bin_path --on-event fish_prompt
#if test -d (npm bin)
#set PATH (npm bin) $PATH
#end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment