1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

どこにいても大丈夫!リポジトリURLをpecoって開く

Posted at

デモ

gh-open.gif

必要なもの

設定

次の記述を ~/.zshrc に追記します。他のシェルだと少し記述が異なると思います。

~/.zshrc
function peco-gh () {
  local selected_dir=$(ghq list -p | peco --query "$LBUFFER")
  if [ -n "$selected_dir" ]; then
    BUFFER="gh-open ${selected_dir}"
    zle accept-line
  fi
  zle clear-screen
}
zle -N peco-gh
bindkey '^[' peco-gh

ショートカットはお好みで変更することが可能です。追記後に反映します。

$ source ~/.zshrc

動作

Ctrl+[ で clone したプロジェクトが一覧表示されるので、開きたいものを選択して Enter キーを押すとブラウザからそのリポジトリが開きます。

これはどのディレクトリから実行してもOK。

1
1
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?