zshにスイッチしてみる

http://journal.mycom.co.jp/column/zsh/
入門にちょうどよさそうな記事を見つけたので、bashからzshにスイッチしてみることにしました。

$ sudo apt-get install zsh
(略)
$ zsh

This is the Z Shell configuration function for new users, zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.

You can:

(q)  Quit and do nothing.  The function will be run again next time.

(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.

(1)  Continue to the main menu.

--- Type one of the keys in parentheses ---

1をタイプ。

Please pick one of the following options:

(1)  Configure settings for history, i.e. command lines remembered
     and saved by the shell.  (Recommended.)

(2)  Configure the new completion system.  (Recommended.)

(3)  Configure how keys behave when editing command lines.  (Recommended.)

(4)  Pick some of the more common shell options.  These are simple "on"
     or "off" switches controlling the shell's features.  

(0)  Exit, creating a blank ~/.zshrc file.

(a)  Abort all settings and start from scratch.  Note this will overwrite
     any settings from zsh-newuser-install already in the startup file.
     It will not alter any of your other settings, however.

(q)  Quit and do nothing else.  The function will be run again next time.
--- Type one of the keys in parentheses ---

うわあ、Recommendedが3つもある!
とりあえず1を選択。

History configuration
=====================

# (1) Number of lines of history kept within the shell.
HISTSIZE=1000                                                   (not yet saved)
# (2) File where history is saved.
HISTFILE=~/.histfile                                            (not yet saved)
# (3) Number of lines of history to save to $HISTFILE.
SAVEHIST=1000                                                   (not yet saved)

# (0)  Remember edits and return to main menu (does not save file yet)
# (q)  Abandon edits and return to main menu

--- Type one of the keys in parentheses ---

1はヒストリーの数、2はヒストリーの保存ファイル、3はファイルに記録されるヒストリーの数かな?
0でメニューに戻る、qで変更を破棄。
設定はこのままにして、0を選択。
するとさっきの画面に戻った。今度は2を選択。

The new completion system (compsys) allows you to complete
commands, arguments and special shell syntax such as variables.  It provides
completions for a wide range of commonly used commands in most cases simply
by typing the TAB key.  Documentation is in the zshcompsys manual page.
If it is not turned on, only a few simple completions such as filenames
are available but the time to start the shell is slightly shorter.

You can:
  (1)  Turn on completion with the default options.

  (2)  Run the configuration tool (compinstall).  You can also run
       this from the command line with the following commands:
        autoload -Uz compinstall
        compinstall
       if you don't want to configure completion now.

  (0)  Don't turn on completion.

--- Type one of the keys in parentheses ---

TABキー補完機能に関する設定らしい。
1はデフォルト設定で補完をオン、2は設定をいじる、0は補完機能をオフ。でいいのかな。
1を選択。
またさっきの画面に戻りました。
今度は3を選択。

Default editing configuration
=============================

The keys in the shell's line editor can be made to behave either
like Emacs or like Vi, two common Unix editors.  If you have no
experience of either, Emacs is recommended.  If you don't pick one,
the shell will try to guess based on the EDITOR environment variable.
Usually it's better to pick one explicitly.

# (1) Change default editing configuration
bindkey -e                                                      (not yet saved)

# (0)  Remember edits and return to main menu (does not save file yet)
# (q)  Abandon edits and return to main menu

--- Type one of the keys in parentheses ---

Emacsキーバインドか、Vi風キーバインドか選べる。
bindkey -e というのはEmacs風なので、Vi風に変えよう。
EmacsもViも使ったことがない方にはEmacs風をおすすめします」ってのが気になる。
bindkey -vに設定後、0で戻ります。


以上、1〜3の設定を終え、0で保存・終了。

The function will not be run in future, but you can run
it yourself as follows:
  autoload zsh-newuser-install
  zsh-newuser-install -f

The code added to ~/.zshrc is marked by the lines
# Lines configured by zsh-newuser-install
# End of lines configured by zsh-newuser-install
You should not edit anything between these lines if you intend to
run zsh-newuser-install again.  You may, however, edit any other part
of the file.
%

設定終了。
なお、chshコマンドで/bin/zshを指定すれば、zshが標準のシェルになります。


というわけでzshにスイッチ完了しました。
冒頭の記事を読んだりしながら、使い込んでいきたいです。