Advertisement
Haron_Prime

.zshrc

Sep 3rd, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.76 KB | None | 0 0
  1. # The following lines were added by compinstall
  2. zstyle :compinstall filename '/home/haron/.zshrc'
  3. autoload -Uz compinit promptinit zfinit
  4. compinit
  5. promptinit
  6. zfinit
  7. # End of lines added by compinstall
  8. ZSH=/usr/share/oh-my-zsh/
  9. DISABLE_AUTO_UPDATE="true"
  10. ZSH_CACHE_DIR=$HOME/.oh-my-zsh-cache
  11. if [[ ! -d $ZSH_CACHE_DIR ]]; then
  12. mkdir $ZSH_CACHE_DIR
  13. fi
  14.  
  15.  
  16. # export TERM="xterm-256color"
  17. xhost + >/dev/null
  18. # export PATH=$PATH:/home/haron/bin
  19.  
  20. setopt appendhistory autocd extendedglob nomatch
  21. setopt IGNORE_EOF
  22. setopt CORRECT_ALL
  23. SPROMPT="Ошибка! ввести %r вместо %R? ([Y]es/[N]o/[E]dit/[A]bort) "
  24. bindkey -e
  25.  
  26. autoload colors; colors
  27. autoload -U url-quote-magic
  28. zle -N self-insert url-quote-magic
  29.  
  30. # prompt (if running screen, show window #)
  31. if [ x$WINDOW != x ]; then
  32.     export PS1="%{$fg[white]%}┌─[%{$fg[cyan]%}$WINDOW%{$fg[white]%}:%{$fg[green]%}%n%{$fg[cyan]%}@%{$fg[green]%}%m%{$fg[white]%}:%{$fg[yellow]%}%~%{$fg[white]%}]%{$fg[yellow]%}-%{$fg[red]%}[%{$fg[cyan]%}%*%{$fg[red]%}]%{$reset_color%}%{$reset_color%}"$'\n'"%{$fg[white]%}└─>%{$reset_color%} "
  33. else
  34.     export PS1="%{$fg[white]%}┌─[%{$fg[green]%}%n%{$fg[cyan]%}@%{$fg[green]%}%m%{$fg[white]%}:%{$fg[yellow]%}%~%{$fg[white]%}]%{$fg[yellow]%}-%{$fg[red]%}[%{$fg[cyan]%}%*%{$fg[red]%}]%{$reset_color%}%{$reset_color%}"$'\n'"%{$fg[white]%}└─>%{$reset_color%} "
  35. fi
  36. export RPROMPT="%{$reset_color%}"
  37. # format titles for screen and rxvt
  38. function title() {
  39.   # escape '%' chars in $1, make nonprintables visible
  40.   a=${(V)1//\%/\%\%}
  41.  
  42.   # Truncate command, and join lines.
  43.   a=$(print -Pn "%40>...>$a" | tr -d "\n")
  44.  
  45.   case $TERM in
  46.   screen*)
  47.     print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
  48.     ;;
  49.   xterm*|rxvt*)
  50.     precmd() { print -Pn "\e]0;%m:%~\a" }
  51.     preexec () { print -Pn "\e]0;$1\a" }
  52.     ;;
  53.   esac
  54. }
  55.  
  56. # precmd is called just before the prompt is printed
  57. function precmd() {
  58.   title "zsh" "$USER@%m" "%55<...<%~"
  59. }
  60.  
  61. # preexec is called just before any command line is executed
  62. function preexec() {
  63.   title "$1" "$USER@%m" "%35<...<%~"
  64. }
  65.  
  66. # If not running interactively, do not do anything
  67. # [[ $- != *i* ]] && return
  68. # [[ -z "$TMUX" ]] && exec mux default
  69.  
  70. setopt menucomplete
  71. zstyle ':completion:*' use-compctl false
  72. zstyle ':completion:*' menu select=1 _complete _ignored _approximate
  73. zstyle ':completion:*' use-cache on
  74. zstyle ':completion:*' cache-path /home/haron/.zsh/cache
  75. zstyle ':completion:*' insert-tab false
  76. zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
  77. # list of completers to use
  78. zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
  79. # allow one error for every three characters typed in approximate completer
  80. zstyle -e ':completion:*:approximate:*' max-errors \ 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
  81. zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=$color[cyan]=$color[red]"
  82.  
  83. # syntax-highlighting
  84. source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  85. ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
  86. ZSH_HIGHLIGHT_STYLES[default]='none'
  87. typeset -A ZSH_HIGHLIGHT_STYLES
  88. ZSH_HIGHLIGHT_STYLES=(
  89.         'alias'                  'fg=cyan'
  90.         'builtin'                'fg=yellow'
  91.         'function'               'fg=blue,bold'
  92.         'command'                'fg=green'
  93.         'hashed-commands'        'fg=green,underline'
  94.         'precommand'             'fg=cyan,bold'
  95.         'commandseparator'       'fg=yellow'
  96.         'assign'                 'fg=magenta'
  97.         'path'                   'underline'
  98.         'double-hyphen-option'   'fg=blue,bold'
  99.         'single-hyphen-option'   'fg=blue,bold'
  100.         'unknown-token'          'fg=red'
  101. )
  102. ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
  103. ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
  104. ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
  105. ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
  106. ZSH_HIGHLIGHT_PATTERNS+=('sudo' 'fg=red,bold')
  107. ZSH_HIGHLIGHT_STYLES[root]='bg=red'
  108.  
  109. # usage grc
  110. if [ -f /usr/bin/grc ]; then
  111.   alias ping="grc --colour=auto ping"
  112.   alias traceroute="grc --colour=auto traceroute"
  113.   alias make="grc --colour=auto make"
  114.   alias diff="grc --colour=auto diff"
  115.   alias cvs="grc --colour=auto cvs"
  116.   alias netstat="grc --colour=auto netstat"
  117.   alias nmap='grc --colour=auto nmap'
  118.   alias logc="grc --colour=auto cat"
  119.   alias logt="grc --colour=auto tail"
  120.   alias logh="grc --colour=auto head"
  121. fi
  122.  
  123. [[ -a $(whence -p pacman-color) ]] && compdef _pacman pacman-color=pacman
  124.  
  125. # active plugins
  126. source /usr/share/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
  127. source /usr/share/oh-my-zsh/plugins/autojump/autojump.plugin.zsh
  128. source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh
  129. source /usr/share/oh-my-zsh/plugins/cp/cp.plugin.zsh
  130. source /usr/share/oh-my-zsh/plugins/rsync/rsync.plugin.zsh
  131. source /usr/share/oh-my-zsh/plugins/web-search/web-search.plugin.zsh
  132. source /usr/share/oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh
  133. source /home/haron/scripts/my_zhs_plugins/global_aliases.plugin.zsh
  134. source /home/haron/scripts/my_zhs_plugins/my_aliases.plugin.zsh
  135. source /home/haron/scripts/my_zhs_plugins/extract.plugin.zsh
  136. source /home/haron/scripts/my_zhs_plugins/pk.plugin.zsh
  137.  
  138. # aliases
  139. alias ls="ls -la --classify --color=auto"
  140. alias grep='grep --colour=auto'
  141. alias fgrep='fgrep --color=auto'
  142. alias egrep='egrep --color=auto'
  143. alias ll='ls -alF'
  144. alias la='ls -A'
  145. alias l='ls -CF'
  146. alias li='ls -ial'
  147.  
  148. alias -s {avi,mpeg,mpg,mov,m2v}=mpv
  149. alias -s {odt,doc,sxw,rtf}=libreoffice
  150. alias -s {png,gif,jpg,jpeg}=feh
  151. alias -s tex=nano
  152.  
  153.  
  154. ##Set some keybindings
  155. #################################################
  156. bindkey '^[[A' up-line-or-search                # up arrow for back-history-search
  157. bindkey '^[[B' down-line-or-search              # down arrow for fwd-history-search
  158. bindkey ';5D' backward-word                     # ctrl+left
  159. bindkey ';5C' forward-word                      # ctrl+right
  160. bindkey '\e[1~' beginning-of-line               # home
  161. bindkey '\e[2~' overwrite-mode                  # insert
  162. bindkey '\e[3~' delete-char                     # del
  163. bindkey '\e[4~' end-of-line                     # end
  164. bindkey '\e[5~' up-line-or-history              # page-up
  165. bindkey '\e[6~' down-line-or-history            # page-down
  166. #################################################
  167.  
  168. export LC_CTYPE="en_US.utf8"
  169. export PATH=$HOME/.local/bin:/usr/local/bin:$PATH
  170. export PAGER="less"
  171. export EDITOR="nano"
  172. export ARCHFLAGS="-arch x86_64"
  173. export BROWSER="firefox"
  174. export MAIL="thunderbird"
  175. export OOO_FORCE_DESKTOP=awesome
  176. # export DE=kde
  177.  
  178.  
  179. #  History
  180. export HISTFILE=~/.zsh_history # хранить историю в указанном файле
  181. export SAVEHIST=$HISTSIZE # максимальное число команд, хранимых в сеансе
  182. export HISTSIZE=10000
  183. setopt APPEND_HISTORY # включить историю команд
  184. setopt HIST_IGNORE_ALL_DUPS # убрать повторяющиеся команды, пустые строки и пр.
  185. setopt HIST_IGNORE_SPACE
  186. setopt HIST_REDUCE_BLANKS
  187. setopt INC_APPEND_HISTORY
  188. setopt SH_WORD_SPLIT
  189. setopt AUTO_CD
  190.  
  191. autoload -U run-help
  192. autoload run-help-git
  193. autoload run-help-svn
  194. autoload run-help-svk
  195. alias help=run-help
  196.  
  197. autoload -U edit-command-line
  198.  
  199. # colorize man-page
  200. man() {
  201.       env \
  202.           LESS_TERMCAP_mb=$(printf "\e[1;31m") \
  203.     LESS_TERMCAP_md=$(printf "\e[1;31m") \
  204.     LESS_TERMCAP_me=$(printf "\e[0m") \
  205.     LESS_TERMCAP_se=$(printf "\e[0m") \
  206.     LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
  207.     LESS_TERMCAP_ue=$(printf "\e[0m") \
  208.     LESS_TERMCAP_us=$(printf "\e[1;32m") \
  209.     PAGER=/usr/bin/less \
  210.     _NROFF_U=1 \
  211.     PATH=${HOME}/.local/bin:${PATH} \
  212.              man "$@"
  213. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement