macのターミナルを変えた話


参考

自分がやったことのメモ

ターミナルのテーマ

"Iceberg"を導入した。
というかすでに導入してたっぽい。

シェルをbashからzshへ変更

macにデフォルトで入っている /bin/zsh ではなく、
ひとまず、最新を導入した。

(1) zshをインストール

$ brew update
$ brew install zsh

(2) /etc/shells にzshのパス /usr/local/bin/zsh を追加。

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
# 追加
/usr/local/bin/zsh

(3) ログインシェルを変更

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

プロンプトを変更

(1) 以下のコマンド2つを実行

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

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

(2) zstyle ':prezto:module:prompt' theme 'sorin'theme の箇所を pure にします。
:prezto:module:prompt という文字列をエディタで検索して、 Prompt の設定場所を探してください。

~/.zpreztorc
#
# Prompt
#

# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':prezto:module:prompt' theme 'pure'

(3) 'syntax-highlighting' \'autosuggestions' \'prompt' \ の上に記載する

# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'syntax-highlighting' \
  'autosuggestions' \
  'prompt' \

nodeを入れている場合

環境パスを通す

nodeが使えるように環境パスを通す。

echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile

zshを初めて使う場合に、nodeのバスが通っていないので、npmとか使えなくなるので通します。
zshの場合
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zprofile