Guest User

Untitled

a guest
Jul 22nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.37 KB | None | 0 0
  1. umask 022
  2. zmodload zsh/complist
  3.  
  4. ZLS_COLORS=$LS_COLORS
  5.  
  6. HISTSIZE=1000
  7. SAVEHIST=1000
  8. HISTFILE=~/.history
  9. TMOUT=6500
  10. #regular prompt
  11. PS1='%B%m%b%# '
  12.  
  13. #options
  14. #standard options:
  15. setopt \
  16. no_beep \
  17. auto_cd \
  18. complete_in_word \
  19. hash_cmds \
  20. list_types \
  21. auto_remove_slash \
  22. NO_menu_complete \
  23. NO_auto_menu \
  24. NO_hup \
  25. NO_list_beep \
  26. interactive_comments \
  27. inc_append_history \
  28. auto_list \
  29. chase_dots \
  30. extendedglob
  31.  
  32. #aliases
  33. alias s='sudo -s'
  34. alias ss='./script/server --debugger'
  35. alias v='vim .'
  36. alias ls='ls -G'
  37. alias l='ls -G'
  38. alias ll='l -al'
  39. alias la='l -a'
  40. alias lp='l -la | less'
  41. alias md=mkdir
  42.  
  43. # format titles for screen and rxvt
  44. function title() {
  45. # escape '%' chars in $1, make nonprintables visible
  46. a=${(V)1//\%/\%\%}
  47.  
  48. # Truncate command, and join lines.
  49. a=$(print -Pn "%40>...>$a" | tr -d "\n")
  50.  
  51. case $TERM in
  52. screen)
  53. print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
  54. ;;
  55. xterm*|rxvt)
  56. print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title
  57. ;;
  58. esac
  59. }
  60.  
  61. # precmd is called just before the prompt is printed
  62. function precmd() {
  63. title "zsh" "$USER@%m" "%55<...<%~"
  64. }
  65.  
  66. # preexec is called just before any command line is executed
  67. function preexec() {
  68. title "$1" "$USER@%m" "%35<...<%~"
  69. }
  70.  
  71.  
  72. #don't keep core dumps
  73.  
  74. ulimit -c 0
  75.  
  76. #get completions
  77.  
  78. if [ -s ".compctl" ];
  79. then source .compctl
  80. fi
  81.  
  82. bindkey ${$(echotc bt 2>&-):-"^[[Z"} menu-select
  83. bindkey ${$(echotc bt 2>&-):-""} menu-select
  84.  
  85. source ~/.prompt
  86.  
  87. typeset PATH=~/bin:$PATH
  88. export PATH=/usr/local/mysql-5.1.37-osx10.5-x86_64/bin/:$PATH
  89.  
  90. #expirmental stuff
  91. autoload -U compinit
  92. compinit -C
  93. ## completions ####
  94. ## General completion technique
  95. ## complete as much u can ..
  96. #zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix
  97. ## complete less
  98. #zstyle ':completion:*' completer _expand _complete _list _ignored _approximate
  99. ## complete minimal
  100. #zstyle ':completion:*' completer _complete _ignored
  101.  
  102. zstyle ':completion:*' completer _complete _ignored _approximate
  103.  
  104. ## allow one error
  105. #zstyle ':completion:*:approximate:*' max-errors 1 numeric
  106. ## allow one error for every three characters typed in approximate completer
  107. zstyle -e ':completion:*:approximate:*' max-errors \
  108. 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
  109.  
  110. ## formatting and messages
  111. zstyle ':completion:*' verbose yes
  112. zstyle ':completion:*:descriptions' format $'%{\e[1;30m%}%d%{\e[0m%}'
  113. zstyle ':completion:*:messages' format $'%{\e[1;30m%}%d%{\e[0m%}'
  114. zstyle ':completion:*:warnings' format $'%{\e[0;37m%}no matches for %{\e[1;30m%}[%{\e[0;37m%}%d%{\e[1;30m%}]%{\e[0m%}'
  115. zstyle ':completion:*:corrections' format $'%{\e[1;30m%}%d (errors: %e)%{\e[0m%}'
  116. zstyle ':completion:*' group-name ''
  117.  
  118. ## determine in which order the names (files) should be
  119. ## listed and completed when using menu completion.
  120. ## `size' to sort them by the size of the file
  121. ## `links' to sort them by the number of links to the file
  122. ## `modification' or `time' or `date' to sort them by the last modification time
  123. ## `access' to sort them by the last access time
  124. ## `inode' or `change' to sort them by the last inode change time
  125. ## `reverse' to sort in decreasing order
  126. ## If the style is set to any other value, or is unset, files will be
  127. ## sorted alphabetically by name.
  128. zstyle ':completion:*' file-sort name
  129.  
  130. ## how many completions switch on menu selection
  131. ## use 'long' to start menu compl. if list is bigger than screen
  132. ## or some number to start menu compl. if list has that number
  133. ## of completions (or more).
  134. zstyle ':completion:*' menu select=long
  135.  
  136. ## case-insensitive (uppercase from lowercase) completion
  137. #zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  138. ## case-insensitive (all) completion
  139. #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
  140. ## case-insensitive,partial-word and then substring completion
  141. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  142.  
  143. ## offer indexes before parameters in subscripts
  144. zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
  145.  
  146. ## insert all expansions for expand completer
  147. zstyle ':completion:*:expand:*' tag-order all-expansions
  148.  
  149. ## ignore completion functions (until the _ignored completer)
  150. zstyle ':completion:*:functions' ignored-patterns '_*'
  151.  
  152. ## completion caching
  153. zstyle ':completion::complete:*' use-cache 1
  154. zstyle ':completion::complete:*' cache-path ~/.zcompcache/$HOST
  155.  
  156. ## add colors to completions
  157. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  158.  
  159. ## don't complete backup files as executables
  160. zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
  161.  
  162. ## filename suffixes to ignore during completion (except after rm command)
  163. zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \
  164. '*?.(o|c~|old|pro|zwc)' '*~'
  165.  
  166. ## completions for some progs. not in default completion system
  167.  
  168. zstyle ':completion:*:*:mpg123:*' file-patterns \
  169. '*.(mp3|MP3):mp3\ files *(-/):directories'
  170. #zstyle ':completion:*:*:ogg123:*' file-patterns \
  171. #'*.(ogg|OGG):ogg\ files *(-/):directories'
  172.  
  173.  
  174.  
  175. ## generic completions for programs which understand GNU long options(--help)
  176.  
  177. compdef _gnu_generic slrnpull make df du
  178.  
  179. ## on processes completion complete all user processes
  180. zstyle ':completion:*:processes' command 'ps -au$USER'
  181.  
  182. ## add colors to processes for kill completion
  183. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  184.  
  185. zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
  186. zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
  187.  
  188. #cdpath=(~ .. /www/ats)
  189.  
  190. alias -g ...='../..'
  191. alias -g ....='../../..'
  192. alias -g .....='../../../..'
  193.  
  194. alias -g W=' | wc -l '
  195. alias -g C=' | cut '
  196. alias -g S=' | sort '
  197. alias -g SN=' | sort -n '
  198. alias -g U=' | uniq '
  199. alias -g UC=' | uniq -c '
  200. alias -g V=' | vim -'
  201. alias -g G=' | grep '
  202. alias -g GL=' | grep -l '
  203. alias -g GI=' | grep -i '
  204. alias -g GIL=' | grep -il '
  205. alias -g GR=' | grep -r '
  206. alias -g GRL=' | grep -rl '
  207. alias -g GIR=' | grep -ir '
  208. alias -g GIRL=' | grep -irl '
  209.  
  210. cgrep()
  211. {
  212. output=`command grep --color=always "$@" | sed 's/^\([^:]*\)/\\\033[92m\1\\\033[0m/g'`
  213. echo -e "$output"
  214. }
  215.  
  216. bak()
  217. {
  218. TIMESTAMP=`date +%Y%m%d%H%M%S`
  219. cp "$1" "$1.$TIMESTAMP"
  220. }
  221.  
  222. if [[ `whoami` = root ]]; then
  223. PS1="# "
  224. else
  225. PS1="$ "
  226. fi
Add Comment
Please, Sign In to add comment