Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
- printf '-!-\n'
- printf '-!- Looks like you are using the old zshrc layout of grml.\n'
- printf '-!- Please read the notes in the grml-zsh-refcard, being'
- printf '-!- available at: http://grml.org/zsh/\n'
- printf '-!-\n'
- printf '-!- If you just want to get rid of this warning message execute:\n'
- printf '-!- touch ~/.zshrc.local\n'
- printf '-!-\n'
- fi
- [ -r /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- [ -r /usr/share/doc/pkgfile/command-not-found.zsh ] && source /usr/share/doc/pkgfile/command-not-found.zsh
- which startx 2>&1 > /dev/null && alias startx="startx &> ~/.xlog"
- # highlighting
- source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
- # brackets
- ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
- ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
- ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
- ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
- # cursor
- #ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue'
- # main
- # default
- ZSH_HIGHLIGHT_STYLES[default]='none' # стандартный цвет
- # unknown
- ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' # неизвестная команда
- # command
- ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold' # зарезервированное слово
- ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold' # алиас
- 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=blue,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,bold' # флаги типа -*
- ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' # флаги типа --*
- # path
- ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold' # станлартный путь
- 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"
- # pattern
- ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
- # root
- ZSH_HIGHLIGHT_STYLES[root]='bg=red'
- # bindkeys
- bindkey '^[[A' up-line-or-search # up arrow for back-history-search
- bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search
- bindkey '\e[1~' beginning-of-line # home
- bindkey '^[[2~' overwrite-mode # insert
- bindkey '^[[3~' delete-char # del
- bindkey '\e[4~' end-of-line # end
- bindkey '^[[5~' up-line-or-history # page-up
- bindkey '^[[6~' down-line-or-history # page-down
- bindkey "^[[1;5C" forward-word # Ctrl-Right
- bindkey "^[[1;5D" backward-word # Ctrl-Left
- bindkey '^[[H' beginning-of-line # Home
- bindkey '^[[F' end-of-line # End
- autoload -U compinit
- compinit
- zstyle ':completion:*' insert-tab false
- zstyle ':completion:*' max-errors 2
- zstyle :compinstall filename '/home/dmitry/.zshrc'
- autoload -Uz compinit
- compinit
- # End of lines added by compinstall
- # promptinit
- autoload -U promptinit
- promptinit
- # colors
- autoload -U colors
- colors
- # append history
- setopt APPEND_HISTORY
- # ignore dups in history
- setopt HIST_IGNORE_ALL_DUPS
- # ighore additional space in history
- setopt HIST_IGNORE_SPACE
- # reduce blanks in history
- setopt HIST_REDUCE_BLANKS
- # disable beeps
- unsetopt beep
- # pkgfile
- source /usr/share/doc/pkgfile/command-not-found.zsh
- # PROMPT && RPROMPT
- if [[ $EUID == 0 ]]; then
- # [root dir] #
- PROMPT="%{$fg_bold[blue]%}%n%{$reset_color%} %{$fg_no_bold[yellow]%}%1~ %{$fg_bold[red]%}# %{$reset_color%}"
- RPROMPT="[%{$fg_no_bold[yellow]%}%?%{$reset_color%}]"
- else
- # [user dir] $
- PROMPT="%{$fg_bold[blue]%}%n%{$reset_color%} %{$fg_no_bold[yellow]%}%1~ %{$fg_bold[green]%}$ %{$reset_color%}"
- RPROMPT="[%{$fg_no_bold[yellow]%}%?%{$reset_color%}]"
- fi
- su () {
- checksu=0
- for flags in $*; do
- if [[ $flags == "-" ]]; then
- checksu=1
- fi
- done
- if [[ $checksu == 0 ]]; then
- echo "Use 'su -', Luke"
- /usr/bin/su - $*
- else
- /usr/bin/su $*
- fi
- }
- # sudo alias
- if [[ $EUID == 0 ]]; then
- alias fat32mnt='show_which fat32mnt && mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
- alias synctime='show_which synctime && { ntpd -qg; hwclock -w; date; }'
- else
- alias fat32mnt='show_which fat32mnt && sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
- alias umount='show_which umount && sudo umount'
- alias mount='show_which mount && sudo mount'
- alias netctl='show_which netctl && sudo netctl'
- alias synctime='show_which synctime && { sudo ntpd -qg; sudo hwclock -w; date; }'
- alias wifi-menu='show_which wifi-menu && sudo wifi-menu'
- alias dhcpcd='show_which dhcpcd && sudo dhcpcd'
- alias journalctl='show_which journalctl && sudo journalctl'
- alias systemctl='show_which systemctl && sudo systemctl'
- alias modprobe='show_which modprobe && sudo modprobe'
- alias rmmod='show_which rmmod && sudo rmmod'
- alias staging-i686-build='show_which staging-i686-build && sudo staging-i686-build'
- alias staging-x86_64-build='show_which staging-x86_64-build && sudo staging-x86_64-build'
- fi
- # function to extract archives
- # EXAMPLE: unpack file
- unpack () {
- if [[ -f $1 ]]; then
- case $1 in
- *.tar.bz2) tar xjfv $1 ;;
- *.tar.gz) tar xzfv $1 ;;
- *.tar.xz) tar xvJf $1 ;;
- *.bz2) bunzip2 $1 ;;
- *.gz) gunzip $1 ;;
- *.rar) unrar x $1 ;;
- *.tar) tar xf $1 ;;
- *.tbz) tar xjvf $1 ;;
- *.tbz2) tar xjf $1 ;;
- *.tgz) tar xzf $1 ;;
- *.zip) unzip $1 ;;
- *.Z) uncompress $1 ;;
- *.7z) 7z x $1 ;;
- *) echo "I don't know how to extract '$1'" ;;
- esac
- else
- case $1 in
- *help) echo "Usage: unpack ARCHIVE_NAME" ;;
- *) echo "'$1' is not a valid file" ;;
- esac
- fi
- }
- aur() {
- yaourt --noconfirm $*
- }
- # function to create archives
- # EXAMPLE: pack tar file
- pack () {
- if [ $1 ]; then
- case $1 in
- tar.bz2) tar -cjvf $2.tar.bz2 $2 ;;
- tar.gz) tar -czvf $2.tar.bz2 $2 ;;
- tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;;
- bz2) bzip $2 ;;
- gz) gzip -c -9 -n $2 > $2.gz ;;
- tar) tar cpvf $2.tar $2 ;;
- tbz) tar cjvf $2.tar.bz2 $2 ;;
- tgz) tar czvf $2.tar.gz $2 ;;
- zip) zip -r $2.zip $2 ;;
- 7z) 7z a $2.7z $2 ;;
- *help) echo "Usage: pack TYPE FILES" ;;
- *) echo "'$1' cannot be packed via pack()" ;;
- esac
- else
- echo "'$1' is not a valid file"
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement