Created
September 20, 2025 06:08
-
-
Save sh1ma/d5a31ca370b79469b3c6749dba586458 to your computer and use it in GitHub Desktop.
(zsh用)fzfとghqを使って `ctrl + ]` 押下時にgitリポがfuzzy searchできるようにするやつ
This file contains hidden or 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
| function _fzf_cd_ghq() { | |
| local root="$(ghq root)" | |
| local repo="$(ghq list | fzf --preview="ls -AF --color=always ${root}/{1}")" | |
| local dir="${root}/${repo}" | |
| if [[ -z "${repo}" ]]; then | |
| zle reset-prompt | |
| return 0 | |
| fi | |
| [ -n "${dir}" ] && cd "${dir}" | |
| zle accept-line | |
| zle reset-prompt | |
| } | |
| zle -N _fzf_cd_ghq | |
| bindkey "^]" _fzf_cd_ghq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment