Saturday, December 28, 2013

Re: Subj.: Switching keymap while holding Alt

On 28/12/13 12:40, Vandra _ wrote:
>
> I work a lot on documents in Russian but very often I have to switch to
> English to type just a symbol or two. Switching each time with C-^ or
> similar
> is not very convenient. Now when I press Alt+letter, a symbol from extended
> utf8 table appears. But I don't need this at all. What I want is to be
> able to
> letter an English letter with Alt+letter, while typing russian text. Is
> it possible?
>
> Thank you
>
>
Well, in theory it is, but it would require a lot of mappings (at least
52 of them).

I am currently compiling a Russian-French dictionary from four existing
ones, which means that I often have to switch between Cyrillic and Latin
in the middle of a line, sometimes of a sentence. I use a keymap which
suits me, and in addition the following mappings:

:noremap <F8> :let &l:iminsert = ! &l:iminsert<CR>
:inoremap <F8> <C-O>:let &l:iminsert = ! &l:iminsert<CR>
:cnoremap <F8> <C-^>

and the following 'statusline', whose relevant part is the presence or
absence of the keymap name as the leftmost item in the righthand group
(the %k item immediately after %= ) :

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


This way, hitting F8 in any mode toggles between keymap active
(Cyrillic) or inactive (Latin), and the corresponding status is shown on
the status line. In Normal and Insert mode this also switches off (IIUC)
any Input Method which might be active previously (for CJK etc.).


Best regards,
Tony.
--
If you are not for yourself, who will be for you?
If you are for yourself, then what are you?
If not now, when?

--
--
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/groups/opt_out.

No comments: