Mac + ghq + peco — GithubのURLをショートカットで開けるようにする例
動作例
選ぶと
開く
動作環境
Mac + zsh + ghq + peco
手順
- ghq で リモートレポジトリを管理しておく
- こんな感じでレポジトリを ghq 管理に入れるだけ (
ghq get https://github.com/YumaInaura/zsh/
)
- こんな感じでレポジトリを ghq 管理に入れるだけ (
- peco で インクリメンタルサーチする
- zsh の bindkey でショートカットを作る
例
~.zshrc
に以下を追加
_ghq_open() {
if [ ! $(which peco) ]; then echo "You need peco" && exit 1; fi
local remote_repository_web_url=$(ghq list | sed -e 's/^/https:\/\//g' | peco --query="$BUFFER")
if [ ! -z "$remote_repository_web_url" ]; then
BUFFER="open $remote_repository_web_url"
zle accept-line
fi
}
zle -N ghq-open _ghq_open
bindkey '^G^O' ghq-open
ghq list
で得られる一覧の先頭に https://
を付けているだけ
Versions
- Mac OS High Sierra
- zsh 5.5.1 (x86_64-apple-darwin17.5.0)
- ghq version 0.8.0
- peco version v0.5.3 (built with go1.10)
Links
Author And Source
この問題について(Mac + ghq + peco — GithubのURLをショートカットで開けるようにする例), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/7c8f6e5adbb27d73ae12著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .