LoginSignup
22
12

More than 5 years have passed since last update.

Fish, ghq, peco導入

Posted at

SourceTreeが苦手なのでgitコマンドを使いこなせるようになりたいです。
リポジトリが沢山あって大変なのでターミナル環境含めて環境構築をしました。

出来るようになること

  1. リポジトリを一つのディレクトリ配下で集中管理する(ghq)
  2. Ctrl+Gでリポジトリ一覧表示、検索、ディレクトリ移動(fish-ghq + peco)
  3. Ctrl+rでコマンド履歴検索(plugin-peco)
  4. fish_configなどカスタマイズはお好みで

手順

  1. fishインストール
  2. pecoインストール
  3. ghqインストール
  4. ghqで管理するgitディレクトリを設定する
  5. fisher(fisherman)インストール
  6. oh-my-fish/plugin-pecoインストール
  7. コマンド履歴検索のキーバインドを追加(Ctrl+r) (oh-my-fish/plugin-peco)
  8. decors/fish-ghqインストール(キーバインドは標準でCtrl+g)
  9. fish-ghqで利用するSELECTORをpecoに切り替える
  10. ログインシェルを変更する(お好みで)
brew install fish
brew install peco
brew install ghq
git config --global ghq.root ~/git

ghqでリポジトリを管理する、ディレクトリを指定します。~/gitなどお好みで。

curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
fisher add oh-my-fish/plugin-peco
# ~/.config/fish/config.fishに追加
#fisherパッケージoh-my-fish/plugin-pecoの設定
function fish_user_key_bindings
  bind \cr peco_select_history # Bind for prco history to Ctrl+r
end
fisher add decors/fish-ghq
# ~/.config/fish/config.fishに追加
#fisherパッケージdecors/fish-ghqの設定
set GHQ_SELECTOR peco
# 末尾に /usr/local/bin/fish を追加
sudo vi /etc/shells

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

使い方

fisherパッケージマネージャで管理しているパッケージをロードする

fisher

fishシェルを起動後、上記コマンドを実行します。(誰か自動で実行する正しい?方法を知っている方が居たら教えてください)

コマンド履歴を表示する

Ctrl-rでコマンド履歴を表示します。

Gitリポジトリをクローンする

ghq get リポジトリのURL

ghq.rootを設定することで、保存先のディレクトリを意識せず手軽にクローンできます。

Gitリポジトリ一覧を表示する

Ctrl-gでリポジトリの一覧を表示します。

22
12
1

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
22
12