変数$ROS_PACKAGE_PATH
を使う。
function peco-ros () {
local selected_dir=$(echo ${ROS_PACKAGE_PATH//:/$'\n'} | peco --query "$LBUFFER")
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-ros
bindkey '^[' peco-ros