LoginSignup
20
19

More than 5 years have passed since last update.

zsh環境構築

Posted at

zsh

mac標準の zsh はバージョンが古いので Homebrew で最新の zsh をインストールします。
この辺は Brew-file を導入してあれば一発でインストールされます。

zshのインストール

$ brew install zsh

ログインシェルの変更

/etc/shells にインストールした zshPATH を追加する。

/etc/shells
/usr/local/bin/zsh

ログインシェルを変更する。

$ chsh -s /usr/local/bin/zsh

prezto

preztozsh の構成フレームワークです。
特にこだわりなければこれを導入すると幸せになれます。

preztoのインストール

github:prezto

以下を実行し、 ~/preztoclone してくる。(自前の設定とかガリガリ書きたい場合は Fork するのもあり。)

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

完了したら以下のコマンドを実行し、 ~/ 以下にdotfile群を作成する。既に使用しているdotfileが存在する場合は予め退避しておく。

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

preztoのアップデート

$ git pull && git submodule update --init --recursive

zsh-completions

zsh-competionszsh の自動補完機能をより強力にしてくれます。
こちらも Homebrew でインストールします。

zsh-completionsのインストール

github:zsh-completions

$ brew install zsh-completions

.zshrcに設定を追記

~/.zshrc
fpath=(path/to/zsh-completions/src $fpath)

zcompdumpのリビルド

rm -f ~/.zcompdump; compinit

peco

peco は「標準入力から受けた行データをインクリメントサーチして、選択した行を標準出力に返す」というツールです。
こちらも Homebrew でインストール可能です。

pecoのインストール

github:peco

$ brew install peco
20
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
19