Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Set/unset ZSH options
- #########################
- # setopt NOHUP
- # setopt NOTIFY
- # setopt NO_FLOW_CONTROL
- setopt INC_APPEND_HISTORY SHARE_HISTORY
- setopt APPEND_HISTORY
- # setopt AUTO_LIST
- # setopt AUTO_REMOVE_SLASH
- # setopt AUTO_RESUME
- unsetopt BG_NICE
- setopt CORRECT
- setopt EXTENDED_HISTORY
- # setopt HASH_CMDS
- setopt MENUCOMPLETE
- setopt ALL_EXPORT
- export EDITOR=mcedit
- ### Set/unset shell options
- ############################
- setopt notify globdots correct pushdtohome cdablevars autolist
- setopt correctall autocd recexact longlistjobs
- setopt autoresume histignoredups pushdsilent
- setopt autopushd pushdminus extendedglob rcquotes mailwarning
- unsetopt bgnice autoparamslash
- ### Autoload zsh modules when they are referenced
- #################################################
- autoload -U history-search-end
- zmodload -a zsh/stat stat
- zmodload -a zsh/zpty zpty
- zmodload -a zsh/zprof zprof
- #zmodload -ap zsh/mapfile mapfile
- zle -N history-beginning-search-backward-end history-search-end
- zle -N history-beginning-search-forward-end history-search-end
- ### Set variables
- #################
- PATH="/usr/local/bin:/usr/local/sbin/:$PATH"
- HISTFILE=$HOME/.zhistory
- HISTSIZE=1000
- SAVEHIST=1000
- HOSTNAME="`hostname`"
- 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:';
- ### Load colors
- ###############
- autoload colors zsh/terminfo
- if [[ "$terminfo[colors]" -ge 8 ]]; then
- colors
- fi
- for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
- eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
- eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
- (( count = $count + 1 ))
- done
- ### Set prompt
- ##############
- PS1="$PR_LIGHT_CYAN>>%{$reset_color%} "
- #if [[ ! -z $MC_SID ]] { PROMPT= }
- #RPS1="$PR_LIGHT_CYAN(%D{%d-%m %H:%M})%{$reset_color%}"
- unsetopt ALL_EXPORT
- ### Set alias
- #############
- alias ll='ls -al'
- alias ls='ls --color=auto '
- ### Bind keys
- #############
- autoload -U compinit
- compinit
- bindkey "^?" backward-delete-char
- bindkey '^[OH' beginning-of-line
- bindkey '^[OF' end-of-line
- bindkey '^[[5~' up-line-or-history
- bindkey '^[[6~' down-line-or-history
- bindkey "^[[A" history-beginning-search-backward-end
- bindkey "^[[B" history-beginning-search-forward-end
- bindkey "^r" history-incremental-search-backward
- bindkey ' ' magic-space # also do history expansion on space
- bindkey '^I' complete-word # complete on tab, leave expansion to _expand
- zstyle ':completion::complete:*' use-cache on
- zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
- zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
- zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
- zstyle ':completion:*' menu select=1 _complete _ignored _approximate
- zstyle -e ':completion:*:approximate:*' max-errors \
- 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
- zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
- # Completion Styles
- # list of completers to use
- zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
- # allow one error for every three characters typed in approximate completer
- zstyle -e ':completion:*:approximate:*' max-errors \
- 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
- # insert all expansions for expand completer
- zstyle ':completion:*:expand:*' tag-order all-expansions
- # formatting and messages
- zstyle ':completion:*' verbose yes
- zstyle ':completion:*:descriptions' format '%B%d%b'
- zstyle ':completion:*:messages' format '%d'
- zstyle ':completion:*:warnings' format 'No matches for: %d'
- zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
- zstyle ':completion:*' group-name ''
- # match uppercase from lowercase
- zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
- # offer indexes before parameters in subscripts
- zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
- # command for process lists, the local web server details and host completion
- # on processes completion complete all user processes
- zstyle ':completion:*:processes' command 'ps -au$USER'
- ## add colors to processes for kill completion
- zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
- #zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
- #zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
- #
- #NEW completion:
- # 1. All /etc/hosts hostnames are in autocomplete
- # 2. If you have a comment in /etc/hosts like #%foobar.domain,
- # then foobar.domain will show up in autocomplete!
- zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}')
- # Filename suffixes to ignore during completion (except after rm command)
- zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
- '*?.old' '*?.pro'
- # the same for old style completion
- #fignore=(.o .c~ .old .pro)
- # ignore completion functions (until the _ignored completer)
- zstyle ':completion:*:functions' ignored-patterns '_*'
- zstyle ':completion:*:*:*:users' ignored-patterns \
- adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
- named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
- rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs avahi-autoipd\
- avahi backup messagebus beagleindex debian-tor dhcp dnsmasq fetchmail\
- firebird gnats haldaemon hplip irc klog list man cupsys postfix\
- proxy syslog www-data mldonkey sys snort
- # SSH Completion
- zstyle ':completion:*:scp:*' tag-order \
- files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
- zstyle ':completion:*:scp:*' group-order \
- files all-files users hosts-domain hosts-host hosts-ipaddr
- zstyle ':completion:*:ssh:*' tag-order \
- users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
- zstyle ':completion:*:ssh:*' group-order \
- hosts-domain hosts-host users hosts-ipaddr
- zstyle '*' single-ignored show
- ### Source plugins
- ##################
- source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
- # brackets
- ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue' #скобки
- ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red'
- ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow'
- ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta'
- ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' # неизвестная команда
- # command
- ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' # зарезервированное слово
- ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow' # алиас
- ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold' # built-in функция (например, echo)
- ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold' # функция, определенная в шелле
- ZSH_HIGHLIGHT_STYLES[command]='fg=green' # обычная команда
- ZSH_HIGHLIGHT_STYLES[precommand]='fg=green,bold' # пре-команда (например, sudo в sudo cp ...)
- ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow' # разделитель команд, && || ;
- ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green' # команда, найденная в путях (hashed)
- ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue' # флаги типа -*
- ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue' # флаги типа --*
- # path
- ZSH_HIGHLIGHT_STYLES[path]='fg=cyan' # пути
- ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan'
- ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan'
- # shell
- ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan' # шаблон (например, /dev/sda*)
- ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue' # подстановка из истории (команда, начинающаяся с !)
- ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta' # присвоение
- ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' # конструкции типа "$VARIABLE"
- ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' # конструкции типа \"
- ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue' # конструкции типа `command`
- # quotes
- ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline' # конструкции типа 'text'
- ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' # конструкции типа "text"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement