Friday, August 13, 2010

Re: INSERT mode

On 08/13/10 10:45, r48gx wrote:
> For years I have been using vi, and when you move the cursor
> in vim, it stays in insert mode.
>
> Is there anyway vim can be told to leave insert mode when a
> cursor jey is being pressed ?

I suspect it may be a 'timeoutlen'/'ttimeoutlen' issue:

:help 'tm'

which controls how the escape-sequence for arrow keys gets
translated. While I'm not positive, it sounds like you could set
'ttimeoutlen' to 0 to get what may be a similar behavior. This
may also purely be a console thing (you don't explicitly mention
whether you're using vim vs. gvim; nor which OS), but you might try

:set timeout ttimeout timeoutlen=1000 ttimeoutlen=0

and see if that gets the behavior you want. Though even with
that, most connections are fast enough that you may not time-out
(just tested with a remote Linux box and didn't get your desired
behavior because the low-end broadband connection was still too fast)

Alternatively, you can just map them:

:inoremap <left> <esc><left>
:inoremap <right> <esc><right>
...

to force the behavior you want.

As I'm one of those home-row folks, I can't say I use the arrow
keys much at all (mostly because I've been burnt too many times
in the olden days of 1200-baud terminal connections, where
getting functional arrow-keys was pretty hit-or-miss) so I can't
recall what vi(non-m) used to do, nor would I have found either
behavior unexpected.

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