Skip to content

Instantly share code, notes, and snippets.

@ngoduykhanh
Last active April 17, 2016 16:54
Show Gist options
  • Save ngoduykhanh/7d156efadce70eae0ee2 to your computer and use it in GitHub Desktop.
Save ngoduykhanh/7d156efadce70eae0ee2 to your computer and use it in GitHub Desktop.
# Fucntion
function fish_prompt
set_color cyan -o
if test $PWD = $HOME
echo -n "~"
else
echo -n (basename $PWD)
end
set_color green -o
echo -n " >> "
if git status >/dev/null ^/dev/null
set_color red -o
echo -n "("(git branch | grep '*' | cut -c3-)")"
echo -n " "
if not test (git status | tail -1) = "nothing to commit, working directory clean"
set_color yellow -o
echo -n "× "
end
if test (git status | grep ahead)
set_color yellow -o
echo -n "↑ "
end
end
end
function cb
if count $argv > /dev/null
if test -e $argv[1]
cat $argv[1] | pbcopy
set_color cyan -o
echo "[INFO] Copied content of $argv[1] to clipboard."
else
set_color red -o
echo "[ERROR] File $argv[1] doesn't exist"
end
else
set_color red -o
echo "[ERROR] Please input your file to copy."
end
end
function randompw
if count $argv > /dev/null
openssl rand -base64 30|head -c$argv[1];echo
else
openssl rand -base64 30|head -c12;echo
end
end
# Alias config
alias cbssh "cb ~/.ssh/id_rsa.pub"
# Path config
#set -gx PATH /usr/local/bin/terraform/ $PATH
#set -gx PATH /usr/local/bin/packer/ $PATH
set -gx PATH /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python $PATH
set PATH $HOME/.rbenv/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
. (rbenv init -)
# Ansible hosts
set -gx ANSIBLE_HOSTS ~/.ansible_hosts
# Other source
source ~/dev/set_terraform_env
# autojump config
[ -f /usr/local/share/autojump/autojump.fish ]; and . /usr/local/share/autojump/autojump.fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment