dircycle.plugin.zsh 648 B

12345678910111213141516171819202122232425
  1. # enables cycling through the directory stack using
  2. # Ctrl+Shift+Left/Right
  3. #
  4. # left/right direction follows the order in which directories
  5. # were visited, like left/right arrows do in a browser
  6. # NO_PUSHD_MINUS syntax:
  7. # pushd +N: start counting from left of `dirs' output
  8. # pushd -N: start counting from right of `dirs' output
  9. setopt nopushdminus
  10. insert-cycledleft () {
  11. builtin pushd -q +1 &>/dev/null || true
  12. zle reset-prompt
  13. }
  14. zle -N insert-cycledleft
  15. insert-cycledright () {
  16. builtin pushd -q -0 &>/dev/null || true
  17. zle reset-prompt
  18. }
  19. zle -N insert-cycledright
  20. bindkey "\e[1;6D" insert-cycledleft
  21. bindkey "\e[1;6C" insert-cycledright