Skip to content

Instantly share code, notes, and snippets.

@azu
Last active February 8, 2017 06:50
Show Gist options
  • Save azu/38579f9bf2bfa7ca606d83be98f1d826 to your computer and use it in GitHub Desktop.
Save azu/38579f9bf2bfa7ca606d83be98f1d826 to your computer and use it in GitHub Desktop.
z.sh to enhancd

z.sh to enhancd

  1. Copy history of z.sh to enhancd.log
cat ~/.z | awk -F "|" '{print $1}' >> ~/.enhancd/enhancd.log
  1. Setup enhancd + peco + shortcut(see config.zsh)

It means that avoid following warning

awk: i/o error occurred while closing /dev/stdin
function peco_select_directory() {
local dest=$(tail -r ~/.enhancd/enhancd.log | peco --query "$LBUFFER")
if [ -n "${dest}" ]; then
BUFFER="cd ${dest}"
zle accept-line
fi
zle clear-screen
}
zle -N peco_select_directory
bindkey '^x;' peco_select_directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment