On 18Mar2010, at 22:30, Tony Mechelynck wrote:

>> <snip>
>> I had already tried
>> 
>> :set keymap=
>> and
>> :set keymap=""
>> without success.  But your
>> 
>> :let&keymap=""
>> 
>> (adding a second double quote) worked.
>> 
>> Many thanks,
>> 
>> Ken

[Tony responds]
> 
> The results of
> 
>       :set keymap=
> and of
>       :let &keymap = ""
> 
> ought to be identical.

Hello Tony,

Thanks for your expert help.

Yes, you're right of course.  My :set keymap commands are really inside nmap 
and imap definitions
(see below, from my .gvimrc file) and I had neglected to add the <Enter> after  
:set keymap =.

nmap ,d       :set keymap=deseret-sampa_utf-8<Enter>
imap ,d  <Esc>:set keymap=deseret-sampa_utf-8<Enter>a

nmap ,s       :set keymap=shavian-sampa_utf-8<Enter>
imap ,s  <Esc>:set keymap=shavian-sampa_utf-8<Enter>a

nmap ,i       :set keymap=ipa-sampa_utf-8<Enter>
imap ,i  <Esc>:set keymap=ipa-sampa_utf-8<Enter>a

nmap ,h       :set keymap=hopi-postfix_utf-8<Enter>
imap ,h  <Esc>:set keymap=hopi-postfix_utf-8<Enter>a

nmap ,x       :set keymap=shoshoni_utf-8<Enter>
imap ,x  <Esc>:set keymap=shoshoni_utf-8<Enter>a

nmap ,n       :set keymap=navajo-postfix_utf-8<Enter>
imap ,n  <Esc>:set keymap=navajo-postfix_utf-8<Enter>a

nmap ,m       :set keymap=mxedruli-translit_utf-8<Enter>
imap ,m  <Esc>:set keymap=mxedruli-translit_utf-8<Enter>a

nmap ,v       :set keymap=venda-postfix_utf-8<Enter>
imap ,v  <Esc>:set keymap=venda-postfix_utf-8<Enter>a

nmap ,t       :set keymap=tswana-postfix_utf-8<Enter>
imap ,t  <Esc>:set keymap=tswana-postfix_utf-8<Enter>a


" toggle keymaps (to previous and back) N.B. <C-^> works only in Insert mode
"   and in command-line mode
nmap ,.  i<C-^><Esc>
imap ,.   <C-^>
cmap ,.   <C-^>

" reset the keymap to null/neutral/no-keymap
nmap ,,          :set keymap=""
imap ,, <Esc>:set keymap=""<Enter>a

" I had left off the <Enter> here ^^^^^

*********************************************************************

I'm a linguist, and I often text-edit papers where I have to juggle at least 
three scripts:  Standard English Orthography, International Phonetic Alphabet, 
and one more (I'm currently working with the Deseret Alphabet).  The toggling 
<C-^> behavior doesn't always serve my intuitive needs.

So I use the command ,i (comma-i) to activate the IPA keymap,  
                                         ,d (comma d) to activate the Deseret 
Alphabet keymap, or ,s to activate the Shavian Alphabet, etc.
                                         ,.   (comma period) to toggle (not so 
much used now)
         and now                ,,   (comma comma) to revert back to the 
neutral keymap


> <snip>
> 
> 
> Note that since 'keymap' is a buffer-local option, it is recommended to set 
> it using ":setlocal" if you want to set it for one file without clobbering 
> other present and future files' setting.

I generally edit one buffer at a time, but I'll consider changing all my :set 
commands above to :setlocal


> In Normal mode, Ctrl-^ has a different meaning. To toggle (from Normal mode) 
> whether keymaps will apply (in the current buffer) to the argument of r f t F 
> T etc. (as well as the next time you start Insert mode), you can use
>       :let &l:imi = !&l:imi
> (see :help 'iminsert')

I don't quite understand what this does--I'll need to study it.

At some point, I did discover that Ctrl-^ had a different meaning in Normal 
mode, and my own solution was this

nmap ,.  i<C-^><Esc>

So that <C-^> simply toggles the keymap even in Normal mode.  I sometimes need 
to change the keymap before starting a search.


> 
> assuming that you aren't using an Input Method (you cannot use both an IM and 
> a keymap in the same buffer at the same time anyway).

The terminology changes from one operating system to another, and from one 
editor to another.  My vim keymaps use a lot of dead-key input sequences, and I 
think of them as "tokenizing input methods", though I know that "Input Method" 
has another meaning in Vim.  My keymaps deterministically "tokenize" a stream 
of keyboard events into a stream of Unicode characters, and the mappings can be 
one-to-one, one-to-many, or many-to-one.  For my own convenience, my keymaps 
are usually SAMPA-based, so that when I type the T key on my keyboard, 

If the mxedruli keymap is active, I get the mxedruli /t/ character
If the Deseret keymap is active, I get the Deseret /t/ character
If the Shavian keymap is active, I get the Shavian /t/ character
etc.

Input sequences (involving dead keys) are widely used to add diacritics, 
including Unicode Combining Diacritical Marks.

************** A testimonial

For my own linguistic editing needs, the combination of MacVim (gvim), keymaps, 
and the DejaVu Sans Mono font (augmented as necessary) is the best solution 
that I have found:

1.  It's unusually easy to write and edit vim keymap files (compared to Java 
Input Methods, Apple Input Methods, etc.).  Yudit kmap and Simredo .kmp files 
are similar, but if you use vim or emacs, Yudit and Simredo hardly seem like 
text editors at all.
2.  keymap files easily handle input sequences with dead keys, even multiple 
dead keys
3.  gvim with DejaVu Sans Mono does a reasonable job of rendering letters with 
Combining Diacritical Marks (even stacks of two diacritics, which I need)
4.  with nmap and imap abbreviations, I can switch rapidly from one keymap to 
another while keeping my hands on the keyboard

The alternatives that I know of all have serious failings in one or more of 
these areas.

Thanks again for all your help, and to all who made sophisticated Unicode 
editing possible in (g)Vim.

Ken


******************************
Kenneth R. Beesley, D.Phil.
P.O. Box 540475
North Salt Lake, UT
84054  USA





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

To unsubscribe from this group, send email to 
vim_use+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to