Put aliases.fish
, config.fish
to ~/.config/fish/
Put fish_prompt.fish
, fish_right_prompt.fish
, fish_title.fish
to ~/.config/fish/functions/
alias browse='hub browse' | |
alias ga='git add .' | |
alias gs='git status' | |
alias gca='git commit -v -a' | |
alias rs='rails server' | |
alias rc='rails console' |
set fish_path $HOME/.config/fish | |
. $fish_path/aliases.fish | |
set LC_CTYPE "utf-8" | |
set -x PATH /usr/local/bin:/usr/local/sbin:~/bin/jslint $PATH | |
set -x PATH /usr/local/heroku/bin $PATH | |
set -x PATH $HOME/.rbenv/bin $PATH | |
set -x PATH $HOME/.rbenv/shims $PATH | |
set fish_greeting | |
rbenv rehash >/dev/null ^&1 | |
#from https://coderwall.com/p/6hja1w | |
function rbenv_shell | |
set -l vers $argv[1] | |
switch "$vers" | |
case '--complete' | |
echo '--unset' | |
echo 'system' | |
exec rbenv-versions --bare | |
return | |
case '--unset' | |
set -e RBENV_VERSION | |
return 1 | |
case '' | |
if [ -z "$RBENV_VERSION" ] | |
echo "rbenv: no shell-specific version configured" >&2 | |
return 1 | |
else | |
echo "$RBENV_VERSION" | |
return | |
end | |
case '*' | |
rbenv prefix "$vers" > /dev/null | |
set -g -x RBENV_VERSION "$vers" | |
end | |
end | |
function rbenv | |
set -l command $argv[1] | |
[ (count $argv) -gt 1 ]; and set -l args $argv[2..-1] | |
switch $command | |
case shell | |
rbenv_shell $args | |
case '*' | |
command rbenv $command $args | |
end | |
end |
function fish_prompt | |
set_color $fish_color_operator | |
echo -n '[' | |
echo -n (prompt_pwd) | |
echo -n ']' | |
set_color $fish_color_command | |
echo -n '$ ' | |
set_color normal | |
end |
set fish_git_dirty_color red | |
function git_dirty_status | |
set -l dirty_status (git status -s --ignore-submodules=dirty 2> /dev/null) | |
if test -n (echo $dirty_status) | |
echo (set_color $fish_git_dirty_color)"*"(set_color normal) | |
end | |
end | |
set fish_git_branch_color green | |
function git_info | |
set -l git_branch (git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///') | |
if test -n $git_branch | |
echo -n (git_dirty_status) | |
echo -n (set_color $fish_git_branch_color)"["$git_branch"]"(set_color normal) | |
end | |
end | |
set fish_ruby_version blue | |
function ruby_version | |
set -l ruby_version (rbenv version 2> /dev/null | sed 's/[ \t].*$//') | |
echo -n (set_color $fish_ruby_version)"["$ruby_version"]"(set_color normal) | |
end | |
function fish_right_prompt | |
echo -n (git_info) | |
echo -n (ruby_version) | |
end |
function fish_title | |
set -l command (echo $_) | |
if test $command = "fish" | |
pwd | |
else | |
echo $command | |
end | |
end |
" Copy .zsh_history to .config/fish/fish_history | |
" vim .config/fish/fish_history | |
" :%s/:\(.\{-}\):.\{-};\(.*\)/- cmd: \2\r when:\1 |