fish 導入

導入理由

現状zsh使っているけど、困りもしてないし思い入れも無いので、単なる気分転換での導入です。

導入

# fish入れる
$ brew install fish fzf ghq peco

# 末尾に /usr/local/bin/fish を追加
$ sudo vi /etc/shells

# デフォルトシェルを fish に変更
$ chsh -s /usr/local/bin/fish


# fisherman入れる
$ curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisher

#oh-my-fish入れる
$ curl -L https://get.oh-my.fish | fish
$ omf install bobthefish

# テーマ変更用にフォント入れる
$ git clone https://github.com/powerline/fonts.git
$ cd fonts/
$ ./install.sh
# iTermなどのターミナルの設定画面から直接フォント指定する

# ブラウザからテーマを変更
$ fish_config

pecoでの履歴呼び出し

プラグイン追加

fisher add oh-my-fish/plugin-peco

~/.config/fish/config.fish に設定を書く

function fish_user_key_bindings
  bind \cr 'peco_select_history (commandline -b)'
end

Ctrl + R で履歴を呼び出す。

z / pecoでのディレクトリ移動

fishermanからzをインストール

fisher add jethrokuan/z

~/.config/fish/config.fish に処理を書く

function peco_recentd
        z -l | peco | awk '{ print $2 }' | read recentd
        cd $recentd
        commandline -f repaint
end

バインドを追加

function fish_user_key_bindings
  bind \x1b peco_recentd
end

Ctrl + [ で移動履歴を呼び出す。