diff options
author | Ashley Valent <avalent@atlassian.com> | 2015-02-11 11:22:15 +1100 |
---|---|---|
committer | Ashley Valent <avalent@atlassian.com> | 2015-02-11 11:22:15 +1100 |
commit | 3b6a695b60d81691ab8e31197fc8e0444df0e394 (patch) | |
tree | 84529e1bc0a54cdd9471e53c597e913797c04014 /plugins/dircycle | |
parent | 3ba10ad0a2ed85c26e096126a7899a401cf8f9e7 (diff) | |
parent | ef7e53a78d0e4196c2d1e6e5b268209759d51753 (diff) | |
download | zsh-3b6a695b60d81691ab8e31197fc8e0444df0e394.tar.gz zsh-3b6a695b60d81691ab8e31197fc8e0444df0e394.tar.bz2 zsh-3b6a695b60d81691ab8e31197fc8e0444df0e394.zip |
Merge branch 'master' of github.com:avalent/oh-my-zsh
Diffstat (limited to 'plugins/dircycle')
-rw-r--r-- | plugins/dircycle/dircycle.plugin.zsh | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh index c6b6ba785..1e31105b1 100644 --- a/plugins/dircycle/dircycle.plugin.zsh +++ b/plugins/dircycle/dircycle.plugin.zsh @@ -1,10 +1,37 @@ -## -# dircycle plugin: enables cycling through the directory -# stack using Ctrl+Shift+Left/Right +# enables cycling through the directory stack using +# Ctrl+Shift+Left/Right +# +# left/right direction follows the order in which directories +# were visited, like left/right arrows do in a browser -eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }" +# NO_PUSHD_MINUS syntax: +# pushd +N: start counting from left of `dirs' output +# pushd -N: start counting from right of `dirs' output + +insert-cycledleft () { + emulate -L zsh + setopt nopushdminus + + builtin pushd -q +1 &>/dev/null || true + zle reset-prompt +} zle -N insert-cycledleft -bindkey "\e[1;6D" insert-cycledleft -eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q +0'; zle accept-line }" + +insert-cycledright () { + emulate -L zsh + setopt nopushdminus + + builtin pushd -q -0 &>/dev/null || true + zle reset-prompt +} zle -N insert-cycledright -bindkey "\e[1;6C" insert-cycledright + + +# add key bindings for iTerm2 +if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + bindkey "^[[1;6D" insert-cycledleft + bindkey "^[[1;6C" insert-cycledright +else + bindkey "\e[1;6D" insert-cycledleft + bindkey "\e[1;6C" insert-cycledright +fi
\ No newline at end of file |