Tuesday, July 18, 2017

Re: set iminsert: why global, not local?

On Tue, Jul 18, 2017 at 8:34 PM, RingoRangoRongo <9876200@gmail.com> wrote:
> Thanks for your reply, Tony!
>
> 1-2. Then I AM missing something, I assume: http://i.imgur.com/1SqcHwW.gif
> Like, why the Russian keymap — even though set locally via "setlocal iminsert=1" — applies to all buffers?
>
> 3. Well, I seem to understand why exactly this behavior happens ("characters [being] simply typed"). What I don't understand, is how to deal with that? Like, if I want to remap <ESC> in INSERT mode, and also want to keep my arrows working, too, for example?
>

'keymap' is also a buffer-local (not window-local) option, you should
also set it by means of :setlocal. IIRC, setting 'keymap' on a given
buffer also sets 'iminsert' to 1 on that same buffer as a side-effect.

My custom 'statusline' setting displays the b:keymap_name when keymaps
are in use (via the %k item) and at the moment, some windows have
that, others not, so it is definitely possible to set it separately
for different buffers. FWIW, here's the 'statusline' I use:

if has('statusline')
set statusline=%<%f\
%h%m%r%=%k[%{(&fenc==''?&enc:&fenc)}%{(&bomb?',BOM':'')}][U+%04B]\
%-12.(%l,%c%V%)\ %P
endif

If, in a given buffer, 'iminsert' is not set locally the way you want
it, you can toggle it by means of the Ctrl-^ keystroke in Insert mode.
That keystroke is hard to get on my keyboard, so I added the following
to my owncoded keymap before the :loadkeymap line:

if mapcheck("<F8>", "nvoicsxl") == ""
map <F8> :let &l:imi = !&l:imi<CR>
sunmap <F8>
map! <F8> <C-O><F8>
cmap <F8> <C-^>
endif

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:

Post a Comment