This is a simple tool to select ghq repositories using fzf
The configuration allows users to specify a command for preview and to access non-ghq managed repositories with the same command.
$ brew install yumafuu/tap/ghq-fzf
or manually download from release page.
This tool cannot be used directly because it involves cd operations. The binary _ghq-fzf
will be installed, so you will need to configure your own environment for cd.
# .bashrc or .zshrc
ghq-fzf(){ eval $(_ghq-fzf run) }
And then you can use the following command to select a repository.
$ ghq-fzf
Advanced
# if zsh, ctrl-o is binded to accept-line
ghq-fzf() {
eval $(_ghq-fzf run)
zle accept-line
zle reset-prompt
}
zle -N ghq-fzf
bindkey "^o" ghq-fzf
First look for GHQ_FZF_CONFIG
and if the file is not there, look for it in the following order.
$XDG_CONFIG_HOME/ghq-fzf/config.yaml
$HOME/.config/ghq-fzf/config.yaml
If no file was found, create it in the final hit location.
Below is the content of the YAML file:
This specifies what will be displayed in the fzf preview window. The string configured here will be passed to --preview.
fzf:
preview: "exa --tree -L 2 $(_ghq-fzf fullpath {})"
# preview: "bat $(_ghq-fzf fullpath {})/README.md"
# `_ghq-fzf fullpath` is a helper command designed to obtain the full paths of both ghq-managed directories and any externally configured directories.
Reference: https://github.com/junegunn/fzf#preview-window
showFullpath: true/false
ghq list will show fullpath or not. ( if true, ghq list -p
)
Nested: directories under ghq-managed directories will be added to the list. This is useful for monorepos.
ghq:
showFullpath: true
nested:
- root: ${ghq-repo} # github.com/yumafuu/ghq-fzf
dirs:
- ${dir-name}
Directories not managed by ghq will also be added to the list.
external:
- ~/Downloads
- /Applications
fzf:
# preview: "bat $(_ghq-fzf fullpath {})/README.md"
preview: "exa --tree -L 2 $(_ghq-fzf fullpath {})"
ghq:
showFullpath: false
nested:
- root: github.com/yumafuu/ghq-fzf
dirs:
- src
- .github
external:
- "~/dotfiles"
- "~/dotfiles/nvim"
- "~/Downloads"