On 06.10.2013 12:49, Sohin Vyacheslaw wrote:
как всё получится-поделись плз конфигом...
Скидываю конфиг в аттаче и здесь: http://pastebin.com/kGs84bmp
Ничего особо навороченного нет (б`ольшая часть переехала с Bash и находится в виде симлинков в /etc/profile.d/*.zsh). Используется oh-my-zsh с подключенными плагинами и некоторыми корректировками поведения в конфиге. Установка oh-my-zsh: curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh Линк на oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh Это /etc/zsh/zprofile: # /etc/zsh/zprofile: system-wide .zprofile file for zsh(1). # # This file is sourced only for login shells (i.e. shells # invoked with "-" as the first character of argv[0], and # shells invoked with the -l flag.) # # Global Order: zshenv, zprofile, zshrc, zlogin if [ "`id -u`" -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" fi export PATH if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.zsh; do if [ -r $i ]; then . $i fi done unset i fi Почти полностью скопипащен из /etc/profile (не хотелось менять системный). Алиасы для Zsh (/etc/profile.d/00aliases.zsh): . /etc/profile.d/00aliases.sh # Suffix aliases for Zsh. alias -s {pdf,djvu,chm,fb2,ps}=okular alias -s {avi,mpeg,mpg,mov,m2v,flv}=mplayer alias -s {ogg,mp3,wav}=mpg321 alias -s exe=wine # Suffix aliases for HTML pages and WEB-sites. autoload -U pick-web-browser alias -s {html,htm,xhtml,ru,org,net,com}=pick-web-browser И ещё /etc/profile.d/70archivers.sh (симлинк для Zsh нужен, естественно), который заменяет функцию из oh-my-zsh плагина extract): # # Unpack archives. Functions by `muhas` modified by Artiom N.. # # Распаковка любого архива (http://muhas.ru/?p=55) unpack() { if [ $# -lt 1 ]; then echo "Usage: unpack <file> [args]" >&2 return 1 fi a_name="$1" extract_dir="$( echo $(basename "$a_name") | sed "s/\.${1##*.}//g" )" shift if [ -f $1 ] ; then case $1 in *.tar.bz2,*.tbz,*.tbz2) tar xvjf "$a_name" $* ;; *.tar.gz,*.tgz) tar xvzf "$a_name" $* ;; *.tar.xz) tar --xz -xvf "$a_name" $* ;; *.tar.zma,*.tlz) tar --lzma -xvf "$a_name" $* ;; *.bz2) bunzip2 "$a_name" $* ;; *.rar) unrar x "$a_name" $* ;; *.gz) gunzip "$a_name" $* ;; *.tar) tar xvf "$a_name" $* ;; *.zip) unzip "$a_name" $* ;; *.Z) uncompress "$a_name" $* ;; *.7z) 7za x "$a_name" $* ;; *.rar) unrar x "$a_name" $* ;; *.xz) unxz "$a_name" $* ;; *.arj) arj x "$a_name" $* ;; *.ace) unace x "$a_name" $* ;; *.lzm,*.lzma) unlzma "$a_name" $* ;; *.deb) mkdir -p "$extract_dir/control" mkdir -p "$extract_dir/data" cd "$extract_dir"; ar vx "../${1}" > /dev/null cd control; tar xzvf ../control.tar.gz cd ../data; tar xzvf ../data.tar.gz cd ..; rm *.tar.gz debian-binary cd .. ;; *.ar) ar x "$a_name" $* ;; *.cpio,*.rpm) cpio -i $* < "$a_name" ;; *) echo "Cannot unpack '$a_name' $*..." ;; esac else echo "'$1' is not a valid file" fi } # ... и упаковка (http://muhas.ru/?p=55) pack() { if [ $1 ] ; then case $1 in tbz) tar cjvf $2.tar.bz2 $2 ;; tgz) tar czvf $2.tar.gz $2 ;; tar) tar cpvf $2.tar $2 ;; bz2) bzip $2 ;; gz) gzip -c -9 --best -n $2 > $2.gz ;; zip) zip -r $2.zip $2 ;; 7z) 7z a $2.7z $2 ;; rar) rar a $2.rar $2 ;; *) echo "'$1' Cannot be packed via pack()" ;; esac else echo "'$1' is not a valid file" fi } alias x=unpack Функции не проверял: черновой вариант.
# # Artiom N. Zsh local config file (~/.zshrc). # # See also: # https://github.com/robbyrussell/oh-my-zsh/ # http://pastie.org/1073336 # # Path to your oh-my-zsh configuration. ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. # Good themes: gentoo, agnoster, duellj. ZSH_THEME="gentoo" # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" # Uncomment this to disable bi-weekly auto-update checks # DISABLE_AUTO_UPDATE="true" # Uncomment to change how often before auto-updates occur? (in days) # export UPDATE_ZSH_DAYS=13 # Uncomment following line if you want to disable colors in ls # DISABLE_LS_COLORS="true" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment following line if you want to disable command autocorrection # DISABLE_CORRECTION="true" # Uncomment following line if you want red dots to be displayed while waiting for completion # COMPLETION_WAITING_DOTS="true" # Uncomment following line if you want to disable marking untracked files under # VCS as dirty. This makes repository status check for large repositories much, # much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # compleat - Bash-completion. # debian - aliases to apt-*, dpkg and aptitude. Useful: apt-history, kerndeb. # emoji-clock - clock. :-) # encode64 - aliases to base64: e64, d64. # fbterm - framebuffer terminal. # gem - Ruby gem installer autocompletion. # git - Git aliases. # git-extras - Extra Git autocompletion. # history-substring-search - searh substring in the shell history. # jump - Easily jump around the file system by manually adding marks. # kate - alias to kate (and Kate is started silently from console). # mosh - simply map SSH autocompletion to mosh. No overhead. # python - pyclean, pyfind, pygrep. # rand-quote - random quote from http://www.quotationspage.com # (function `quote`). # themes - add functions `theme` and `lstheme` for loading and listing # oh-my-zsh themes. # torrent - magnet link to torrent file converter # (function `magnet_to_torrent`). # urltools - `urldecode` and `urlencode` functions. # web-search - search from the terminal. Aliases: bing, google, yahoo, # ddg (for Duckduckgo), wiki, news, youtube, map, image, ducky. plugins=(colored-man compleat debian emoji-clock encode64 fbterm gem \ git git-extras git-flow git-remote-branch history-substring-search \ jump kate mosh python rand-quote themes torrent urltools) # Interesting plugins: # cp - replace 'cp' to 'rsync'. # dircycle - cycling through directory stack. # dirpersist - persistent directory stack. # extract - extract archives, but I use my own function. # git-flow-avh # gitfast - fast Git autocompletion. # github. # gnu-utils - use GNU utilities for replace built-in functions. # go/golang - Google Go language compiler autocompletion. # nyan - animated terminal nyan cat. # pass - password manager. # per-directory-history - history unique for each directory. # perl - aliases for Perl. # pj - simple project manager. # postgres - aliases for starting/restarting Postgres SQL. # rails. rails3, rails4 - aliases for Ruby On Rails. # redis-cli - Redis database client completion. # rsync - aliases for rsync (rsync-copy, rsync-move, rsync-update, # rsync-synchronize). # ruby - aliases: rfind, rgem. # safe-paste - safe paste text to the X-terminal. # scala - autocompletion for Scala compiler. # screen - plugin for GNU Screen. # sprunge - command line Pastebin (function `sprunge`). # ssh-agent - wrapper for the SSH autentification agent. # sublime - set paths for Sublime text editor on MacOS X and add alias `stt` # on all systems. # svn - functions for Subversion (like svn_get_branch_name). # systemd - add aliases with sudo for the system.d commands (start, stop, # restart, etc.). # taskwarrior - console task manager. # vi-mode - enable handy Vim mode in the terminal. # vundle - bundle manager for Vim. # yum - Aliases for Yum commands. For RH-based. source $ZSH/oh-my-zsh.sh # Autocompletion. # Enabled in oh-my-zsh. # autoload -Uz compinit && compinit # Enabling user-names completion, disabled in oh-my-zsh. zstyle -d ':completion:*' users # Setting in oh-my-zsh. # Share history between shells. #setopt share_history # Ignore duplicity commands in history. #setopt hist_ignore_all_dups # Don't save in history commands, beginning with space. #setopt hist_ignore_space # Don't save command «history» or «fc» in history. setopt hist_no_store # Bash-like '=' setopt no_equals # В «1 2 3» и «a b c d» соответственно setopt braceccl # Файлы с цифрами сортировать числовым методом, а не лексическим setopt numeric_glob_sort # Save execution time of the command in the history. setopt extended_history # Disable autocorrect. unsetopt correct_all # Customize to your needs... export PATH=$PATH:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/bin #if [ "$color_prompt" = yes ]; then # PS1=$'%{\e[01;32m%}%n@%m%{\e[00m%}:%{\e[01;34m%}%~%{\e[00m%}$ ' # PS1=$'%{$fg_bold[green]%}%n@%m%{$reset_colors%}:%{$fg_bold[blue]%}%~%{$reset_color%}$ ' #else # PS1='%n@%m:%~$ ' #fi # Right-hand prompt. #RPROMPT='%{$fg[red]%} ⏎ $? %{$reset_color%} '$RPROMPT # Error-correction prompt. #SPROMPT=" $fg[red]%R →$reset_color $fg[green]%r?$reset_color (Yes, No, Abort, Edit) " # Vim key bindings (-e for Emacs). Enabled in plugin. #bindkey -v # Console calculator. #autoload zcalc case $TERM in xterm* | rxvt*) # precmd вызывается непосредственно перед выводом prompt precmd() { print -Pn "\e]0;zsh\a" } # preexec вызывается перед выполнением команды # $1 — имя команды (точнее, вся команда со всеми переданными параметрами) # sed используется для «отрезания» от команды параметров preexec() { print -Pn "\e]0;`echo $1 | sed -r 's/^([^[:space:]]+).*/\1/'`\a" } ; esac

