Skip to content

Instantly share code, notes, and snippets.

@jsjohnst
Created February 22, 2009 12:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsjohnst/68455 to your computer and use it in GitHub Desktop.
Save jsjohnst/68455 to your computer and use it in GitHub Desktop.
Bash profile options for color and vi mode
# useful general .bash_profile tweaks for color loving VI fans
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;36'
export CLICOLOR=1
alias ls='ls -G'
export LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rb=90'
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
export COLOR_LIGHT_RED='\e[1;31m'
export COLOR_PURPLE='\e[0;35m'
export COLOR_LIGHT_PURPLE='\e[1;35m'
export COLOR_BROWN='\e[0;33m'
export COLOR_YELLOW='\e[1;33m'
export COLOR_GRAY='\e[1;30m'
export COLOR_LIGHT_GRAY='\e[0;37m'
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
# Also an example of using colors by name
export PS1="\[${COLOR_LIGHT_CYAN}\]\w \[${COLOR_NC}\]$ "
export HISTCONTROL=ignoredups
shopt -s checkwinsize
bind "set show-all-if-ambiguous On"
## Bringing VI to bash prompts
set -o vi
# Goto begin of line
bind -m vi-insert C-a:vi-insert-beg
bind -m vi-command C-a:vi-insert-beg
# Goto end of line
bind -m vi-command C-e:vi-append-eol
bind -m vi-insert C-e:vi-append-eol
# clear screen
bind -m vi-command C-l:clear-screen
bind -m vi-insert C-l:clear-screen
# insert last argument
bind -m vi-insert C-k:insert-last-argument
bind -m vi-command C-k:insert-last-argument
# Used by macros
bind -m vi-insert C-K:kill-whole-line
# C-i is used in other macros.
bind -m vi-command C-i:vi-insertion-mode
bind -m vi-command -r 'v'
# bind "tr" to reverse-search-history
bind -m vi-command '"\x74\x72"':"\"\C-i\C-r\""
# Binding shell ls command to a key tl
bind -m vi-command -x '"tl":ls'
# bind tt to !:* : All argument of last command
bind -m vi-command '"\x74\x74"':" \"\C-i \!:* \""
# Bind "tk" to save the current command to history without executing
bind -m vi-command '"\x74\x6b"':"\"\C-ahistory -s '\C-e'\C-m"
# th shows the last 8 commands.
bind -m vi-command -x '"th":"history 8"'
bind -m vi-command b:vi-prev-word
bind -m vi-command c:vi-change-to
bind -m vi-command /:vi-search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment