Advertisement
Guest User

phikus

a guest
Feb 1st, 2010
2,422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.32 KB | None | 0 0
  1. ##############################
  2. # My super awesome zshrc.    #
  3. ##############################
  4.  
  5. # Environment and shell options.
  6. #
  7.  
  8. setopt INC_APPEND_HISTORY SHARE_HISTORY HIST_IGNORE_DUPS HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_IGNORE_SPACE HIST_NO_STORE HIST_VERIFY
  9. setopt EXTENDED_HISTORY HIST_SAVE_NO_DUPS HIST_EXPIRE_DUPS_FIRST HIST_FIND_NO_DUPS APPEND_HISTORY
  10. setopt CORRECT MENUCOMPLETE ALL_EXPORT
  11. setopt   notify globdots correct pushdtohome cdablevars autolist
  12. setopt   correctall autocd recexact longlistjobs
  13. setopt   autoresume histignoredups pushdsilent
  14. setopt   autopushd pushdminus extendedglob rcquotes mailwarning
  15. unsetopt bgnice autoparamslash
  16.  
  17. # Modules
  18. #
  19. # Set hsitory stuff.
  20. #
  21. HISTFILE=$HOME/.zhistory
  22. HISTSIZE=10000
  23. SAVEHIST=10000
  24.  
  25. # Set up must-have aliases and alias file.
  26. #
  27. alias ls='ls --color=auto'
  28. alias ll='ls -lh'
  29. alias la='ls -a'
  30. alias l='ls'
  31. export GREP_OPTIONS='--color=auto'
  32. export GREP_COLOR='1;33'
  33.  
  34.  
  35. # Key-bindings.
  36. #
  37.  
  38. autoload -U compinit
  39. compinit
  40. bindkey '^[OH' beginning-of-line
  41. bindkey '^[OF' end-of-line
  42. bindkey '^I' complete-word # complete on tab, leave expansion to _expand
  43. bindkey "\e[5~"  history-search-backward
  44. bindkey "\e[6~"  history-search-forward
  45.  
  46.  
  47. # Auto-completion settings.
  48. #
  49.  
  50. zstyle ':completion::complete:*' use-cache on
  51. zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
  52. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  53. zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
  54. zstyle ':completion:*' menu select=1 _complete _ignored _approximate
  55. zstyle -e ':completion:*:approximate:*' max-errors \
  56.     'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
  57. zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
  58. zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
  59. zstyle -e ':completion:*:approximate:*' max-errors \
  60.     'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
  61. zstyle ':completion:*:expand:*' tag-order all-expansions
  62. zstyle ':completion:*' verbose yes
  63. zstyle ':completion:*:descriptions' format '%B%d%b'
  64. zstyle ':completion:*:messages' format '%d'
  65. zstyle ':completion:*:warnings' format 'No matches for: %d'
  66. zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
  67. zstyle ':completion:*' group-name ''
  68. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  69. zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
  70. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  71. zstyle ':completion:*:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
  72. zstyle ':completion:*:processes-names' command 'ps axho command'
  73.  
  74. [[ -f /usr/bin/grc ]] && {
  75.   alias ping="grc --colour=auto ping"
  76.   alias traceroute="grc --colour=auto traceroute"
  77.   alias make="grc --colour=auto make"
  78.   alias diff="grc --colour=auto diff"
  79.   alias cvs="grc --colour=auto cvs"
  80.   alias netstat="grc --colour=auto netstat"
  81. }
  82.  
  83. ###   Handy Extract Program
  84.  
  85. extract () {
  86.     if [ -f $1 ] ; then
  87.         case $1 in
  88.             *.tar.bz2)   tar xvjf $1        ;;
  89.             *.tar.gz)    tar xvzf $1     ;;
  90.             *.bz2)       bunzip2 $1       ;;
  91.             *.rar)       unrar x $1     ;;
  92.             *.gz)        gunzip $1     ;;
  93.             *.tar)       tar xvf $1        ;;
  94.             *.tbz2)      tar xvjf $1      ;;
  95.             *.tgz)       tar xvzf $1       ;;
  96.             *.zip)       unzip $1     ;;
  97.             *.Z)         uncompress $1  ;;
  98.             *.7z)        7z x $1    ;;
  99.             *)           echo "'$1' cannot be extracted via >extract<" ;;
  100.         esac
  101.     else
  102.         echo "'$1' is not a valid file"
  103.     fi
  104. }
  105.  
  106.  
  107.  
  108.  
  109. autoload -U colors
  110. #colors
  111.  
  112. # See if we can use colors.
  113. autoload colors zsh/terminfo
  114. if [[ "$terminfo[colors]" -ge 8 ]]; then
  115.    colors
  116. fi
  117.    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
  118.    eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
  119.    eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
  120.    (( count = $count + 1 ))
  121. done
  122.    PR_NO_COLOUR="%{$terminfo[sgr0]%}"
  123.  
  124. local blue_op=""$PR_BLUE"["$PR_NO_COLOUR""
  125. local blue_cp=""$PR_BLUE"]"$PR_NO_COLOUR""
  126. local path_p="${blue_op}$PR_MAGENTA%/$PR_NO_COLOUR${blue_cp}%b"
  127. local user_host="${blue_op}%B$PR_GREEN%n@%m$PR_NO_COLOUR${blue_cp}"
  128. PROMPT="${user_host}-${path_p}
  129. $PR_BLUE%#$PR_NO_COLOUR "
  130. RPROMPT="%B%*%b"
  131.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement