wd.plugin.zsh 526 B

1234567891011121314151617181920
  1. #!/bin/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. # Register the function as a Zsh widget
  15. zle -N wd_browse
  16. # Bind the widget to a key combination
  17. bindkey '^G' wd_browse