Skip to content

Instantly share code, notes, and snippets.

@g-empr
Last active November 23, 2019 05:25
Show Gist options
  • Save g-empr/c3fdfc9e1758bf2c6e2f1f4f75a42c82 to your computer and use it in GitHub Desktop.
Save g-empr/c3fdfc9e1758bf2c6e2f1f4f75a42c82 to your computer and use it in GitHub Desktop.
fish環境構築メモ.

準備

  1. fish本体インストール
brew install fish
  1. デフォルトシェルに指定する
sudo vi /etc/shells
chsh -s /usr/local/bin/fish
exec $SHELL -l
  1. プラグインマネージャ fisher をインストールする
curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisher
  1. テーマをインストール
fisher add oh-my-fish/theme-bobthefish
  1. フォントの設定
git clone https://github.com/powerline/fonts.git
./install.sh

目的のフォントはpowerline/fonts内には格納されていなかったので直接インストールする.

git clone https://github.com/naver/d2codingfont.git

iterm2の Preference>Profile>Text>Font>Change FontD2Coding に変更.
Use a different font for non-ASCII text にチェックを入れたら Non-ASCII Font も同様に設定する.

プラグインの利用

多用コマンド

インストール済みプラグインの確認

fisher ls

プラグインのインストール

fisher add [name-of-plugin]

履歴からディレクトリ移動 - z

fisher add z
z [検索対象ディレクトリ]

z は正常にインストールできないことがあるのでこちらも参照: Z

プロジェクトルートを候補表示 - fish-bd

fisher add 0rax/fish-bd
z [ルートディレクトリ候補]

コマンド履歴検索 - peco+plugin-peco

brew install peco
fisher add oh-my-fish/plugin-peco

Ctrl + R にキーバインド設定.

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

gitのリポジトリ管理 - ghq+peco

ghqはgitのリポジトリ管理ツールで、fishと組み合わせることが多数のリポジトリ管理が楽になる.

brew install ghq

Ctrl + ] にキーバインド設定.

function fish_user_key_bindings
  bind \cr 'peco_select_history (commandline -b)'
  bind \c] peco_select_ghq_repository #ここが追加分
end

ghqの詳しい使い方: ghqでリポジトリ管理とpeco連携で快適git生活

補完可能なコマンドエイリアス - balias

fisher add oh-my-fish/plugin-balias

エイリアスの設定.

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

balias g git #ここが追加分、今回はgitをgコマンドに設定

設定をGUIで開く

fish_config

その他メモ

iTerm2のpaste設定.
Preference>General>Selection>Application in terminal may access clipboardにチェック.
同じく Pointer>Bindings の右クリ設定をコピペに変更.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment