On 08/07/09 12:43, Simson Liu wrote:
>
>
> Hello everyone!
>
> I use vim in putty terminal, when I press<Alt>-<[>  key, the putty send
> <Esc><[>  to vim. I hope get<Alt-[>  in vim, so I just set<M-[>, such as
>
> :set<M-a>=^[[


this means "define Alt+a (not Alt+[ ) as Escape-LeftBracket. Alt+[ 
should be <M-[> but in order to use it, you have to determine if your 
terminal sends it. If it does, hitting Ctrl+V followed by Alt+[ in 
Insert mode should insert something at the cursor, probably ^[[ -- if 
nothing is inserted, it means Vim hasn't received anything.

Sending an Escape prefix for Alt keys is rather common; the problem is 
that there's no obvious way to distinguish it from hitting Esc yourself, 
then hitting something else. See also:
        :help map-alt-keys
        :help 'esckeys'
        :help 'ttimeout'
        :help 'ttimeoutlen'

Concerning the latter, and contrary to what the help says is "normal" 
(but in agreement with the "useful" setting mentioned at the end of that 
help paragraph), I recommend to use different timeouts on mappings and 
key codes. I use

        :set timeout timeoutlen=5000 ttimeoutlen=100

which means: time out mappings after 5 seconds, keycodes after one-tenth 
of a second. The actual values to use will depend on your maximum and 
minimum typing speed and on your terminal line speed.


>
> the ^[ is entered by<^-v><Esc>, but this does not the work.
>
> How can I do it?
>
> Thank you!


I'm not sure. My konsole terminal also sends Esc for Alt, and Vim 
confuses it with a genuine Esc. But gvim (which gets Alt as high-bit) 
that problem doesn't happen.


Best regards,
Tony.
-- 
Lost interest?  It's so bad I've lost apathy.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to