zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Alan <8fvebtoeq87@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Preserve trailing slash after completing remote path
Date: Sat, 30 Oct 2021 20:48:47 -0700	[thread overview]
Message-ID: <CAH+w=7Zs2QAu6_CvRACyhk4PU=0j+XfL0BLJvzG0G8T3DQs+tQ@mail.gmail.com> (raw)
In-Reply-To: <CAL7A0-N0VnNck32DFRCitPZR7x7vYFVtzZGwTjGom2TLA1byYA@mail.gmail.com>

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


      reply	other threads:[~2021-10-31  3:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31  2:31 Alan
2021-10-31  3:48 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Zs2QAu6_CvRACyhk4PU=0j+XfL0BLJvzG0G8T3DQs+tQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=8fvebtoeq87@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).