wd.plugin.zsh 545 B

1234567891011121314151617181920
  1. #!/usr/bin/env zsh
  2. # WARP DIRECTORY
  3. # ==============
  4. # Jump to custom directories in terminal
  5. # because `cd` takes too long...
  6. #
  7. # @github.com/mfaerevaag/wd
  8. # Handle $0 according to the standard:
  9. # # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
  10. 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
  11. 0="${${(M)0:#/*}:-$PWD/$0}"
  12. eval "wd() { source '${0:A:h}/wd.sh' }"
  13. wd > /dev/null
  14. zle -N wd_browse_widget
  15. zle -N wd_restore_buffer
  16. autoload -Uz add-zle-hook-widget
  17. add-zle-hook-widget line-init wd_restore_buffer