Created
June 29, 2024 18:18
-
-
Save kuntau/6d82ea5e653c4833ec32c1c7d658dffa to your computer and use it in GitHub Desktop.
Search code on github with fzf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uses 'gh', 'fzf' and 'bat' | |
gh search code $'#compdef fzf' \ | |
--filename '_fzf' \ | |
--json repository,path \ | |
--jq '.[] | [.repository.nameWithOwner, .path] | @tsv' | | |
fzf --delimiter '\t' --with-nth 1 \ | |
--preview 'gh api --cache 10m repos/{1}/contents/{2} \ | |
--jq .content | base64 --decode | bat --language zsh --number' \ | |
--preview-window 'nohidden:right:wrap:75%' \ | |
--bind 'ctrl-b:execute-silent:gh browse --repo {1} {2}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment