Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KageShiron/3b97d0b0af08acac392df8d376e83865 to your computer and use it in GitHub Desktop.
Save KageShiron/3b97d0b0af08acac392df8d376e83865 to your computer and use it in GitHub Desktop.
function peco_select_ghq
set selected_repository (ghq list -p | peco --query "$LBUFFER")
if [ -n "$selected_repository" ]
cd $selected_repository
echo " $selected_repository "
commandline -f repaint
end
end
function peco_select_ghq_online
if test (count $argv) = 0
set peco_flags --null --layout=bottom-up
else
set peco_flags --null --layout=bottom-up --query "$argv"
end
set token (cat ~/.config/hub | yq -r '.[][0].oauth_token')
curl -u KageShiron:$token "https://api.github.com/user/repos" |
jq -r '.[] | if .private then "[🔑]\(.full_name)NULL-DELIMITER\(.full_name)" else .full_name end' | gsed "s/NULL-DELIMITER/\x0/g" |
peco $peco_flags | read foo
if [ $foo ]
ghq get $foo
end
end
function fish_user_key_bindings
bind \cr peco_select_history # Bind for prco history to Ctrl+r
bind \c] peco_select_ghq # Bind for prco history to Ctrl+]
alias cdg peco_select_ghq_online
end
source /usr/local/opt/asdf/asdf.fish
set -x GOPATH ~/s/
set -x PATH $GOPATH/bin $PATH
set -x GO111MODULE on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment