Archlinux Zsh
From Lapis Wiki
Bu makale NASIL bölümü serisinin bir parçasıdır
|
| MasaÜstü • Donanım • Ağ • Dağıtımlar |
| Tarayıcılar• Programlama • Linux ve Oyunlar |
Konu başlıkları |
Giriş
Zsh, hem bir kabuk, hem de script dili çevirici gibi çalışan, güçlü bir kabukdur. Bash gibi olmasının yanı sıra, ondan daha fazla avantaja sahiptir.
- hız
- gelişmiş tamamlama
- tamamen kişiselleştirilebilmesi
gibi özellikleri bunlardan birkaçıdır. Daha fazla bilgi için zsh FAQ'ı ziyeret edebilirsiniz.
Kurulum
Zsh'ı pacman kullanarak kurmak için;
pacman -S zsh
komutu verilir.
|
Not: Bir dahaki bölüm olan zsh'ı öntanımlı kabuğunuz yapmak için, terminalde "zsh" komutunu vererek, zsh'ın doğru kurulduğuna emin olmalısınız. Eğer doğru kurulduğuna eminseniz, "exit" komutunu vererek, yeni bir kabuğa geçmeye hazırlanın. |
Root yetkileri olmadan, bir kullanıcının kabuğunu değiştirmek için, "chsh" komutu kullanılır. Eğer, zsh'ı pacman kullanarak kurduysanız, /etc/shells dosyasının içine bir girdinin oluşması lazım.
which zsh
komutu ile zsh'ın çalıştırılabilir dosyasının, tam yolu görülecektir. Artık bütün bilgileri topladığımıza göre asıl ve son komutumuzu girmemizin vakti geldi.
chsh -s /bin/zsh Sir_Leon
Bir kullanıcın kabuğunu değiştirmenin bir başka yolu "usermod" komutunu kullanmaktır. Fakat bu komutun dezavantajı, komutu girebilmeniz için root yetkilerine sahip olmanızı gerektirmesidir. Bu komutun kullanışı da;
usermod -s /bin/zsh Sir_Leon
şeklindedir.
Bu aşamaları uyguladıysanız, sistemden tekrar çıkıp girmeniz halinde, kendinizi bash yerine zsh da bulacaksınız.
Ayarlar
Renkli Prompt
Zsh'ı renklendirmenin en basit ve en hızlı yoludur. Kullanmak için, ~/.zshrc dosyasına;
autoload -U promptinit promptinit
satırlarını eklediğinizden emin olun.
Kullanabileceğiniz ayarların listesini;
prompt -l
komutu ile görebilirsiniz. Bunlardan birini kullanmak için de; "prompt istediginiz_ayar" satırını ~/.zshrc dosyanıza eklemeniz lazım. Örnek olarak "walters" temasını kullanmak için;
prompt walters
satırını girmeniz lazım.
Otomatik Tamamlama
Otomatik tamamlamayı etkinleştirmek için ~/.zshrc dosyanıza
autoload -U compinit compinit
satırlarını girmeniz lazım.
Örnek .zshrc dosyaları
Basit bir .zshrc dosyası;
| Dosya: .zshrc |
########################################################### autoload -U compinit promptinit compinit promptinit #Bu kısıma seçtiğiniz temayı yazın prompt walters |
Çok ayarlı bir .zshrc dosyası;
| Dosya: .zshrc |
###########################################################
# Important stuff.
# Export some vars
export PATH="$PATH:/usr/local/bin:/usr/local/jdk/jdk1.5.0_04/bin:/opt/kde/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
export CLASSPATH=".:/usr/local/jdk/jdk1.5.0_04/jre/lib/rt.jar"
export NNTPSERVER="news.server.com"
for file in /etc/profile.d/*.sh ; do
if [ -x $file ]; then
. $file
fi
done
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
export PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
fi
fi
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
# Umask of 022
umask 022
# Options for zsh
export HISTFILE=~/.zsh_history
export HISTSIZE=50000
export SAVEHIST=50000
eval `dircolors -z`
autoload -U compinit compinit
setopt autopushd pushdminus pushdsilent pushdtohome
setopt autocd
setopt cdablevars
setopt ignoreeof
setopt interactivecomments
setopt nobanghist
setopt noclobber
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt SH_WORD_SPLIT
setopt nohup
# PS1 and PS2
export PS1="$(print '%{\e[1;34m%}%n%{\e[0m%}'):$(print '%{\e[0;34m%}%~%{\e[0m%}')$ "
export PS2="$(print '%{\e[0;34m%}>%{\e[0m%}')"
# Vars used later on by zsh
export EDITOR="gvim -geom 82x35"
export BROWSER=links
export XTERM="aterm +sb -geometry 80x29 -fg black -bg lightgoldenrodyellow -fn -xos4-terminus-medium-*-normal-*-14-*-*-*-*-*-iso8859-15"
##################################################################
# Stuff to make my life easier
# allow approximate
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
# tab completion for PID :D
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# cd not select parent dir.
zstyle ':completion:*:cd:*' ignore-parents parent pwd
##################################################################
# Key bindings
# http://mundy.yazzy.org/unix/zsh.php
# http://www.zsh.org/mla/users/2000/msg00727.html
typeset -g -A key
bindkey '^?' backward-delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[5~' up-line-or-history
bindkey '^[[3~' delete-char
bindkey '^[[4~' end-of-line
bindkey '^[[6~' down-line-or-history
bindkey '^[[A' up-line-or-search
bindkey '^[[D' backward-char
bindkey '^[[B' down-line-or-search
bindkey '^[[C' forward-char
##################################################################
# My aliases
# Set up auto extension stuff
alias -s html=$BROWSER
alias -s org=$BROWSER
alias -s php=$BROWSER
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s png=feh
alias -s jpg=feh
alias -s gif=feg
alias -s sxw=soffice
alias -s doc=soffice
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
# Normal aliases
alias ls='ls --color=auto -F'
alias lsd='ls -ld *(-/DN)'
alias lsa='ls -ld .*'
alias f='find |grep'
alias c="clear"
alias dir='ls -1'
alias gvim='gvim -geom 82x35'
alias ..='cd ..'
alias nicotine='/home/paul/downloads/nicotine-1.0.8rc1/nicotine'
alias ppp-on='sudo /usr/sbin/ppp-on'
alias ppp-off='sudo /usr/sbin/ppp-off'
alias firestarter='sudo su -c firestarter'
alias mpg123='mpg123 -o oss'
alias mpg321='mpg123 -o oss'
alias vba='/home/paul/downloads/VisualBoyAdvance -f 4'
alias hist="grep '$1' /home/paul/.zsh_history"
alias irssi="irssi -c irc.freenode.net -n yyz"
alias mem="free -m"
alias msn="tmsnc -l hutchy@subdimension.com"
# command L equivalent to command |less
alias -g L='|less'
# command S equivalent to command &> /dev/null &
alias -g S='&> /dev/null &'
# type a directory's name to cd to it.
compctl -/ cd
|
Kaldırmak için
Eğer tekrar bash'a dönmek istiyorsanız, paketleri kaldırmadan önce öntanımlı kabuğunuzu tekrar bash'a çevirmeniz gerekmektedir. Aksi takdirde, birçok problemle karşılaşabilirsiniz.
which sh
Komutuyla yolu öğrenip,
usermod -s /bin/sh Sir_Leon
komutuyla kabuğunuzu değiştirebilirsiniz.
Bu komutlardan sonra artık zsh'ı kaldırabilirsiniz.
pacman -R zsh
| Uyarı: Komutlardaki yolları, "which zsh" komutunun çıktısana göre, ve ismi de "kullanıcı adınıza" göre değiştirmeyi unutmayın. |
Kaynak : http://wiki.archlinux.org/index.php/Zsh
Zsh ana sayfası: http://www.zsh.org/
Zsh FAQ : http://zsh.sunsite.dk/FAQ/zshfaq01.html#l4
Zsh ayar dökümanları : http://zsh.sunsite.dk/Doc/
İlgili Lapis forum başlığı : http://forum.linux-sevenler.org/index.php/topic,5856.0.html
