On 22/12/11 11:21, Andy Wokula wrote:
Am 22.12.2011 08:43, schrieb Marcin Szamotulski:
Helo vim_use!

I'm trying to make a cmap which maps<tab> to<c-l> but only for the :edit
command. My idea was to use something like:
cnoremap<expr> <tab> getcmdline() =~ '^:\Ce\%[dit]\>' ? "<c-l>" :"<tab>"

Any ideas how to make it work? I tried to use the expression register
(:help
c_CTRL-R_=) but with no success.

Best regards,
Marcin Szamotulski

getcmdline() does not return a leading colon ":" (need to exclude it
from the pattern).

It _is_ possible to test for the colon (and avoid mapping the tab to something else in a search command), but not the way you (Marcin) did it: see :help getcmdtype()

:cnoremap <expr> <tab> getcmdtype() == ':' && getcmdline() ~= etc.


Also, <Tab> in the {rhs} won't work:
:h 'wc
:h 'wcm
e.g. you have to set 'wildcharm' and then use <C-Z>.


Best regards,
Tony.
--
The United States is like the guy at the party who gives cocaine to
everybody and still nobody likes him.
                -- Jim Samuels

--
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

Reply via email to