Конфиг:zshrc2: различия между версиями
Материал из Linux Wiki
Перейти к навигацииПерейти к поиску
Lazyklimm (обсуждение | вклад) м |
Lazyklimm (обсуждение | вклад) м |
||
Строка 211: | Строка 211: | ||
pc['\(']="%F{clr[1]}(" | pc['\(']="%F{clr[1]}(" | ||
pc['\)']="%F{clr[1]})" | pc['\)']="%F{clr[1]})" | ||
POSTEDIT="$reset_color" | POSTEDIT="$reset_color" |
Версия 15:53, 17 июня 2009
~/.zshrc
source /etc/profile
source ~/.profile
autoload -U compinit
compinit
autoload -U incremental-complete-word
zle -N incremental-complete-word
autoload -U insert-files
zle -N insert-files
autoload -U predict-on
zle -N predict-on
autoload zmv
# $PROMPT style
fpath=(~/.zsh/functions $fpath)
autoload -U promptinit
promptinit
prompt mysuse
preexec() {
[[ -t 1 ]] || return
case $TERM in
*xterm*|*rxvt|(dt|k|E)term*) print -Pn "\e]2;<$1> [%~]\a"
;;
esac
}
HISTFILE=~/.zhistory
SAVEHIST=7770
HISTSIZE=777
DIRSTACKSIZE=20
setopt APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt No_Beep
alias ls='ls -F --color=auto '
#alias ls='ls -FG'
alias ll='ls -lFG'
#alias la='ls -aFG'
alias la='ls -Flah --color=auto -a'
alias cp='cp -v'
alias mv='mv -v'
alias rm='rm -v'
alias du='du -h'
#alias -s {jpg,gif,bmp,png,xpm}=gqview
#alias -s {mp3,ogg,wav,avi,mpeg,mpg,mov,m2v,wmv}=mplayer
#alias -s {txt,h,c,cpp,cc,conf,4th,diff}=$EDITOR
#alias -s {odt,doc,xls,sxw,rtf}=abiword
#alias -s xls=gnumeric
#alias -s pdf=xpdf
#alias -s chm=xchm
#alias -s djvu=djview
#autoload -U pick-web-browser
#alias -s {html,htm}=pick-web-browser
export EDITOR="vim"
export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
export PAGER=most
export G_BROKEN_FILENAMES=1
# csh compatibility
setenv() {
typeset -x "${1}${1:+=}${(@)argv[2,$#]}"
}
freload() {
while (( $# )); do; unfunction $1; autoload -U $1; shift; done
}
# полезная функция
mkcd () {
mkdir $@ && cd $1
}
# automatically remove duplicates from these arrays
typeset -U path cdpath fpath manpath
export LS_COLORS='no=00:fi=00: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:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.wmv=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
zstyle ':completion:*:default' list-colors ${LS_COLORS}
zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' add-space true
zstyle ':completion:*:processes' command 'ps -xuf'
zstyle ':completion:*:processes' sort false
zstyle ':completion:*:processes-names' command 'ps xho command'
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
zstyle ':completion:*:expand:*' tag-order all-expansions
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*' menu select=long-list select=0
zstyle ':completion:*' old-menu false
zstyle ':completion:*' original true
zstyle ':completion:*' substitute 1
zstyle ':completion:*' use-compctl true
zstyle ':completion:*' verbose true
zstyle ':completion:*' word true
#Системные пользователи которых не стоит дополнять
zstyle ':completion:*:*:*:users' ignored-patterns \
root toor daemon operator bin tty kmem games news \
man sshd bind proxy _pflogd _dhcp uucp pop www \
nobody mailnull smmsp gnats jabber mysql messagebus \
dnscache dnslog ftp spamd
zstyle '*' single-ignored show
bindkey -d # reset
#bindkey -v # vi key bindings
bindkey -e # emacs key bindings
# Keyboard configuration
bindkey "\e[2~" quoted-insert # Insert
bindkey "\e[3~" delete-char # Suppr
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line # End
bindkey "\e[5~" up-line-or-history # Previous
bindkey "\e[6~" down-line-or-history # Next
# those two are for rxvt
bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line
# some xterms, freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# on some exotic xterms
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
bindkey "\eOd" backward-word
bindkey "\eOc" forward-word
# on nxterms
bindkey "\e[\C-@" beginning-of-line
bindkey "\e[e" end-of-line
if [ "${TERM%%-*}" = xterm ]; then
#
# Application keypad and cursor of xterm
# with NumLock ON
#
# Operators
bindkey -s "\eOo" "/"
bindkey -s "\eOj" "*"
bindkey -s "\eOm" "-"
bindkey -s "\eOk" "+"
bindkey -s "\eOl" "+"
bindkey "\eOM" accept-line
# Colon and dot
# bindkey -s "\eOl" ","
bindkey -s "\eOn" "."
# Numbers
bindkey -s "\eOp" "0"
bindkey -s "\eOq" "1"
bindkey -s "\eOr" "2"
bindkey -s "\eOs" "3"
bindkey -s "\eOt" "4"
bindkey -s "\eOu" "5"
bindkey -s "\eOv" "6"
bindkey -s "\eOw" "7"
bindkey -s "\eOx" "8"
bindkey -s "\eOy" "9"
fi
#
# Application keypad and cursor of xterm
#
bindkey "\eOD" backward-char
bindkey "\eOC" forward-char
bindkey "\eOA" up-line-or-history
bindkey "\eOB" down-line-or-history
#bindkey "\eOE" re-read-init-file
для промпта mysuse необходимо поместить следующее
autoload -Uz vcs_info
local -a clr
local -A pc
local -A smile
#local _time _path _tail
clr[1]=${1:-'red'}
clr[2]=${2:-'cyan'}
clr[3]=${3:-'green'}
clr[4]=${4:-'yellow'}
clr[5]=${5:-'white'}
pc['\[']="%F{$clr[1]}["
pc['\]']="%F{$clr[1]}]"
pc['<']="%F{$clr[1]}<"
pc['>']="%F{clr[1]}>"
pc['\(']="%F{clr[1]}("
pc['\)']="%F{clr[1]})"
POSTEDIT="$reset_color"
_time=$pc['\[']%B%F{$clr[3]}%*$pc['\]']
_path=$pc['\[']%B%F{$clr[4]}%~%(1/./.)$pc['\]']
_tail="%F{$clr[2]}:\>%b%f"
_inputfmt=%F{$clr[5]}
_namehost=%F{$clr[5]}%n@%m
_smile=%(?.%F{$clr[3]}:\).%F{$clr[1]}:\()%f
prompt="$_time $_path
$_namehost $_tail $_inputfmt"
RPS1="$_smile"
prompt_opts=( cr percent )
precmd () { }
preexec () { }
в ~/.zsh/functions/prompt_mysuse_setup