Thursday, March 22, 2012

Re: Can I map double ()

On 03/22/12 07:18, Constantin Stefanov wrote:
>
> Tim Chase wrote:
>> On 03/22/12 06:42, Constantin Stefanov wrote:
>>> Nothing changed, Esc then up arrow gives strange results.
>>
>> Is this in vim or gvim?
>>
>> I suspect it's (non-g)vim and it's receiving an ANSI escape
>> sequence for the arrow keys. So you'll need to tweak the
>> 'timeoutlen' setting to be more than the time it takes you to hit
>> <esc><esc>, but less than the time it takes you to hit<esc><arrow>.
> Yes, it is vim, not gvim. I know about timeoutlen, but I hoped that
> there is better soultion.

the problem is that in the <esc><left> sequence, terminal Vim
sees "<esc><esc>[D", so the "<esc><esc>" mapping gets triggered
with the side-effect of issuing "[D" (a backwards jump and then a
delete-the-rest-of-the-line). So to distinguish them, you need
to tell how much time goes between the "<esc><esc>" and the
"<esc><left>" which is done via 'timeoutlen'. I'd just reach for
another key rather than messing with <esc><esc>.

Personally, I tend to add the functionality to control+L which
does a refresh anyways:

:nnoremap <C-L> :noh<cr><C-L>

>> You might have better results in gvim (I don't know whether it
>> gets actual key-codes, or they're translated into ANSI escape
>> sequences).
> I do not use gvim, so can't check.

if you don't have it or use it, the issue is somewhat moot there. :-)

-tim


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

No comments: