Skip to content

Instantly share code, notes, and snippets.

@rvanzee
Created April 10, 2012 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvanzee/2351611 to your computer and use it in GitHub Desktop.
Save rvanzee/2351611 to your computer and use it in GitHub Desktop.
Bash prompt customization
#show git branch name in prompt
PS1='\[\e[1;32m\]\u: $CurDir $(__git_ps1 " (%s)")\$\[\e[0m\] '
# make bash autocomplete with up arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# make tab cycle through commands instead of listing
bind '"\t":menu-complete'
bind "set completion-ignore-case on"
#git completion
source ~/scripts/git-completion.sh
# set keyword shortcuts for common commands
alias update="sudo aptitude update"
alias install="sudo aptitude install"
alias upgrade="sudo aptitude safe-upgrade"
alias remove="sudo aptitude remove"
@rvanzee
Copy link
Author

rvanzee commented Apr 10, 2012

  • Add the git branch name to the prompt (if you’re in a git repo)
  • Enable up and down arrows to search your bash history using whatever you’ve already entered as a search prefix
  • Enable tab key to cycle through available commands
  • Use the "alias" keyword to set a shortcut for another command.
  • Add tab-completion for git commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment