zsh-users
 help / color / mirror / code / Atom feed
* Preserve trailing slash after completing remote path
@ 2021-10-31  2:31 Alan
  2021-10-31  3:48 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Alan @ 2021-10-31  2:31 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

Hi,

I have "unsetopt autoremoveslash" in ~/.zshrc, which prevents the removal
of the trailing slash after directory completion. I would also like this
behavior after completing remote paths to directories, for example:

% rsync server:path/to/directory/

Does anyone know how I get the behavior of "unsetopt autoremoveslash" with
remote paths?

Thanks for your help,
Alan

[-- Attachment #2: Type: text/html, Size: 562 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Preserve trailing slash after completing remote path
  2021-10-31  2:31 Preserve trailing slash after completing remote path Alan
@ 2021-10-31  3:48 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2021-10-31  3:48 UTC (permalink / raw)
  To: Alan; +Cc: Zsh Users

On Sat, Oct 30, 2021 at 7:32 PM Alan <8fvebtoeq87@gmail.com> wrote:
>
> Does anyone know how I get the behavior of "unsetopt autoremoveslash" with remote paths?

Unfortunately the _remote_files function explicitly passes the
autoremove option to compadd, so the only way to get this to work is
to edit or replace that file.

diff --git a/Completion/Unix/Type/_remote_files
b/Completion/Unix/Type/_remote_files
index b537406a0..93e1b7f43 100644
--- a/Completion/Unix/Type/_remote_files
+++ b/Completion/Unix/Type/_remote_files
@@ -85,12 +85,15 @@ if zstyle -T ":completion:${curcontext}:files"
remote-access; then
     remdispf=( ${(M)remdispf:#${~glob[2]}} )
   fi

+  local -a autoremove
+  [[ -o autoremoveslash ]] && autoremove=(-r "/ \t\n\-")
+
   _tags remote-files
   while _tags; do
     while _next_label remote-files expl ${suf:-remote directory}; do
       [[ -n $suf ]] &&
           compadd "$args[@]" "$expl[@]" -d remdispf --
${(q)remdispf%[*=|]} && ret=0
-      compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \
+      compadd ${suf:+-S/} $autoremove "$args[@]" "$expl[@]" -d remdispd \
        -- ${(q)remdispd%/} && ret=0
     done
     (( ret )) || return 0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-31  3:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31  2:31 Preserve trailing slash after completing remote path Alan
2021-10-31  3:48 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).