Tuesday, July 18, 2017

Re: set iminsert: why global, not local?

On Tue, Jul 18, 2017 at 6:48 PM, RingoRangoRongo <9876200@gmail.com> wrote:
> Hi,
>
>
> Am I missing something, or is it impossible to set iminsert for a specific buffer only, not for Vim globally?
>
> I mean, I have "set keymap=russian-jcukenmac; set iminsert=0", and if I switch to the Russian keymap via <C-^>, it does affect all open buffers. I tried creating a [conditional] shortcut with "setlocal" but with no success, unfortunately.
>
> Help system suggests remapping <ESC> for INSERT mode like this: "inoremap <ESC> <ESC>:set iminsert=0<CR>" but then another problem arises: in terminal Vim, arrows (and probably not only arrows) stop working in INSERT mode (which is kinda obvious, since they do send <ESC> all the way long: Left is ^[[D, Right is ^[[C, etc). Probably, that's somehow related to timeout settings? Mine are "set timeout timeoutlen=3000 ttimeoutlen=100"
>
> Summing up, my question is if it's possible to limit iminsert to a buffer? Would be grateful for any comments :).

1. 'iminsert' is local to buffer, see :help 'imi'
2.
:setglobal option=value
:setglobal booloption
:setglobal nobooloption
sets only the global default value

:setlocal option=value
:setlocal booloption
:setlocal nobooloption
sets only the local value

:set option=value
:set booloption
:set nobooloption
sets both.

For global-only options, ":setlocal" is not an error, in that case
":set" ":setlocal" and ":setglobal" are synonymous.

3. To tell apart bytes sent as part of keycodes, characters sent as
part of mappings, and characters simply typed, see
:help 'timeout'
:help 'timeoutlen'
:help 'ttimeout'
:help 'ttimeoutlen'

I use
if exists('+timeout')
set timeout timeoutlen=5000 ttimeoutlen=250
endif

Of course, YMMV: use higher values (in milliseconds) if you're a slow
typist or on a slow connection, lower ones if you're impatient.


Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: