Advertisement
oriko32

Untitled

Jul 27th, 2018
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.77 KB | None | 0 0
  1. ### Set/unset ZSH options
  2. #########################
  3. # setopt NOHUP
  4. # setopt NOTIFY
  5. # setopt NO_FLOW_CONTROL
  6. setopt INC_APPEND_HISTORY SHARE_HISTORY
  7. setopt APPEND_HISTORY
  8. # setopt AUTO_LIST
  9. # setopt AUTO_REMOVE_SLASH
  10. # setopt AUTO_RESUME
  11. unsetopt BG_NICE
  12. setopt CORRECT
  13. setopt EXTENDED_HISTORY
  14. # setopt HASH_CMDS
  15. setopt MENUCOMPLETE
  16. setopt ALL_EXPORT
  17.  
  18. export EDITOR=mcedit
  19.  
  20. ### Set/unset shell options
  21. ############################
  22. setopt notify globdots correct pushdtohome cdablevars autolist
  23. setopt correctall autocd recexact longlistjobs
  24. setopt autoresume histignoredups pushdsilent
  25. setopt autopushd pushdminus extendedglob rcquotes mailwarning
  26. unsetopt bgnice autoparamslash
  27.  
  28. ### Autoload zsh modules when they are referenced
  29. #################################################
  30. autoload -U history-search-end
  31. zmodload -a zsh/stat stat
  32. zmodload -a zsh/zpty zpty
  33. zmodload -a zsh/zprof zprof
  34. #zmodload -ap zsh/mapfile mapfile
  35. zle -N history-beginning-search-backward-end history-search-end
  36. zle -N history-beginning-search-forward-end history-search-end
  37.  
  38. ### Set variables
  39. #################
  40. PATH="/usr/local/bin:/usr/local/sbin/:$PATH"
  41. HISTFILE=$HOME/.zhistory
  42. HISTSIZE=1000
  43. SAVEHIST=1000
  44. HOSTNAME="`hostname`"
  45. LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:';
  46.  
  47. ### Load colors
  48. ###############
  49. autoload colors zsh/terminfo
  50. if [[ "$terminfo[colors]" -ge 8 ]]; then
  51. colors
  52. fi
  53. for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
  54. eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
  55. eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
  56. (( count = $count + 1 ))
  57. done
  58.  
  59. ### Set prompt
  60. ##############
  61. PS1="$PR_LIGHT_CYAN>>%{$reset_color%} "
  62. #if [[ ! -z $MC_SID ]] { PROMPT= }
  63. #RPS1="$PR_LIGHT_CYAN(%D{%d-%m %H:%M})%{$reset_color%}"
  64. unsetopt ALL_EXPORT
  65.  
  66. ### Set alias
  67. #############
  68. alias ll='ls -al'
  69. alias ls='ls --color=auto '
  70.  
  71. ### Bind keys
  72. #############
  73. autoload -U compinit
  74. compinit
  75. bindkey "^?" backward-delete-char
  76. bindkey '^[OH' beginning-of-line
  77. bindkey '^[OF' end-of-line
  78. bindkey '^[[5~' up-line-or-history
  79. bindkey '^[[6~' down-line-or-history
  80. bindkey "^[[A" history-beginning-search-backward-end
  81. bindkey "^[[B" history-beginning-search-forward-end
  82. bindkey "^r" history-incremental-search-backward
  83. bindkey ' ' magic-space # also do history expansion on space
  84. bindkey '^I' complete-word # complete on tab, leave expansion to _expand
  85. zstyle ':completion::complete:*' use-cache on
  86. zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
  87.  
  88. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  89. zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
  90. zstyle ':completion:*' menu select=1 _complete _ignored _approximate
  91. zstyle -e ':completion:*:approximate:*' max-errors \
  92. 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
  93. zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
  94.  
  95. # Completion Styles
  96.  
  97. # list of completers to use
  98. zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
  99.  
  100. # allow one error for every three characters typed in approximate completer
  101. zstyle -e ':completion:*:approximate:*' max-errors \
  102. 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
  103.  
  104. # insert all expansions for expand completer
  105. zstyle ':completion:*:expand:*' tag-order all-expansions
  106.  
  107. # formatting and messages
  108. zstyle ':completion:*' verbose yes
  109. zstyle ':completion:*:descriptions' format '%B%d%b'
  110. zstyle ':completion:*:messages' format '%d'
  111. zstyle ':completion:*:warnings' format 'No matches for: %d'
  112. zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
  113. zstyle ':completion:*' group-name ''
  114.  
  115. # match uppercase from lowercase
  116. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  117.  
  118. # offer indexes before parameters in subscripts
  119. zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
  120.  
  121. # command for process lists, the local web server details and host completion
  122. # on processes completion complete all user processes
  123. zstyle ':completion:*:processes' command 'ps -au$USER'
  124.  
  125. ## add colors to processes for kill completion
  126. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  127.  
  128. #zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
  129. #zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
  130. #
  131. #NEW completion:
  132. # 1. All /etc/hosts hostnames are in autocomplete
  133. # 2. If you have a comment in /etc/hosts like #%foobar.domain,
  134. # then foobar.domain will show up in autocomplete!
  135. zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}')
  136. # Filename suffixes to ignore during completion (except after rm command)
  137. zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
  138. '*?.old' '*?.pro'
  139. # the same for old style completion
  140. #fignore=(.o .c~ .old .pro)
  141.  
  142. # ignore completion functions (until the _ignored completer)
  143. zstyle ':completion:*:functions' ignored-patterns '_*'
  144. zstyle ':completion:*:*:*:users' ignored-patterns \
  145. adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
  146. named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
  147. rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs avahi-autoipd\
  148. avahi backup messagebus beagleindex debian-tor dhcp dnsmasq fetchmail\
  149. firebird gnats haldaemon hplip irc klog list man cupsys postfix\
  150. proxy syslog www-data mldonkey sys snort
  151. # SSH Completion
  152. zstyle ':completion:*:scp:*' tag-order \
  153. files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
  154. zstyle ':completion:*:scp:*' group-order \
  155. files all-files users hosts-domain hosts-host hosts-ipaddr
  156. zstyle ':completion:*:ssh:*' tag-order \
  157. users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
  158. zstyle ':completion:*:ssh:*' group-order \
  159. hosts-domain hosts-host users hosts-ipaddr
  160. zstyle '*' single-ignored show
  161.  
  162. ### Source plugins
  163. ##################
  164. source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  165.  
  166. ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
  167. # brackets
  168. ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue' #скобки
  169. ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red'
  170. ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow'
  171. ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta'
  172. ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' # неизвестная команда
  173. # command
  174. ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' # зарезервированное слово
  175. ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow' # алиас
  176. ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' # built-in функция (например, echo)
  177. ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' # функция, определенная в шелле
  178. ZSH_HIGHLIGHT_STYLES[command]='fg=green' # обычная команда
  179. ZSH_HIGHLIGHT_STYLES[precommand]='fg=green,bold' # пре-команда (например, sudo в sudo cp ...)
  180. ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' # разделитель команд, && || ;
  181. ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' # команда, найденная в путях (hashed)
  182. ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue' # флаги типа -*
  183. ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue' # флаги типа --*
  184. # path
  185. ZSH_HIGHLIGHT_STYLES[path]='fg=cyan' # пути
  186. ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan'
  187. ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan'
  188. # shell
  189. ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' # шаблон (например, /dev/sda*)
  190. ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' # подстановка из истории (команда, начинающаяся с !)
  191. ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' # присвоение
  192. ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' # конструкции типа "$VARIABLE"
  193. ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' # конструкции типа \"
  194. ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' # конструкции типа `command`
  195. # quotes
  196. ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' # конструкции типа 'text'
  197. ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' # конструкции типа "text"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement