There are no actual questions in your submission but one can be inferred: Why doesn't Tab do wildcard expansion with -u NONE
?
-u NONE
prevents any vimrc files from being loaded. That results in default values being used for settings and that includes the Vi compatibility setting 'compatible'
. This will be enabled per :h 'compatible'
. Further, the wildcard expansion key is specified in 'wildchar'
. The Vim default is, of course, <Tab>
but, per :h 'wc'
, the Vi default (applicable because of 'compatible'
) is CTRL-E
. Enter Ctrl+E instead of TAB and expansion should work in that scenario.
BTW, wildcard expansion is really an interactive feature while macros are non-interactive. Except for muscle-memory mistakes there shouldn't be any reason command-line Tabs get entered in your macros.
Update: Addressing questions added after I wrote the preceding...between something that will help you avoid typing TAB or something that will make expansion work the latter is the most realistic (though ill-advised, IMO, except for some specific use cases). In fact, @user938271 gave you a hint about this.
I talked about 'wildchar'
above. Expansion can't reliably be done in deferred/non-interactive contexts (i.e. a macro/mapping) using this mechanism but there is a related setting 'wildcharm'
that provides a means to do so as indicated in the associated help:
'wildcharm' works exactly like 'wildchar', except that it is
recognized when used inside a macro 1. ... Normally you'll never actually type 'wildcharm',
just use it in mappings [and macros].
wildcharm
/wcm
is not set by default so we need to do :set wcm=XXX
replacing XXX
with whatever unused key you prefer, e.g. :set wcm=<Tab>
. (Note: 'wcm'
is supposed to be set to a number but the <FOO>
notation is a legal substitute.) Your issue with macros should be taken care of now.
1Note that Vim documentation has a broader definition of "macro" than some are accustomed to. The term is popularly used most commonly to refer to commands recorded into a register and played back with @
. Vim help files, though, sometimes refer to the RHS of key mappings as macros, too.
set wc=9 wcm=9
. See:h 'wcm
.9
is the decimal code of theTab
character in the ASCII table.set wc=9
is equivalent toset wc=<Tab>
and tells Vim that a Tab character should start a wildcard expansion.set wcm=9
is equivalent toset wcm=<Tab>
and tells Vim that a Tab character should start a wildcard expansion, but inside a mapping or a macro. You can give whatever value you want to both options, however they must be identical.wcm=9
is enough, just likewc
andwcm
are not orthogonal and thatwcm
does something more and nothing less thanwc
. Can you confirm this? And maybe put it in an answer that I can accept.set wcm=9
is enough because<Tab>
is the default value of'wc'
, and because even if you change its value, the Tab key still starts a wildcard expansion (it may be hard-coded in Vim). Try this:set wc=26 wcm=9
(26 is the decimal code ofC-z
), then record your macro by pressingC-z
instead ofTab
. The replay will fail. Now try this:set wc=26 wcm=26
, then record your macro by pressing againC-z
instead ofTab
. This time, the replay will work.:h c_wildchar
:Note: does not work inside a macro, because <Tab> or <Esc> are mostly used as 'wildchar', and these have a special meaning in some macros.
I'm not sure there won't be an issue later. Personally, I never had one, but I don't use macros that much. Use it for some time, and if you never encounter any issue, write an answer. It's fine to answer your own question.