Re: Commandmode autocomplete

30 views
Skip to first unread message

bilibop project

unread,
Oct 9, 2012, 5:45:58 PM10/9/12
to vim...@googlegroups.com
Hi,

> When doing ":e /var/<tab>", Vim will pause for input after the first match, eg. "/var/X11/".
> Further presses of tab will scroll through the other directories under /var. In order to go
> through the files under /var/X11, however, one could have, at the point of ":e /var/X11/":
>
> * Type '/' and then tab, resulting in ":e /var/X11//<first file>".
>
> or
>
> * Type <ctrl-d><tab>.
>
> The latter results in a tidier command line because it doesn't show a double forward-slash,
> but a messier main window, because all /var/X11's files are listed.
>
> I know having a double forward-slash is a minor thing, but it makes me feel that there's
> another keypress I don't know about, that tells Vim to start looking in this directory
> -- is there?

Yes it is: any of the the right arrow or down arrow keys
But I didn't know the hint with <ctrl-d>. Nice.

good night
quidame

Tony Mechelynck

unread,
Oct 10, 2012, 12:16:24 AM10/10/12
to vim...@googlegroups.com, bilibop project
Not "any of". Here at least, Right-arrow works like Tab with 'wildmenu'
on, or does nothing with 'wildmenu' off.

:e /var/<Tab>
→ :e /var/X11R6/
→ :e /var/adm/
→ :e /var/cache/
→ :e /var/crash/
→ :e /var/db/
→ :e /var/games/
↓ :e /var/games/atc_score
→ :e /var/games/battlestar.log
→ :e /var/games/cfscores
→ :e /var/games/criblog
→ :e /var/games/emacs/
↓ :e /var/games/emacs/snake-scores
→ :e /var/games/emacs/tetris-scores
↑ :e /var/
→ :e /var/X11R6/

The details may depend on your settings for 'wildmode' 'wildmenu' and
'wildchar'. I use
:set wildmenu wildmode=longest:full,full


Best regards,
Tony.
--
Etymology, n.:
Some early etymological scholars came up with derivations that
were hard for the public to believe. The term "etymology" was formed
from the Latin "etus" ("eaten"), the root "mal" ("bad"), and "logy"
("study of"). It meant "the study of things that are hard to swallow."
-- Mike Kellen

Paul

unread,
Oct 10, 2012, 10:28:36 AM10/10/12
to vim...@googlegroups.com
On 09/10/12 23:45, bilibop project wrote:
>Yes it is: any of the the right arrow or down arrow keys

Ah, down, I didn't know about that.

On Wednesday, 10 October, 2012 at 05:16:24 BST, Tony Mechelynck wrote:
>Not "any of". Here at least, Right-arrow works like Tab with
>'wildmenu' on, or does nothing with 'wildmenu' off.

Same here, I also use wildmenu.

--

.

bilibop project

unread,
Oct 10, 2012, 5:33:51 PM10/10/12
to vim...@googlegroups.com
Hi,

--------message d'origine --------
De: Tony Mechelynck <antoine.m...@gmail.com>
Sujet: Re: Commandmode autocomplete
Date: Wed, 10 Oct 2012 06:16:24 +0200

> >> When doing ":e /var/<tab>", Vim will pause for input after the first match, eg. "/var/X11/".
> >> Further presses of tab will scroll through the other directories under /var. In order to go
> >> through the files under /var/X11, however, one could have, at the point of ":e /var/X11/":
> >>
> >> * Type '/' and then tab, resulting in ":e /var/X11//<first file>".
> >>
> >> or
> >>
> >> * Type <ctrl-d><tab>.
> >>
> >> The latter results in a tidier command line because it doesn't show a double forward-slash,
> >> but a messier main window, because all /var/X11's files are listed.
> >>
> >> I know having a double forward-slash is a minor thing, but it makes me feel that there's
> >> another keypress I don't know about, that tells Vim to start looking in this directory
> >> -- is there?
> >
> > Yes it is: any of the the right arrow or down arrow keys
> > But I didn't know the hint with <ctrl-d>. Nice.

> Not "any of". Here at least, Right-arrow works like Tab with 'wildmenu'
> on, or does nothing with 'wildmenu' off.

hmm... *does nothing with 'wildmenu' off* and surely something else different
from the defaults. Try this and see:
vim -Nu NONE

> The details may depend on your settings for 'wildmode' 'wildmenu' and
> 'wildchar'. I use
> :set wildmenu wildmode=longest:full,full

Yes, sure, and... something else ?
There are so many things and behaviours that can be customized in Vim!
Sometimes, refer to the default settings can help much more than give incomplete
- and useless - information. Can you say me what, in your settings, can disable the
Right-arrow behaviour for commandmode completion ? It seems it is not your
'wildmode' setting, because
vim -Nu NONE -c "set wildmode=longest:full,full"
gives me the same result: Right-arrow works as Down-arrow.

Cheers,
quidame

Christian Brabandt

unread,
Oct 11, 2012, 2:37:27 AM10/11/12
to vim...@googlegroups.com
On Wed, October 10, 2012 23:33, bilibop project wrote:
>> Not "any of". Here at least, Right-arrow works like Tab with 'wildmenu'
>> on, or does nothing with 'wildmenu' off.
>
> hmm... *does nothing with 'wildmenu' off* and surely something else
> different
> from the defaults. Try this and see:
> vim -Nu NONE

What you mean with something different from the the defaults?
with :set nowildmenu using the right-arrow does *not* complete anything.
And when it is set, <Right> moves to the next match, as given in the
documentation.

> Sometimes, refer to the default settings can help much more than give
> incomplete
> - and useless - information. Can you say me what, in your settings, can
> disable the
> Right-arrow behaviour for commandmode completion ?

It is not useless, but should be the default, according to the
documentation.
It could be, that your terminal cannot correctly distinguish <Right> from
<Down>, to verify this, enter :<Ctrl>V and see what keycodes are given
when pressing <Down> and <Right> (e.g. for my terminal it is ^[OC for
<Right> and ^[OB for <Down>), but I am only guessing, because I don't know
nothing about your environment.

> It seems it is not your
> 'wildmode' setting, because
> vim -Nu NONE -c "set wildmode=longest:full,full"
> gives me the same result: Right-arrow works as Down-arrow.

It does not here and works as described in the documentation.

If you want to disable the function of <Right> for the wildmenu,
see the help at :h 'wildmenu'

regards,
Christian

bilibop project

unread,
Oct 11, 2012, 9:31:59 AM10/11/12
to vim...@googlegroups.com
Hi,

--------message d'origine --------
De: "Christian Brabandt" <cbl...@256bit.org>
Sujet: Re: Commandmode autocomplete
Date: Thu, 11 Oct 2012 08:37:27 +0200

> >> Not "any of". Here at least, Right-arrow works like Tab with 'wildmenu'
> >> on, or does nothing with 'wildmenu' off.
> >
> > hmm... *does nothing with 'wildmenu' off* and surely something else
> > different
> > from the defaults. Try this and see:
> > vim -Nu NONE
>
> What you mean with something different from the the defaults?
> with :set nowildmenu using the right-arrow does *not* complete anything.
> And when it is set, <Right> moves to the next match, as given in the
> documentation.

The Vim default settings are obtained with:
$ vim -Nu NONE
or, for gvim:
$ gvim -NU NONE
according to the documentation (manpage); and not by just running vim
loading a complex config file and then reset only one setting or another
to its default value.

> > Sometimes, refer to the default settings can help much more than give
> > incomplete
> > - and useless - information. Can you say me what, in your settings, can
> > disable the
> > Right-arrow behaviour for commandmode completion ?
>
> It is not useless, but should be the default, according to the
> documentation.

Can you quote me this part of the documentation ? I don't remember have
read somewhere that the Right-arrow is disabled when default settings are
applied, but just that 'wildmenu' gives it a specific behaviour.

> It could be, that your terminal cannot correctly distinguish <Right> from
> <Down>, to verify this, enter :<Ctrl>V and see what keycodes are given
> when pressing <Down> and <Right> (e.g. for my terminal it is ^[OC for
> <Right> and ^[OB for <Down>), but I am only guessing, because I don't know
> nothing about your environment.

xfce4-terminal, xterm and any VT (<Ctrl-Alt-Fn>) give me the same:
^[[B for <Down>
^[[C for <Right>
And in any of them:
1. <Down> and <Right> work as expected when 'wildmenu' is on:
<Right> works as <CTRL-P>
<Down> move into a subdirectory or submenu.
2. <Down> and <Right> have the same behaviour when 'wildmenu'
is off: as for <Down> when 'wildmenu' is on.

> > It seems it is not your
> > 'wildmode' setting, because
> > vim -Nu NONE -c "set wildmode=longest:full,full"
> > gives me the same result: Right-arrow works as Down-arrow.
>
> It does not here and works as described in the documentation.

again, quote me this part of the documentation or point me to it.
Have you even tried to verify your assertions without loading your
system/user vimrc ?
I guess you use the <Right> key in a mapping or something like that;
or maybe you should set t_kr...

> If you want to disable the function of <Right> for the wildmenu,
> see the help at :h 'wildmenu'

Thank you, but I know it, and I don't want to disable <Right> for
the wildmenu. I just say and insist: at least for me, <Right> works
as <Down> in commandmode completion when 'wildmenu' is off
(and no vimrc is loaded).

> regards,
> Christian

Cheers,
quidame

Christian Brabandt

unread,
Oct 11, 2012, 9:46:40 AM10/11/12
to vim...@googlegroups.com
[quoting repaired]
On Thu, October 11, 2012 15:31, bilibop project wrote:
>> Christian Brabandt wrote:
>> What you mean with something different from the the defaults?
>> with :set nowildmenu using the right-arrow does *not* complete anything.
>> And when it is set, <Right> moves to the next match, as given in the
>> documentation.
>
> The Vim default settings are obtained with:
> $ vim -Nu NONE
> or, for gvim:
> $ gvim -NU NONE
> according to the documentation (manpage); and not by just running vim
> loading a complex config file and then reset only one setting or another
> to its default value.

That didn't answer my question. Do you see something different then
the default:
when wildmenu is on:
<Right> moves to the next match
and when it is not set, it does not complete anything.
That is exactly what is mentioned in the documentation.

>> > Sometimes, refer to the default settings can help much more than give
>> > incomplete
>> > - and useless - information. Can you say me what, in your settings,
>> can
>> > disable the
>> > Right-arrow behaviour for commandmode completion ?
>>
>> It is not useless, but should be the default, according to the
>> documentation.
>
> Can you quote me this part of the documentation ? I don't remember have
> read somewhere that the Right-arrow is disabled when default settings are
> applied, but just that 'wildmenu' gives it a specific behaviour.

,----[ :h 'wildmenu' ]-
| <Left> <Right> - select previous/next match (like CTRL-P/CTRL-N)
`----
,----[ :h c_<Right> ]-
| *c_<Right>* *c_Right*
| <Right> cursor right
`----

>
>> It could be, that your terminal cannot correctly distinguish <Right>
>> from
>> <Down>, to verify this, enter :<Ctrl>V and see what keycodes are given
>> when pressing <Down> and <Right> (e.g. for my terminal it is ^[OC for
>> <Right> and ^[OB for <Down>), but I am only guessing, because I don't
>> know
>> nothing about your environment.
>
> xfce4-terminal, xterm and any VT (<Ctrl-Alt-Fn>) give me the same:
> ^[[B for <Down>
> ^[[C for <Right>
> And in any of them:
> 1. <Down> and <Right> work as expected when 'wildmenu' is on:
> <Right> works as <CTRL-P>
> <Down> move into a subdirectory or submenu.
> 2. <Down> and <Right> have the same behaviour when 'wildmenu'
> is off: as for <Down> when 'wildmenu' is on.
>
>> > It seems it is not your
>> > 'wildmode' setting, because
>> > vim -Nu NONE -c "set wildmode=longest:full,full"
>> > gives me the same result: Right-arrow works as Down-arrow.
>>
>> It does not here and works as described in the documentation.
>
> again, quote me this part of the documentation or point me to it.

see above.

> Have you even tried to verify your assertions without loading your
> system/user vimrc ?

Of course I have on Windows as on Linux.

> I guess you use the <Right> key in a mapping or something like that;
> or maybe you should set t_kr...

As I said, I used the default vim -u NONE -N

regards,
Christian

Gary Johnson

unread,
Oct 11, 2012, 3:38:25 PM10/11/12
to vim...@googlegroups.com
On 2012-10-11, bilibop project wrote:

> The Vim default settings are obtained with:
> $ vim -Nu NONE
> or, for gvim:
> $ gvim -NU NONE

For the record, this is incorrect for -U. The -U option does not
obtain all default settings, it obtains default _GUI_ settings. You
can see this for yourself by starting gvim as "gvim -NU NONE" and
then executing ":scriptnames".

The documentation of -U and gui-init is not as clear as it could be
on this point, but towards the bottom of ":help gui-init" it does
say,

All this happens AFTER the normal Vim initializations, like
reading your .vimrc file. See |initialization|.

Also see ":help startup" and note that GUI initialization does not
occur until step #8.

If you wish to start gvim without sourcing any configuration files*,
use

gvim -Nu NONE

just as you would for vim.

Regards,
Gary

----------
* Except menu.vim and autoload/paste.vim.

bilibop project

unread,
Oct 11, 2012, 5:23:49 PM10/11/12
to vim...@googlegroups.com
Hi again,

--------message d'origine --------
De: "Christian Brabandt" <cbl...@256bit.org>
Sujet: Re: Commandmode autocomplete
Date: Thu, 11 Oct 2012 15:46:40 +0200

It seems we are agree about the <Right> behaviour when 'wildmenu' is on.

> > Can you quote me this part of the documentation ? I don't remember have
> > read somewhere that the Right-arrow is disabled when default settings are
> > applied, but just that 'wildmenu' gives it a specific behaviour.
>
> ,----[ :h 'wildmenu' ]-
> | <Left> <Right> - select previous/next match (like CTRL-P/CTRL-N)
> `----

Yes, I know.

> ,----[ :h c_<Right> ]-
> | *c_<Right>* *c_Right*
> | <Right> cursor right
> `----

Yes, I know. But what can happen when the cursor is already at the end
of the line ? On your systems, nothing; but on mine, <Right> works like
<Down>... my apologies, but I'm not responsible of this fact, even if it
not documented. I just say it exists on my Debian system with Vim version
7.3.547-4.

> > Have you even tried to verify your assertions without loading your
> > system/user vimrc ?
>
> Of course I have on Windows as on Linux.

OK. In that case the solution about the different behaviours of the <Right>
key should come from out of the box. Maybe readline settings or terminfo
or something else... (I have made some tests with different settings in my
.inputrc, with 'convert-meta' on/off and some others, but nothing: in my
case <Right> is useful in commandmode completion, that's all; I will surely
not complain about that).

Cheers,
quidame

Tony Mechelynck

unread,
Oct 11, 2012, 6:52:57 PM10/11/12
to vim...@googlegroups.com, bilibop project
On 11/10/12 23:23, bilibop project wrote:
> Hi again,
>
> --------message d'origine --------
> De: "Christian Brabandt" <cbl...@256bit.org>
> Sujet: Re: Commandmode autocomplete
> Date: Thu, 11 Oct 2012 15:46:40 +0200
>
> It seems we are agree about the <Right> behaviour when 'wildmenu' is on.
>
>>> Can you quote me this part of the documentation ? I don't remember have
>>> read somewhere that the Right-arrow is disabled when default settings are
>>> applied, but just that 'wildmenu' gives it a specific behaviour.
>>
>> ,----[ :h 'wildmenu' ]-
>> | <Left> <Right> - select previous/next match (like CTRL-P/CTRL-N)
>> `----
>
> Yes, I know.
>
>> ,----[ :h c_<Right> ]-
>> | *c_<Right>* *c_Right*
>> | <Right> cursor right
>> `----
>
> Yes, I know. But what can happen when the cursor is already at the end
> of the line ? On your systems, nothing; but on mine, <Right> works like
> <Down>... my apologies, but I'm not responsible of this fact, even if it
> not documented. I just say it exists on my Debian system with Vim version
> 7.3.547-4.

AFAIK, with 'wildmenu' on, when the cursor is already at the end of the
statusline you get one further screenwidth of menuitems if there are
any; and when it is on the last menuitem, <Right> brings you to what you
typed with no completion, and <Right> again wraps around to the first
menuitem. Except that if there is only a single matching completion,
<Tab> adds it on the commandline and no menu appears.

Debian is infamous for bringing so-called "improvements" to software,
even sometimes breaking the functionality desired by the software's
author, and without making it obvious what changes they brought. (Part,
but not all, of the Firefox-Thunderbird-SeaMonkey vs.
Iceweasel-Icedove-Iceape contestation was about this behaviour.) I
wonder what you would see with a Vim built from Bram's authentic
sources. See the following HowTo pages:

http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

Also, even if Debian didn't break Vim this time, the current patchlevel
is 7.3.687; patch 547 was published a little more than 4 months ago.
Maybe the bug was fixed in the meantime? See
http://ftp.vim.org/pub/vim/patches/7.3/README for a one-line summary of
every official patch to Vim 7.3.

>
>>> Have you even tried to verify your assertions without loading your
>>> system/user vimrc ?
>>
>> Of course I have on Windows as on Linux.
>
> OK. In that case the solution about the different behaviours of the <Right>
> key should come from out of the box. Maybe readline settings or terminfo
> or something else... (I have made some tests with different settings in my
> .inputrc, with 'convert-meta' on/off and some others, but nothing: in my
> case <Right> is useful in commandmode completion, that's all; I will surely
> not complain about that).
>
> Cheers,
> quidame
>


Best regards,
Tony.
--
Every successful person has had failures but repeated failure is no
guarantee of eventual success.

Reply all
Reply to author
Forward
0 new messages