Skip to content

Instantly share code, notes, and snippets.

@hectorcanto
Created April 26, 2018 09:23
Show Gist options
  • Save hectorcanto/cfaf4aec7ffaaff3d0a90418100cab84 to your computer and use it in GitHub Desktop.
Save hectorcanto/cfaf4aec7ffaaff3d0a90418100cab84 to your computer and use it in GitHub Desktop.
Some hooks I have in my .bashrc
# Tab cycle but list option first
bind TAB:menu-complete
bind "set show-all-if-ambiguous on"
# git branch if in git
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[0;33m\]$(parse_git_branch)\[\033[0m\]\$ '
# LS aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
#activate virtualenv when in env_$folder_name
# .activate
result=${PWD##*/}
folder=env_$result
path=env_$result/bin/activate
if [ ! -d "$folder" ];
then echo "Virtualenv not present in the current folder '$PWD'."
else . $path
fi
if [ -e scripts/bootstrap.sh ];
then
echo "Loading environment variables for '$result'."
. scripts/bootstrap.sh
fi
#.bashrc
alias activate='. ~/.activate'
#Markdown in CLI
md() { pandoc "$1" | lynx -stdin; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment