水曜日, 3月 12, 2014

Z-Shell user discussion

Z-Shell user discussion



這是 Google 對 http://comments.gmane.org/gmane.comp.shells.zsh.user/13810 的快取。 這是該網頁於 2014年2月18日 17:39:02 GMT 顯示時的快照。 在此期間,目前網頁可能已經變更。 瞭解更多資訊
提示:如要在這個網頁上快速尋找您所搜尋的字詞,請按下 Ctrl+F 鍵或 ⌘-F 鍵 (Mac),然後使用尋找列進行搜尋。

 
Yuri D'Elia | 18 Feb 15:27 2014

cdr completion

With:

autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-default true
zstyle ':completion:*' recent-dirs-insert always

the command:

cdr ~<TAB>

will still try to complete usernames (for the ~user home directory
completion), which is something I'd like to avoid.

Is this avoidable?

Permalink | Reply | 
Peter Stephenson | 18 Feb 16:45 2014

Re: cdr completion

On Tue, 18 Feb 2014 15:27:55 +0100
Yuri D'Elia <wavexx <at> thregr.org> wrote:
> With:
> 
> autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
> add-zsh-hook chpwd chpwd_recent_dirs
> zstyle ':chpwd:*' recent-dirs-default true
> zstyle ':completion:*' recent-dirs-insert always
> 
> the command:
> 
> cdr ~<TAB>
> 
> will still try to complete usernames (for the ~user home directory
> completion), which is something I'd like to avoid.
> 
> Is this avoidable?

Hmm... I think you can turn it off generally with something like

zstyle ':completion::complete:-tilde-::' tag-order named-directories

(allow named directories but not usernames), but so far as I know
there's no way of doing it just after cdr.  The problem is the context
here is a special one, "-tilde-", which replaces the normal command
context, so it no longer cares.  This happens early enough that none of
the special code to do with cdr is ever run.

I don't think it's that difficult to rejig the context in _tilde, which
isn't a particularly big function, so that it does care, by extracting
(Continue reading)

Permalink | Reply | 
Yuri D'Elia | 18 Feb 17:34 2014

Re: cdr completion

On 02/18/2014 04:45 PM, Peter Stephenson wrote:
>> will still try to complete usernames (for the ~user home directory
>> completion), which is something I'd like to avoid.
>>
>> Is this avoidable?
> 
> Hmm... I think you can turn it off generally with something like
> 
> zstyle ':completion::complete:-tilde-::' tag-order named-directories
> 
> (allow named directories but not usernames), but so far as I know
> there's no way of doing it just after cdr.  The problem is the context
> here is a special one, "-tilde-", which replaces the normal command
> context, so it no longer cares.  This happens early enough that none of
> the special code to do with cdr is ever run.

This would be fine for me. The ~username expansion is something I never
ever used.

However the above style doesn't really disable the expansion for me.

Permalink | Reply | 
Peter Stephenson | 18 Feb 17:56 2014

Re: cdr completion

On Tue, 18 Feb 2014 17:34:59 +0100
Yuri D'Elia <wavexx <at> thregr.org> wrote:
> On 02/18/2014 04:45 PM, Peter Stephenson wrote:
> >> will still try to complete usernames (for the ~user home directory
> >> completion), which is something I'd like to avoid.
> >>
> >> Is this avoidable?
> > 
> > Hmm... I think you can turn it off generally with something like
> > 
> > zstyle ':completion::complete:-tilde-::' tag-order named-directories
> 
> This would be fine for me. The ~username expansion is something I never
> ever used.
> 
> However the above style doesn't really disable the expansion for me.

Sorry, try:

zstyle ':completion::complete:-tilde-::' tag-order - named-directories

or perhaps better

zstyle ':completion::complete:-tilde-::' tag-order - \
  'named-directories directory-stack'

instead.  For some reason the other form was working for me, so I failed
to go and read the documentation, which is lethal.  The "-" is needed
to tell it that you *only* want the tags you specify completed.

(Continue reading)

Permalink | Reply | 
Peter Stephenson | 18 Feb 17:56 2014

Re: cdr completion

On Tue, 18 Feb 2014 17:34:59 +0100
Yuri D'Elia <wavexx <at> thregr.org> wrote:
> On 02/18/2014 04:45 PM, Peter Stephenson wrote:
> >> will still try to complete usernames (for the ~user home directory
> >> completion), which is something I'd like to avoid.
> >>
> >> Is this avoidable?
> > 
> > Hmm... I think you can turn it off generally with something like
> > 
> > zstyle ':completion::complete:-tilde-::' tag-order named-directories
> 
> This would be fine for me. The ~username expansion is something I never
> ever used.
> 
> However the above style doesn't really disable the expansion for me.

Sorry, try:

zstyle ':completion::complete:-tilde-::' tag-order - named-directories

or perhaps better

zstyle ':completion::complete:-tilde-::' tag-order - \
  'named-directories directory-stack'

instead.  For some reason the other form was working for me, so I failed
to go and read the documentation, which is lethal.  The "-" is needed
to tell it that you *only* want the tags you specify completed.

(Continue reading)

Permalink | Reply | 
Yuri D'Elia | 18 Feb 17:34 2014

Re: cdr completion

On 02/18/2014 04:45 PM, Peter Stephenson wrote:
>> will still try to complete usernames (for the ~user home directory
>> completion), which is something I'd like to avoid.
>>
>> Is this avoidable?
> 
> Hmm... I think you can turn it off generally with something like
> 
> zstyle ':completion::complete:-tilde-::' tag-order named-directories
> 
> (allow named directories but not usernames), but so far as I know
> there's no way of doing it just after cdr.  The problem is the context
> here is a special one, "-tilde-", which replaces the normal command
> context, so it no longer cares.  This happens early enough that none of
> the special code to do with cdr is ever run.

This would be fine for me. The ~username expansion is something I never
ever used.

However the above style doesn't really disable the expansion for me.

Permalink | Reply | 
Peter Stephenson | 18 Feb 16:45 2014

Re: cdr completion

On Tue, 18 Feb 2014 15:27:55 +0100
Yuri D'Elia <wavexx <at> thregr.org> wrote:
> With:
> 
> autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
> add-zsh-hook chpwd chpwd_recent_dirs
> zstyle ':chpwd:*' recent-dirs-default true
> zstyle ':completion:*' recent-dirs-insert always
> 
> the command:
> 
> cdr ~<TAB>
> 
> will still try to complete usernames (for the ~user home directory
> completion), which is something I'd like to avoid.
> 
> Is this avoidable?

Hmm... I think you can turn it off generally with something like

zstyle ':completion::complete:-tilde-::' tag-order named-directories

(allow named directories but not usernames), but so far as I know
there's no way of doing it just after cdr.  The problem is the context
here is a special one, "-tilde-", which replaces the normal command
context, so it no longer cares.  This happens early enough that none of
the special code to do with cdr is ever run.

I don't think it's that difficult to rejig the context in _tilde, which
isn't a particularly big function, so that it does care, by extracting
(Continue reading)

Permalink | Reply | 


0 件のコメント: