Update dircycle.plugin.zsh

Added dirhistory-like go up a directory (insert-cycledup) and go down to first child directory (insert-cycleddown).
This commit is contained in:
Kayhan Gültekin
2024-03-18 19:23:30 -04:00
committed by GitHub
parent 0fed36688f
commit 5b217eea49

View File

@@ -43,6 +43,27 @@ insert-cycledright () {
}
zle -N insert-cycledright
insert-cycledup () {
switch-to-dir .. || return
local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycledup
insert-cycleddown () {
switch-to-dir "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return
local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycleddown
# These sequences work for xterm, Apple Terminal.app, and probably others.
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow