LoginSignup
36
36

More than 5 years have passed since last update.

新しいMBP買ったしoh-my-zshからzplugに乗り換えた話

Last updated at Posted at 2016-11-29

zplugについては作者の記事も参照すると良い。

新しいMBPを購入したので、今までoh-my-zshに全て任せていた設定の勉強を兼ねてzplugに乗り換えてみた。

事前準備

zshのインストールは済んでいるものとする。

プラグインの中でfzyを使用するので、brewでインストールする。

brew tap jhawthorn/fzy
brew install fzy

設定ファイル

色々調べつつ書いた結果、.zshrcは次のようになった。まだまだ多くの便利なプラグインがありそうだが、全部いっぺんに勉強するのも大変なので一旦この程度で。

if [[ ! -d ~/.zplug ]];then
  git clone https://github.com/zplug/zplug ~/.zplug
fi

source ~/.zplug/init.zsh

# enhancd config
export ENHANCD_COMMAND=ed
export ENHANCD_FILTER=ENHANCD_FILTER=fzy:fzf:peco

# Vanilla shell
zplug "yous/vanilli.sh"

# Additional completion definitions for Zsh
zplug "zsh-users/zsh-completions"

# Load the theme.
zplug "yous/lime"

# Syntax highlighting bundle. zsh-syntax-highlighting must be loaded after
# excuting compinit command and sourcing other plugins.
zplug "zsh-users/zsh-syntax-highlighting", nice:9

# ZSH port of Fish shell's history search feature
zplug "zsh-users/zsh-history-substring-search", nice:10

# Tracks your most used directories, based on 'frecency'.
zplug "rupa/z", use:"*.sh"

# A next-generation cd command with an interactive filter
zplug "b4b4r07/enhancd", use:init.sh

# This plugin adds many useful aliases and functions.
zplug "plugins/git",   from:oh-my-zsh

# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo; zplug install
    fi
fi

# Then, source plugins and add commands to $PATH
zplug load --verbose

# Lime theme settings
export LIME_DIR_DISPLAY_COMPONENTS=2

# Better history searching with arrow keys
if zplug check "zsh-users/zsh-history-substring-search"; then
    bindkey "$terminfo[kcuu1]" history-substring-search-up
    bindkey "$terminfo[kcud1]" history-substring-search-down
fi

# Add color to ls command
export CLICOLOR=1

# NeoVim config
export XDG_CONFIG_HOME=$HOME/.xdgconfig

# Load rbenv
if [ -e "$HOME/.rbenv" ]; then
  eval "$(rbenv init - zsh)"
fi

# Set GOPATH for Go
if command -v go &> /dev/null; then
  [ -d "$HOME/go" ] || mkdir "$HOME/go"
  export GOPATH="$HOME/go"
  export GOROOT=/usr/local/opt/go/libexec
  export PATH="$PATH:$GOPATH/bin:$GOROOT/bin"
fi

# Set PATH for GAE
export PATH=$HOME/go/appengine:$PATH

使っているプラグインの説明

yous/vanilli.sh

シェルの設定を色々いい感じにやってくれる。

zsh-users/zsh-completions

補完の強化。

yous/lime

目に優しいシンプルなテーマ。

zsh-users/zsh-syntax-highlighting

コマンドのシンタックスハイライト。

zsh-users/zsh-history-substring-search

コマンド入力中に上キーや下キーを押した際の履歴の検索を使いやすくする。

rupa/z

頻繁に移動している順に検索してディレクトリに移動する「z」コマンド。

b4b4r07/enhancd

次世代のcdコマンド。

plugins/git

gitに関するエイリアス(gaなど)を追加する。


また追加等あれば編集する。

36
36
2

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
36
36