環境
- Ubuntu 20.04
多分Macもいける
やりたいこと
今まではzshのフレームワークでoh-my-zsh使ってたが、起動がやっぱり遅いとかあったのでPreztoに乗り換えてみたメモ
インストール
公式のREADMEやれば問題ない 先にzshはbrewなりaptでインストールしておく必要はある
現状がbashの場合は
zsh
clone
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
設定ファイルを作成 すでに.zshrcがある場合はうまくいかないので事前に退避させておくこと
setopt EXTENDED_GLOB for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" done
成功するとシンボリックリンクがはられていることが確認できる
❯ ls -la | grep zprezto/runcoms lrwxrwxrwx 1 vagrant vagrant 37 May 4 00:48 .zlogin -> /home/vagrant/.zprezto/runcoms/zlogin lrwxrwxrwx 1 vagrant vagrant 38 May 4 00:48 .zlogout -> /home/vagrant/.zprezto/runcoms/zlogout lrwxrwxrwx 1 vagrant vagrant 40 May 4 00:48 .zpreztorc -> /home/vagrant/.zprezto/runcoms/zpreztorc lrwxrwxrwx 1 vagrant vagrant 39 May 4 00:48 .zprofile -> /home/vagrant/.zprezto/runcoms/zprofile lrwxrwxrwx 1 vagrant vagrant 37 May 4 00:48 .zshenv -> /home/vagrant/.zprezto/runcoms/zshenv lrwxrwxrwx 1 vagrant vagrant 36 May 4 00:48 .zshrc -> /home/vagrant/.zprezto/runcoms/zshrc
デフォルトのシェルをzshに変更する
chsh -s /bin/zsh
テーマの変更
デフォルトでいくつか有名どころのテーマがインストールされている
prompt -p
テーマ変更は~/.zpreztorcを編集する 今回はpureに変更した
- zstyle ':prezto:module:prompt' theme 'sorin' + zstyle ':prezto:module:prompt' theme 'pure'
デフォルトのエディタをVimに変更
なぜかデフォルトがnanoになってるので.zprofileを書き換えてvimにしておく
- export EDITOR='nano' - export VISUAL='nano' + export EDITOR='vim' + export VISUAL='vim'
各種設定
現行の.zpreztorc設定は以下
--- .zpreztorc_orig 2022-05-04 12:25:12.000000000 +0900 +++ .zpreztorc 2022-05-04 13:22:01.000000000 +0900 @@ -34,11 +34,11 @@ 'terminal' \ 'editor' \ 'history' \ - 'directory' \ 'spectrum' \ 'utility' \ 'completion' \ 'history-substring-search' \ + 'autosuggestions' \ 'prompt' # @@ -46,7 +46,7 @@ # # Set the query found color. -# zstyle ':prezto:module:autosuggestions:color' found '' +zstyle ':prezto:module:autosuggestions:color' found 'fg=red' # # Completions @@ -61,7 +61,7 @@ # # Set the key mapping style to 'emacs' or 'vi'. -zstyle ':prezto:module:editor' key-bindings 'emacs' +zstyle ':prezto:module:editor' key-bindings 'vi' # Auto convert .... to ../.. # zstyle ':prezto:module:editor' dot-expansion 'yes' @@ -130,7 +130,7 @@ # 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 'sorin' +zstyle ':prezto:module:prompt' theme 'pure' # Set the working directory prompt display length. # By default, it is set to 'short'. Set it to 'long' (without '~' expansion)
詳しく説明すると
- autosuggestionsを有効化
- directoryプラグインは使わないので無効化