Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 2/2] Use _multi_parts for scp remote file completion and complete abbrevs



On Oct 13,  7:19pm, Joerg wrote:
}
} This patches uses the function _multi_parts to simplify the code.

I'm not convinced that "simpler" here is equivalent to "correct."  At
the very least the user should get to decide whether he prefers to
know the file type and to have the suffix autoremoved, i.e., the old
behavior should be available via a zstyle.

For one thing, the old behavior was intended to minimize the amount
of useless data the remote system had to send.  There are things it
is "fast enough" to do on the local filesystem that it's too costly
to wait for when it has to be shipped across the network as text.

Also, if you're giving up on the file type suffix, you should remove
the "F" option from the "ls" command that's executed on the remote
system.  I think that's the source of the quoting issue for which
you sent a follow-up patch to _multi_parts; I'm also not sure that
the _multi_parts patch is correct when the pattern is NOT going to be
evaluated on the far end of an ssh.

} With _multi_parts it's easier to do completion of abbreviated path like
} /u/s/d/zsh. So do it.

This doesn't quite work, even if it's worth the overhead.  If I try,
for example:

% scp remote:/u/s/d<TAB>

I get as far as

% scp remote:/usr/s/d

(with cursor on the second slash), and at that point it all stops
working; I can only complete more if I first move the cursor to the
end of the word (to the right of "d") every time.  If I merely
insert an "h" to disambiguate /usr/sbin from /usr/share and hit TAB
with the cursor still on the second slash, I end up going from

% scp remote:/usr/sh/d

to

% scp remote:

_complete_debug says (in part):

: _remote_files:6:then; rempat='\*/usr\*/sh\*' 
: _remote_files:7:then; [[ /usr/sh == (.|..|)/* ]]
: _remote_files:7:then cmdand; rempat='/usr\*/sh\*' 
: _remote_files:8:then; remfiles=: _remote_files:8:then; remfiles=( /usr/share/ 
) 

The trailing "/d" has been lost because the of the cursor placement.



Messages sorted by: Reverse Date, Date, Thread, Author