Kamiel

~/.zshrc for OS X

Feb 28th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 13.46 KB | None | 0 0
  1. # ~/.zshrc
  2. # -*-mode: emacs-lisp; coding: utf-8 -*-
  3.  
  4. # Lines configured by zsh-newuser-install
  5. HISTFILE=~/.histfile
  6. HISTSIZE=10000
  7. SAVEHIST=8000
  8. bindkey -e
  9. # End of lines configured by zsh-newuser-install
  10. # The following lines were added by compinstall
  11. zstyle :compinstall filename "$HOME/.zshrc"
  12.  
  13. autoload -Uz compinit promptinit colors zcalc tetris zed vcs_info
  14. colors
  15. compinit
  16. promptinit;
  17. #SPROMPT=$'%{\e[91m%п·я┬п╦п╠п╨п╟! п▓я▀ я┘п╬я┌п╣п╩п╦ п╡п╡п╣я│я┌п╦ %r п╡п╪п╣я│я┌п╬ %R? ([Y]es/[N]o/[E]dit/[A]bort)%{\e[0m%}'
  18. # End of lines added by compinstall
  19.  
  20. autoload -U zutil
  21. autoload -U complist
  22.  
  23. # next lets set some enviromental/shell pref stuff up
  24. # setopt NOHUP
  25. #setopt NOTIFY
  26. #setopt NO_FLOW_CONTROL
  27. setopt NO_EQUALS
  28. setopt INC_APPEND_HISTORY SHARE_HISTORY
  29. setopt APPEND_HISTORY
  30. # setopt AUTO_LIST# these two should be turned off
  31. # setopt AUTO_REMOVE_SLASH
  32. # setopt AUTO_RESUME# tries to resume command of same name
  33. unsetopt BG_NICE        # do NOT nice bg commands
  34. setopt CORRECT          # command CORRECTION
  35. setopt EXTENDED_HISTORY # puts timestamps in the history
  36. # setopt HASH_CMDS# turns on hashing
  37. #
  38. setopt MENUCOMPLETE
  39. setopt ALL_EXPORT
  40. # Set/unset  shell options
  41. setopt   notify globdots correct pushdtohome cdablevars autolist
  42. setopt   autocd recexact longlistjobs
  43. setopt   autoresume histignoredups pushdsilent
  44. setopt   autopushd pushdminus extendedglob rcquotes mailwarning
  45. unsetopt bgnice autoparamslash
  46. # turn off correction for proper commands
  47. unsetopt correctall
  48.  
  49. # Autoload zsh modules when they are referenced
  50. zmodload -a zsh/stat stat
  51. zmodload -a zsh/zpty zpty
  52. zmodload -a zsh/zprof zprof
  53. ######## zmodload -ap zsh/mapfile mapfile
  54.  
  55. export LANG="en_US.UTF-8"
  56.  
  57. # GNU utils path
  58. export PATH=/opt/local/libexec/gnubin/:$PATH
  59.  
  60. # MacPorts Installer addition on 2012-01-10_at_01:09:31: adding an appropriate PATH variable for use with MacPorts.
  61. export PATH=/opt/local/bin:/opt/local/sbin:$PATH
  62. export MANPATH=/opt/local/share/man:$MANPATH
  63. # Finished adapting your PATH environment variable for use with MacPorts.
  64.  
  65. #####
  66.  
  67. # bindkey '\e[A' history-search-backward
  68. # bindkey '\e[B' history-search-forward
  69.  
  70. bindkey "^[[A" history-search-backward
  71. bindkey "^[[B" history-search-forward
  72.  
  73. # bindkey '^R' history-search-backward
  74. # bindkey '^S' history-search-forward
  75.  
  76. bindkey '^R' history-incremental-search-backward
  77. bindkey '^S' history-incremental-search-forward
  78.  
  79. # bindkey -M isearch '^R' history-incremental-search-backward
  80. # bindkey -M isearch '^S' history-incremental-search-forward
  81.  
  82. bindkey '^K' kill-whole-line
  83. bindkey "\e[7~" beginning-of-line
  84. bindkey "\e[8~" end-of-line
  85. bindkey "\e[H" beginning-of-line # Home (xorg)
  86. bindkey "\e[1~" beginning-of-line # Home (console)
  87. bindkey "\e[4~" end-of-line # End (console)
  88. bindkey "\e[F" end-of-line # End (xorg)
  89. bindkey "`echotc kP`" history-beginning-search-backward # Page Up
  90. bindkey "`echotc kN`" history-beginning-search-forward # Page Down
  91.  
  92. bindkey "\e[2~" overwrite-mode # Ins
  93. bindkey "\e[3~" delete-char # Delete
  94. bindkey '\eOH' beginning-of-line
  95. bindkey '\eOF' end-of-line
  96. bindkey ';5D' backward-word # Ctrl+left
  97. bindkey ';5C' forward-word # Ctrl+right
  98. bindkey "`echotc ku`" up-line-or-history # up
  99. bindkey "`echotc kd`" down-line-or-history # down
  100. bindkey "`echotc kr`" forward-char # Right
  101. bindkey "`echotc kl`" backward-char # Left
  102. bindkey '[D' backward-word # Alt+left
  103. bindkey '[C' forward-word # Alt+right
  104. bindkey '[3~' delete-word # Alt+Del  почему-то это блокирует простой Del
  105.  
  106. # Resource files
  107. #for file in $HOME/.zsh/rc/*.rc; do
  108. #        source $file
  109. #done
  110.  
  111. #alias emacs='/usr/bin/emacsclient -t -a ""'
  112. alias gs='git status'
  113. alias gf='git fetch'
  114. alias ga='git add'
  115. alias gc='git commit -m'
  116. alias gp='git pull --rebase && git push'
  117. alias gull='git pull --rebase'
  118. alias gush='git push'
  119. alias gb='git-branch'
  120. alias gco='git checkout'
  121. alias gd='git diff'
  122. alias gu='git ls-files --other --exclude-standard'
  123. alias gt='git log --graph --oneline --all'
  124. alias gentoo='/funtoo/startprefix'
  125. alias funtoo='/funtoo/startprefix'
  126. # alias emacsclient='/usr/local/bin/emacsclient'
  127. alias ec='emacsclient'
  128. alias et='emacsclient -nw'
  129. alias grep='egrep -s --colour=auto'
  130. alias mktags='find . -type f \( -iname "*.h" -o -iname "*.m" -o -iname "*.hh" -o -iname "*.mm" -o -iname "*.c" -o -iname "*.cc" -o -iname "*.pch" -o -iname "*.cpp" -o -iname "*.c++" \) -print0 | xargs -0 etags -f objc.TAGS -l objc'
  131.  
  132. alias 't'='tree -L 1'
  133. # t () {
  134. #     if (( $# == 1 )); then
  135. #         tree -a -L "$1"
  136. #     elif (( $# == 0 )); then
  137. #         tree -a -L 1
  138. #     fi
  139. # }
  140.  
  141. # alias ls='ls -F -h'                                                                                                                                                                                              
  142. if ls --color=auto  > /dev/null 2>/dev/null ;
  143. then ;
  144. alias ls='ls --color=auto -F -h' ;
  145. else ;
  146. alias ls='ls -F -h' ;
  147. fi
  148. alias ll='ls -l'
  149. alias nano='nano -w'
  150. alias cp='cp -viR'
  151. alias mv='mv -vi'
  152. alias rm='rm -viR'
  153. alias md='mkdir -p -v'
  154. alias jackD='set_rlimits jackd -Rv -p512 -d alsa -dhw:1 -r96000 -p4096 -n2 -Xseq'
  155. alias df='df -h'
  156. alias du='du -h'
  157. alias burndvd='growisofs -Z /dev/dvdrw -R -J'
  158. alias burndvdISO='growisofs -dvd-compat -Z /dev/dvdrw='
  159. alias burncd='mkisofs -r -f -jcharset=cp1251 -C $(cdrecord dev=/dev/cdrw -msinfo) -M /dev/cdrw $HOME/forburn/ | cdrecord --speed=4 -v -multi driveropts=burnfree -eject dev=/dev/cdrw -'
  160. alias burncdISO='cdrecord --speed=4 -v -multi driveropts=burnfree -eject dev=/dev/cdrw'
  161. alias blankcd='cdrecord --dev=/dev/cdrw --blank=fast'
  162. alias bl='baudline_jack -waveform -realtime -record -jack -inconnect'
  163. alias wget='wget --no-check-certificate'
  164. alias wgetp='wgetpaste -rXvt'
  165. alias hackport='hackport -p /usr/local/overlays/hackage'
  166. #alias man="LC_ALL="ru_RU.UTF-8" man"
  167. alias zip="zip -r"
  168. #alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw --eval \"(require 'cl)\""
  169. alias emacsw='/Applications/Emacs.app/Contents/MacOS/Emacs -Q'
  170. alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs -nw -Q'
  171. #alias emacsc='/usr/bin/emacsclient -c -a --'
  172. #alias emacst='/usr/bin/emacsclient -nw -a --'
  173.  
  174. # EDITOR
  175. export EDITOR='/Applications/Emacs.app/Contents/MacOS/Emacs -nw -Q'
  176. export MP_EDITOR='/Applications/Emacs.app/Contents/MacOS/Emacs -nw -Q'
  177.  
  178.  
  179. setopt prompt_subst
  180. # Configuring vcs_info
  181. zstyle ':vcs_info:*' stagedstr "%{$fg_bold[green]%}~"
  182. zstyle ':vcs_info:*' unstagedstr "%{$fg_bold[yellow]%}+"
  183. zstyle ':vcs_info:git:*' check-for-changes true
  184. zstyle ':vcs_info:*' branchformat '%b-%r'
  185. zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
  186. # hash changes branch misc
  187. # Git
  188.  
  189. # zstyle ':vcs_info:git*' formats "[%{$fg[yellow]%}%12.12i%{$reset_color%} %u %{$fg[magenta]%}%b%{$reset_color%}%m] "
  190. # zstyle ':vcs_info:git*' formats '[%F{green}%b%c%u%F{red}●%F{blue}] '
  191. zstyle ':vcs_info:git*' actionformats "(%a)[%{$fg[yellow]%}%12.12i%{$reset_color%} %u %{$fg[magenta]%}%b%{$reset_color%}%m]"
  192. #  zstyle ':vcs_info:git*' formats "%s  %r/%S %b %m%u%c "#  zstyle ':vcs_info:git*' formats "(%s)[%12.12i %u %b %m]"
  193. #  zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%s %{$reset_color%}%r/%S%{$fg[grey]%} %{$fg[blue]%}%b%{$reset_color%}%m%u%c%{$reset_color%} "
  194. #  zstyle ':vcs_info:git*' actionformats "(%s|%a)[%12.12i %u %b %m]"
  195. # Mercurial
  196. # zstyle ':vcs_info:hg*' formats "(%s)[%i%u %b %m]"
  197. zstyle ':vcs_info:hg*' actionformats "(%s|%a)[%i%u %b %m]"
  198. zstyle ':vcs_info:(hg*|git*):*' get-revision true
  199. zstyle ':vcs_info:(hg*|git*):*' check-for-changes true
  200. zstyle ':vcs_info:hg*:*' get-bookmarks true
  201. zstyle ':vcs_info:hg*:*' get-mq true
  202. zstyle ':vcs_info:hg*:*' get-unapplied true
  203. zstyle ':vcs_info:hg*:*' patch-format "mq(%g):%n/%c %p"
  204. zstyle ':vcs_info:hg*:*' nopatch-format "mq(%g):%n/%c %p"
  205. zstyle ':vcs_info:hg*:*' unstagedstr "+"
  206. zstyle ':vcs_info:hg*:*' hgrevformat "%r" # only show local rev.
  207. zstyle ':vcs_info:hg*:*' branchformat "%b" # only show branch
  208.  
  209.  
  210. # use version control info - for prompt
  211. zstyle ':vcs_info:*' enable git svn cvs hg bzr darcs
  212.  
  213. vcs_info_wrapper() {
  214. #     if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
  215. #             zstyle ':vcs_info:git*' formats '[%F{green}%b%c%u%F{blue}] '
  216.     # } else {
  217. zstyle ':vcs_info:*' formats "%{$fg_bold[grey]%}[%{$reset_color%}%{$fg[green]%}%b%c%u%{$fg_bold[red]%}!%{$fg_bold[grey]%}]"
  218. #}
  219. vcs_info
  220. if [ -n "$vcs_info_msg_0_" ]; then
  221. echo "%{$fg_bold[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
  222. fi
  223. }
  224. ## or use pre_cmd, see man zshcontrib
  225. # precmd() {
  226. #     vcs_info
  227. # }
  228. # precmd () {
  229. #     if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
  230. #             zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{blue}]'
  231. # } else {
  232. #             zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{red}•%F{blue}]'
  233. # }
  234. # vcs_info
  235. # }
  236.  
  237.  
  238. # Prompt
  239. if [[ $EUID == 0 ]]
  240. then
  241. PROMPT='$(vcs_info_wrapper)%{$fg_bold[grey]$bg[white]%} %T %D{%a} %D{%Y-%m-%d} %{$fg_bold[black]$bg[red]%} %~ %{$fg_bold[white]%}]%{$reset_color%} '  # root dir #
  242. else
  243. PROMPT='$(vcs_info_wrapper)%{$fg_bold[grey]$bg[white]%} %T %D{%a} %D{%Y-%m-%d} %{$fg_bold[black]$bg[green]%} %~ %{$fg_bold[white]%}>%{$reset_color%} '  # user dir #
  244. fi
  245. # RPROMPT=$'$(git_super_status)%{\e[1;30m%}%T\ %D{%a}\ %D{%Y-%m-%d}\ %n@%m%{\e[0m%}' # right prompt with time #
  246.  
  247.  
  248. # Set xterm title
  249. case $TERM in (xterm*|rxvt)
  250. precmd () { print -Pn "\e]0;%n@%m: %~\a" }
  251. preexec () { print -Pn "\e]0;%n@%m: $1\a" }
  252. ;;
  253. esac
  254.  
  255. # Grep colors
  256. GREP_OPTIONS='--color=auto'
  257. #GREP_COLOR='5;38' #п╪п╦пЁп╟я▌я┴п╦п╧
  258. GREP_COLOR='1;33' #я▐я─п╨п╬-п╤п╣п╩я┌я▀п╧ п╫п╟ я┤п╣я─п╫п╬п╪
  259. export GREP_OPTIONS GREP_COLOR
  260.  
  261. # dircolors
  262. eval `dircolors ~/.dircolors`
  263. zstyle ':completion:*:default' list-colors "${(s.:.)LS_COLORS}"
  264.  
  265. #Errors red
  266. #exec 2>>(while read line; do
  267. #          print '\e[91m'${(q)line}'\e[0m' > /dev/tty; print -n $'\0'; done &)
  268.  
  269. #set -B
  270.  
  271. # allow emacs to track your current directory as you cd around
  272. if [ -n "$INSIDE_EMACS" ]; then
  273. chpwd() { print -P "\033AnSiTc %d" }
  274. print -P "\033AnSiTu %n"
  275. print -P "\033AnSiTc %d"
  276. fi
  277.  
  278.  
  279. # EMACS compatibility
  280. if [ "$EMACS" ]; then
  281. unsetopt zle
  282. export TERM=xterm-color
  283. fi
  284.  
  285.  
  286. zstyle ':completion::complete:*' use-cache on
  287. zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
  288.  
  289. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  290. zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
  291. zstyle ':completion:*' menu select=1 _complete _ignored _approximate
  292. zstyle -e ':completion:*:approximate:*' max-errors \
  293. 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
  294. zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
  295.  
  296. # Completion Styles
  297.  
  298. # list of completers to use
  299. # zstyle
  300.  
  301.  
  302. ## add colors to processes for kill completion
  303. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  304.  
  305. #zstyle ':completion:*:processes' command 'ps ax -o pid,s,nice,stime,args | sed "/ps/d"'
  306. zstyle ':completion:*:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
  307. zstyle ':completion:*:processes-names' command 'ps axho command'
  308. #zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
  309. #
  310. #NEW completion:
  311.  
  312. # 1. All /etc/hosts hostnames are in autocomplete
  313. # 2. If you have a comment in /etc/hosts like #%foobar.domain,
  314. #    then foobar.domain will show up in autocomplete!
  315. zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}')
  316. # Filename suffixes to ignore during completion (except after rm command)
  317. # zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
  318. #     '*?.old' '*?.pro'
  319. # the same for old style completion
  320. #fignore=(.o .c~ .old .pro)
  321.  
  322. # ignore completion functions (until the _ignored completer)
  323. # zstyle ':completion:*:functions' ignored-patterns '_*'
  324. # zstyle ':completion:*:*:*:users' ignored-patterns \
  325. #         adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
  326. #         named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
  327. #         rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs avahi-autoipd\
  328. #         avahi backup messagebus beagleindex debian-tor dhcp dnsmasq fetchmail\
  329. #         firebird gnats haldaemon hplip irc klog list man cupsys postfix\
  330. #         proxy syslog www-data mldonkey sys snort
  331. # SSH Completion
  332. zstyle ':completion:*:scp:*' tag-order \
  333.    files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
  334. zstyle ':completion:*:scp:*' group-order \
  335.    files all-files users hosts-domain hosts-host hosts-ipaddr
  336. zstyle ':completion:*:ssh:*' tag-order \
  337.    users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
  338. zstyle ':completion:*:ssh:*' group-order \
  339.    hosts-domain hosts-host users hosts-ipaddr
  340. zstyle '*' single-ignored show
  341.  
  342.  
  343. # # custom terminfo
  344. # LOCAL_TERMINFO=$HOME/.terminfo
  345. # if [ -d $LOCAL_TERMINFO ]; then
  346. #     export TERMINFO=$LOCAL_TERMINFO
  347. # fi
  348.  
  349.  
  350. # RVM
  351. PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
  352.  
  353. # PostgreSQL
  354. export PATH=/opt/local/lib/postgresql93/bin:$PATH
  355.  
  356. # Bundled Emacs version
  357. export EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
  358.  
  359.  
  360. # CocoaPods
  361. export GEM_HOME=$HOME/gems
  362. export PATH=$GEM_HOME/bin:$PATH
  363.  
  364.  
  365. # Load RVM into a shell session *as a function*
  366. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Advertisement
Add Comment
Please, Sign In to add comment