A simple zaw widget for jumping to git projects

A colleague at work showed me a script he put together to quickly jump to the numerous git projects we work with. It’s based on dmenu and looks rather nice. However, I’d rather have something based on zsh, but when looking around I didn’t find anything that really fit. So, instead I ended up writing a simple widget for zaw.

function magus-git-projs() {
    projs="$(find ~/projs -maxdepth 2 -name .git -exec dirname {} \;)"

function magus-git-projs-cd() {
    zaw-callback-execute "cd ${1}"

function magus-git-projs-edit-first() {
    zaw-callback-replace-buffer "cd ${1}"

zaw-register-src -n git-projs magus-git-projs

I then attached bound it like this

bindkey -M vicmd 'zgp' zaw-git-projs
Leave a comment