Advertisement
martadinata

zshrc

Aug 23rd, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. # Lines configured by zsh-newuser-install
  2. HISTFILE=~/.histfile
  3. HISTSIZE=1000
  4. SAVEHIST=1000
  5. source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  6. setopt appendhistory autocd nomatch notify
  7. unsetopt beep extendedglob
  8. bindkey "\e[5~" beginning-of-history # PageUp
  9. bindkey "\e[6~" end-of-history # PageDown
  10. bindkey "\e[2~" quoted-insert # Ins
  11. bindkey "\e[3~" delete-char # Del
  12. bindkey "\e[5C" forward-word
  13. bindkey "\eOc" emacs-forward-word
  14. bindkey "\e[5D" backward-word
  15. bindkey "\eOd" emacs-backward-word
  16. bindkey "\e\e[C" forward-word
  17. bindkey "\e\e[D" backward-word
  18. bindkey "\e[Z" reverse-menu-complete # Shift+Tab
  19. bindkey "\eOH" beginning-of-line
  20. bindkey "\eOF" end-of-line
  21.  
  22. #HOSTNAME = Archlinux666
  23. # End of lines configured by zsh-newuser-install
  24. # The following lines were added by compinstall
  25. zstyle :compinstall filename '/home/dedy/.zshrc'
  26.  
  27.  
  28.  
  29. PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/ccache/bin/:/usr/lib/colorgcc/bin"
  30. export PATh
  31. autoload -Uz compinit
  32. compinit
  33. autoload -U promptinit
  34. promptinit
  35. autoload -U colors && colors
  36.  
  37. PROMPT="%{$fg[yellow]%}%B%n%b %B%{$fg[white]%}%#%b %{$fg[yellow]%}%B%U%~%u%b%{$fg[red]%}%B > %b"
  38. #PROMPT="%{$fg[black]%}%B%n%b %B%{$fg[black]%}%#%b %{$fg[black]%}%B%U%~%u%b%{$fg[black]%}%B > %b"
  39. #------------------------------------------////
  40. # Proxy:
  41. #------------------------------------------////
  42. #http_proxy=http://127.0.0.1:8118/
  43. #HTTP_PROXY=$http_proxy
  44. #export http_proxy HTTP_PROXY
  45.  
  46. #------------------------------------------////
  47. # Aliases:
  48. #------------------------------------------////
  49. ## make ls list by size
  50. ##alias ls='du -s */* | sort -n'
  51. alias findbig='find . -type f -exec ls -s {} \; | sort -n -r | head -5'
  52. alias ls='ls -aF --color=always'
  53. alias la='ls -Al'
  54. alias lx='ls -lXB'
  55. alias lk='ls -lSr'
  56. alias lc='ls -lcr'
  57. alias lu='ls -lur'
  58. alias lr='ls -lR'
  59. alias lt='ls -ltr'
  60. alias lm='ls -al |more'
  61. alias sch='cat /sys/block/sda/queue/scheduler'
  62. #alias rm='rm -i'
  63. #------------------------------------------////
  64. # Functions and Scripts:
  65. #------------------------------------------////
  66. localnet ()
  67. {
  68. /sbin/ifconfig | awk /'inet addr/ {print $2}'
  69. echo ""
  70. /sbin/ifconfig | awk /'Bcast/ {print $3}'
  71. echo ""
  72. }
  73.  
  74. upinfo ()
  75. {
  76. echo -ne "$fg[white]uptime is $fg[yellow] \t\t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
  77. }
  78. cd()
  79. {
  80. if [ -n "$1" ]; then
  81. builtin cd "$@" && ls
  82. else
  83. builtin cd ~ && ls
  84. fi
  85. }
  86.  
  87. extract()
  88. {
  89. if [ -f "$1" ] ; then
  90. case "$1" in
  91. *.tar.bz2) tar xjf "$1" ;;
  92. *.tar.gz) tar xzf "$1" ;;
  93. *.tar.Z) tar xzf "$1" ;;
  94. *.bz2) bunzip2 "$1" ;;
  95. *.rar) unrar x "$1" ;;
  96. *.gz) gunzip "$1" ;;
  97. *.jar) unzip "$1" ;;
  98. *.tar) tar xf "$1" ;;
  99. *.tbz2) tar xjf "$1" ;;
  100. *.tgz) tar xzf "$1" ;;
  101. *.zip) unzip "$1" ;;
  102. *.Z) uncompress "$1" ;;
  103. *) echo "'$1' cannot be extracted." ;;
  104. esac
  105. else
  106. echo "'$1' is not a file."
  107. fi
  108. }
  109.  
  110. setopt AUTO_LIST
  111. setopt AUTO_MENU
  112. setopt MENU_COMPLETE
  113. export LC_ALL=id_ID.UTF-8
  114. export LANG=id_ID.UTF-8
  115. autoload -U compinit
  116. compinit
  117.  
  118. # Completion caching
  119. zstyle ':completion::complete:*' use-cache on
  120. zstyle ':completion::complete:*' cache-path .zcache
  121. zstyle ':completion:*:cd:*' ignore-parents parent pwd
  122.  
  123. #Completion Options
  124. zstyle ':completion:*:match:*' original only
  125. zstyle ':completion::prefix-1:*' completer _complete
  126. zstyle ':completion:predict:*' completer _complete
  127. zstyle ':completion:incremental:*' completer _complete _correct
  128. zstyle ':completion:*' completer _complete _prefix _correct _prefix _match _approximate
  129.  
  130. # Path Expansion
  131. zstyle ':completion:*' expand 'yes'
  132. zstyle ':completion:*' squeeze-shlashes 'yes'
  133. zstyle ':completion::complete:*' '\\'
  134.  
  135. zstyle ':completion:*:*:*:default' menu yes select
  136. zstyle ':completion:*:*:default' force-list always
  137.  
  138. # GNU Colors 需要/etc/DIR_COLORS文件 否则自动补全时候选菜单中的选项不能彩色显示
  139. [ -f /etc/DIR_COLORS ] && eval $(dircolors -b /etc/DIR_COLORS)
  140. export ZLSCOLORS="${LS_COLORS}"
  141. zmodload zsh/complist
  142. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  143. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  144.  
  145. zstyle ':completion:*' completer _complete _match _approximate
  146. zstyle ':completion:*:match:*' original only
  147. zstyle ':completion:*:approximate:*' max-errors 1 numeric
  148.  
  149. compdef pkill=kill
  150. compdef pkill=killall
  151. zstyle ':completion:*:*:kill:*' menu yes select
  152. zstyle ':completion:*:processes' command 'ps -au$USER'
  153.  
  154. # Group matches and Describe
  155. zstyle ':completion:*:matches' group 'yes'
  156. zstyle ':completion:*:options' description 'yes'
  157. zstyle ':completion:*:options' auto-description '%d'
  158. zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m'
  159. zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m'
  160. zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m'
  161.  
  162.  
  163. #print -Pc '%B`figlet "ArchLinux"%b`'
  164. #echo -e "$bold_color $fg[yellow]";figlet "ArchLinux";
  165. #echo -n "$fg[white]Today is:\t\t$fg[yellow]" `date`; echo ""
  166. #echo -e "$fg[white]Kernel Information: \t$fg[yellow]" `uname -smr`
  167. #echo -ne "$fg[white]";upinfo;echo " "
  168. #echo -e "$fg[white]"; cal -3
  169. # End of lines added by compinstall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement