Skip to content

Instantly share code, notes, and snippets.

@sh1ma
Created September 20, 2025 06:08
Show Gist options
  • Select an option

  • Save sh1ma/d5a31ca370b79469b3c6749dba586458 to your computer and use it in GitHub Desktop.

Select an option

Save sh1ma/d5a31ca370b79469b3c6749dba586458 to your computer and use it in GitHub Desktop.
(zsh用)fzfとghqを使って `ctrl + ]` 押下時にgitリポがfuzzy searchできるようにするやつ
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