Den 2015-11-20 kl. 20:20, skrev Tony Mechelynck:
> These options can be toggled by hitting Ctrl-^ but since that
> keystroke is hard to find on my Belgian AZERTY keyboard I use the
> following, which works also in Normal mode:
>
> set ims=-1
> map <F8> :let &l:imi = ! &l:imi<CR>
> map! <F8> <C-^>
I guess this is some trick to make `<F8>` do two things at once,
but I haven't managed to understand what `map!` does through
reading the help. I suspect this can simplify my keymap switching
setup but I want to understand how it works!
(Sorry, I haven't used Vim for the prerequisite two decades yet! :-)
Den 2015-11-20 kl. 23:07, skrev Tony Mechelynck:
> On Fri, Nov 20, 2015 at 10:45 PM, Dmitri Vereshchagin
> <dmitri.vereshchagin@gmail.com> wrote:
>> * Tony Mechelynck <antoine.mechelynck@gmail.com> [2015-11-20 23:54]:
>>> N° № U+2116 NUMERO SIGN
>>
>> Thank you. It is very clever. I suppose you use AZERTY keyboard
>> layout. I have ЙЦУКЕН (JCUKEN) keyboard and there is no simple way to
>> input degree sign. So I stick with digraph.
>>
>> --
>> Dmitri Vereshchagin
>
> Yes, my keyboard is a Belgian AZERTY. Remapping "No", wouldn't work,
> at least with my keymap, where it would clash with "Но", a syllable
> commonly found at the beginning of Russian words, or even as a word in
> itself. Maybe there is another character, or character group, which is
> practically never used? On my Belgian keyboard I might use µ or ù but
> not knowing what special characters there are on your JCUKEN keyboard
> I might suggest ъъ because the hard sign is rare (since the 1917
> spelling reform) and though it does happen in Russian text it is never
> doubled.
I have found a solution to such problems which I use in my
keymaps: I designate one or more characters as 'sigils' on
'digraphs', so that I can type that character plus any two
characters to get a special character without worrying about what
the other two characters mean without that sigil/prefix. The
price is that I'll have to hit two keys to type the sigil
character(s) literally. A useful character for that is `&` which
isn't used very often in prose. Thus I have mappings like:
&No № U+2116 NUMERO SIGN
&et & U+0026 AMPERSAND
I'm also in the habit of assigning one ASCII punctuation character
as a prefix for any ASCII character including itself to type a
literal ASCII character. That way I can quickly type an English
word or letter without switching keymaps. That's especially
useful with my IPA (phonetics) keymap where all unadorned [a-z]
characters are unmapped but unadorned [A-Z] map to various special
characters. Sometimes ASCII capitals are used as cover symbols,
e.g. C for "any consonant", which I then can type as `"C` while
`C` alone maps to `ç`. For some odd reason I've chosen the ASCII
double-quote for the literal which in retrospect was a bad choice
since outside the phonetics context `"` isn't exactly an uncommon
character, but it has become ingrained now.
Another useful trick is to use those punctuation characters which
don't normally occur before letters (which have the Unicode
property Terminal_Punctuation) as prefixes
! U+0021 EXCLAMATION MARK
, U+002C COMMA
. U+002E FULL STOP
: U+003A COLON
; U+003B SEMICOLON
? U+003F QUESTION MARK
then you very seldom need to use a prefix to type those characters
literally (in non-program text that is!), and you can use the
doubled character to type the character itself:
!! ! U+0021 EXCLAMATION MARK
,, , U+002C COMMA
.. . U+002E FULL STOP
:: : U+003A COLON
;; ; U+003B SEMICOLON
?? ? U+003F QUESTION MARK
Here is a keymap which uses sigils extensively, perhaps even
excessively. It lets me type all non-decomposing Unicode letters
with the 'Latin' property, plus a bunch of combining marks and
modifier letters, everything a comparative philologist needs and
then some. Notably all ASCII punctuation characters except the
doublequote are mapped to combining diacritics; the actual
punctuation characters must be typed as `"!` etc., which hardly
bothers me any more. Look in the Changelog entry for 8 October
2015 for a description of the system.
<http://git.io/v4p66>
> sometimes when 'imi' is set wrong (0=Latin instead of
> 1=Cyrillic) it happens that I type three or four words before I look
> at the screen and see that they have all been taken literally as Latin
> script.
I usually do the opposite: forgetting to switch back to Latin, so
that I type several English/Swedish words in Greek characters or
with interspersed IPA characters: Ιτ'σ αλλ Γρεεκ το με!
(Indo-European comparative philologists for some reason
transliterate everything except Greek!)
FWIW I have several custom mappings to switch on/between different
keymaps and one to switch off. The `<C-^>` is hard to type on my
keyboard also.
In fact I have a dictionary in .vimrc mapping one-letter
identifiers to keymap names, and a function to setup mappings for
them, like `<F-11>g` for Greek. The dictionary is a global
variable and I have a command to add an entry and rerun the
mapping function.
/bpj
--
--
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