zsh-users
 help / color / mirror / code / Atom feed
* _files with match-specs
@ 2015-05-06  3:48 Eric Cook
  2015-05-07  0:48 ` Daniel Shahaf
  2015-05-11  4:02 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Cook @ 2015-05-06  3:48 UTC (permalink / raw)
  To: zsh-users

Hey,
Not sure if i am doing something incorrect here but:

% _foo() _files -M 'L:|+='; compdef _foo foo

then
% foo +<tab>
Complete files, but removes the leading +.

When i give the same match-spec to compadd directly, it works as i expected.

% _foo() compadd -M 'L:|+=' -- *(N); compdef _foo foo

then
% foo +<tab>

Is the behavior of _files expected? If so, how should I go about
completing filenames, ignoring a possible leading + character?


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

* Re: _files with match-specs
  2015-05-06  3:48 _files with match-specs Eric Cook
@ 2015-05-07  0:48 ` Daniel Shahaf
  2015-05-07  2:39   ` Eric Cook
  2015-05-11  4:02 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2015-05-07  0:48 UTC (permalink / raw)
  To: Eric Cook; +Cc: zsh-users

Eric Cook wrote on Tue, May 05, 2015 at 23:48:38 -0400:
> Hey,
> Not sure if i am doing something incorrect here but:
> 
> % _foo() _files -M 'L:|+='; compdef _foo foo
> 
> then
> % foo +<tab>
> Complete files, but removes the leading +.
> 
> When i give the same match-spec to compadd directly, it works as i expected.
> 
> % _foo() compadd -M 'L:|+=' -- *(N); compdef _foo foo
> 
> then
> % foo +<tab>
> 
> Is the behavior of _files expected?

Don't know.

> If so, how should I go about completing filenames, ignoring a possible
> leading + character?

'_f() { compset -P +; _files }', perhaps?

Daniel


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

* Re: _files with match-specs
  2015-05-07  0:48 ` Daniel Shahaf
@ 2015-05-07  2:39   ` Eric Cook
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Cook @ 2015-05-07  2:39 UTC (permalink / raw)
  To: zsh-users

On 05/06/2015 08:48 PM, Daniel Shahaf wrote:

>> If so, how should I go about completing filenames, ignoring a possible
>> leading + character?
> 
> '_f() { compset -P +; _files }', perhaps?
> 
> Daniel
> 
Ah, I forgot about compset. That works for the use case that I had.

Thank you.


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

* Re: _files with match-specs
  2015-05-06  3:48 _files with match-specs Eric Cook
  2015-05-07  0:48 ` Daniel Shahaf
@ 2015-05-11  4:02 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2015-05-11  4:02 UTC (permalink / raw)
  To: zsh-users

On May 5, 11:48pm, Eric Cook wrote:
}
} % _foo() _files -M 'L:|+='; compdef _foo foo
} 
} then
} % foo +<tab>
} Complete files, but removes the leading +.

Hm.  It's happening because _path_files passes (-p '') to compadd.  I've
not yet further investigated why the -p (hidden-prefix) option has this
interaction with -M (matcher-list), perhaps someone else has insight.


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

end of thread, other threads:[~2015-05-11  4:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06  3:48 _files with match-specs Eric Cook
2015-05-07  0:48 ` Daniel Shahaf
2015-05-07  2:39   ` Eric Cook
2015-05-11  4:02 ` 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).