$sudo apt-get install zsh
1. find .zshrc file from search engine such as www.googel.com
place into home directory of root( /root) and home directory of user(such as /home/redcrow)
2. edit /etc/passwd
the line of root is
root :x:0:0:root:/root:/bin/zsh
and line of user is
redcrow:x:1000:1000:redcrow,,,:/home/redcrow/bin/zsh
3. execute .zshrc file
at home directory of user
type the following command
~$touch ~/ .zshrc
example (my .zshrc)
#!/bin/zsh
# _____
# |__ / _____ _ _ ___ ___
# / / / ___/| |_| | \/ _|
# _ / /_ \___ \| _ | ° < (_
# (((_)____|_____/|_| |_|_|\_\___|
#
# v20110621-01
export LANG=C
#-- prompt
autoload -Uz promptinit
promptinit
# run a terminal and enter "prompt -h"
#-- keybindings
bindkey -e
#bindkey "\e[H" beginning-of-line
#bindkey "\e[F" end-of-line
#bindkey "\e[3~" delete-char
#bindkey "^R" history-incremental-search-backward
#-- keep history
HISTSIZE=5000
SAVEHIST=5000
HISTFILE=~/.zsh_history
#-- default editors (crontab -e, visudo, svn commit -m, git commit)
export VISUAL=vim
export EDITOR=vim
export SVN_EDITOR=vim
#-- use modern completion system
autoload -Uz compinit
compinit
#-- use colors
autoload -U colors
colors
eval "$(dircolors -b)"
#-- completion
# :completion:function:completer:command:argument:tag
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh_cache
zstyle ':completion:*:rm:*' ignore-line yes
zstyle ':completion:*:mv:*' ignore-line yes
zstyle ':completion:*:cp:*' ignore-line yes
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format ' %B%F{white}--- Completing %d ---%f%b'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
#-- options
setopt hist_verify
#-- commands aliases
alias sagi='sudo apt-get install'
alias c='clear'
#alias cp='cp --interactive'
alias df='df --human-readable'
alias du='du --human-readable'
alias egrep='egrep --color=auto'
alias grep='grep --color=auto'
alias la='ls -A'
alias less='less --quiet'
alias ll='ls -l'
alias lla='ls -la'
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars --human-readable'
#alias mv='mv --interactive'
alias nl='nl -ba'
#alias rm='rm --interactive'
alias zgrep='zgrep --color=auto'
#-- completion for script arguments
# if /opt/scripts/creat-package.sh<TAB>, zsh will complete with
# dirs in /home/nico/workspace/src/modules/ :
#compdef '_files -/ -W /home/nico/workspace/src/modules/' /opt/scripts/creat-package.sh
#-- PROMPT
function precmd {
# change the title of the terminal :
case $TERM in
xterm*)
print -Pn "\e]0;%n sur %m\a"
;;
esac
# prompt color (red if root) :
c='blue'
[[ `id -u` -eq 0 ]] && c='red'
# lets init some variables which will be displayed :
local myTime=`/bin/date +%H:%M:%S`
local myUsername=`/usr/bin/id -un`
local myHostname=`/bin/hostname`
# trucate the current working directory if too long :
nb=`echo "# ${myUsername}@${myHostname}[${myTime}]" | /usr/bin/wc -c`
align=$((76 - $nb))
width_pwd=$((76 - $nb - 3))
current_working_dir=`echo ${(%):-%~} | /usr/bin/perl -ne 'chomp;s/.*(.{'$width_pwd'})$/...$1/;printf"%-'$align's",$_'`
PS1="%B%{${fg[$c]}%}
%{${fg[default]}%}%{${fg[$c]}%}${current_working_dir}
%{${fg[$c]}%}%# ${myUsername}%{${fg[yellow]}%}@%{${fg[white]}%}${myHostname}%{${fg[$c]}%}[${myTime}]%{${fg[default]}%}%b >> "
}
### EOF
ไม่มีความคิดเห็น:
แสดงความคิดเห็น