Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [RFC][PATCH] Add change-directory() widget function
Marlon Richert wrote on Tue, Apr 20, 2021 at 23:13:35 +0300:
> +++ b/Functions/Zle/change-directory
> @@ -0,0 +1,29 @@
> +zle .push-line-or-edit
> +case $WIDGET in
> + *-upward )
> + if [[ -o autocd ]]; then
Why is the «if» codepath necessary?
> + BUFFER='..'
> + else
> + BUFFER='cd ..'
s/cd/builtin cd/?
Should the -q option be passed to «cd»?
Should any of the words be quoted to protect against global aliases?
Does the existence of CHASE_DOTS / CHASE_LINKS raise any concerns?
Should this be implemented in C so it can call chdir(2) directly without
gymnastics?
Regarding your first post in the thread, lines weren't wrapped,
which made it hard to read.
Daniel
> + fi
> + ;;
> + *-backward )
> + if [[ -o pushdminus ]]; then
> + BUFFER='pushd -1'
> + else
> + BUFFER='pushd +1'
> + fi
> + ;;
> + *-forward )
> + if [[ -o pushdminus ]]; then
> + BUFFER='pushd +0'
> + else
> + BUFFER='pushd -0'
> + fi
> + ;;
> + * )
> + print -u2 'change-directory: widget name should end in -(up|back|for)ward'
> + return 1
> + ;;
> +esac
> +zle .accept-line
> --
> 2.31.1
>
>
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author