Recently, I tried searching for a css file by typing
css, and I discovered that the
cs mapping provided by vim-surround was putting
me in normal mode in the search buffer, instead of typing
cs! (the ds and
ys mappings are also affected)
I took a look at
CommandT::Controller#register_for_key_presses, but I didn't
see any obvious reason why the vim-surround mappings weren't
being overridden. But, I haven't spent a lot of time digging
into the nuances of Vimscript or the vim mappings system, so
the reason may actually be obvious.
The issue occurs in both urxvt and Terminal.app, where
set term? is screen-256color-bce, rxvt-unicode,
I'm a vim-surround user too and haven't seen what you
describe, so it must be something local to your set-up. I just
tried to reproduce it and typing "css" at the
Command-T prompt just searches for "css".
Command-T doesn't try to override any existing mappings
— that would be impossible seeing as it can't know what
different mappings people have set up and it wouldn't make
sense to try — but it does add its own mappings.
Can you paste your .vimrc up somewhere so that we
can look at? It seems likely to me that the cause is somewhere
in there. Also, how did you install vim-surround and what
version is it?
Instead of setting notimeout, have you considered
setting a high timeoutlen?
I have a hunch that that might fix the problem you're seeing
without breaking your Emacs-style mappings (I could be wrong
though, it's just a hunch).
If you look in the Command-T source, specifically the
MatchWindowclass, you'll see that inside the match window it sets the
timeoutlen to 0 in order to make the
keys respond immediately; my suspicion is that by setting
notimeout you prevent the
timeoutlen for having effect.
If the suggested work around doesn't work for you we can look
at other alternatives (Command-T, for example, could be
patched to set timeout whenever the match window
is displayed, and restore it to its previous value
Thanks for the patch. Looks sane enough. I can't really see
any drawbacks to applying it, so will do so tomorrow.
I run into this problem as well and discovered another bug. If
you open the command-T and midstream decide to cancel (CTRL-C,
i.e., not to open a file), the settings are never restored.
Since the settings are saved and timeoutlen is changed to 0,
after I cancel, my mappings don't work anymore (cuz the
timeout len is still 0 and never restored to my original set
value). Can you issue a patch for that? Thanks. Rick