Sunday, January 7, 2018

disable vim default tab mapping in command window

I am trying to disable the default mapping for the tab key to @a<c-x><c-r> in command window. according to :h command-line-window, adding the following two lines in .vimrc should do the job but it doesn't to my test.
au CmdwinEnter [:>] iunmap <Tab>
au CmdwinEnter [:>] nunmap <Tab>

below is the min repo vimrc I observed this behavior.
set nocompatible
au CmdwinEnter [:>] iunmap <Tab>
au CmdwinEnter [:>] nunmap <Tab>

once in command window (either by : then ctrl-f, or q: in normal mode), :map<tab> still shows "n <Tab> @a<C-X><C-V>", which conflicts/overwrites my other mapping for the tab key.

set wildchar=<non-tab> seems to avoid the default mapping, but I do want to use tab for auto-completion in vim. I also tried tightening the scope of non-tab wildchar with
au CmdwinEnter [:>] set wildchar=<C-E>
au CmdwinLeave [:>] set wildchar=<Tab>
but this doesn't work either.

meanwhile, with vim help recommended setting, I always got this error on entering command window:
Error detected while processing CmdwinEnter Auto commands for "[:>]":
E31: No such mapping
Press ENTER or type command to continue

it feels like by the time CmdwinEnter is triggered, the default tab mapping is not injected yet, and somehow it comes in at a later phase, but still before my "set wildchar=<C-E>" takes effect, which is really confusing.

how can I disable them permanently? I am on vim 8.0.1420. thanks.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment