Friday, October 25, 2013

RE: Re: vim-latex/latex-suite macros like FEM in nonEnglish languages


On Oct 25, 2013 2:13 PM, <sibgat@imec.msu.ru> wrote:
>
>
>>>>> I work on a book in Russian using vim-latex. While in insert
>
> >>>> mode in Russian (with keymap command c-^) latex-suite
> >>>
> >>> macros like FEM don't work.
> >>>>
> >>>> Thats indeed very embarrassing. Is there a way to get them
> >>>> work in
> >>>
> >>> nonEnglish languages?
> >>>>
> >>>> Thanks!
> >>>
> >>>Nikolay Pavlov:
>
> >>> You mean, those that are created using IMAP function? AFAIK
> >>> they work like this: map the last character (M in your case)
> >>> and when it is typed check whether the preceding characters
> >>> are present just before the cursor. If they are, IMAP deletes
> >>> them and does what it was requested, otherwise it returns the
> >>> last character which will then be inserted. I do not know how
> >>> mappings interact with &keymap, but as with &keymap preceding
> >>> characters (FE in your case) are replaced with Russian ones
> >>> IMAP will not work. I do not know any way around this without
> >>> modifying IMAP to be &keymap-aware.
> >>>
> >>> I personally just disabled all these macros for them being too
> >>> intrusive (do not remember which of them exactly though).
> >>
> >>
>
> Nikolay Pavlov:
>
>> Please read my message. IMAP does *not* map FEM. It maps M and
>> checks whether there are FE letters present just before the cursor
>> when you trigger the M map. It is a poor men infinite timeout for
>> insert mode. AFAIR one of the reasons I disabled all of the
>> mappings is that I could not type some sequences anymore. I
>> remember something starting/ending with backticks.  Second was
>> that no trick like Space CTRL-H Key works: unlike my translit3
>> which uses similar approach IMAP does not bother mapping F and E
>> and hence does not bother remembering where I started typing. (If
>> translit3 detects that I started typing the sequence in one place,
>> but am now typing in the other, even with same characters before
>> the cursor, it no longer considers new key a continuation of the
>> old sequence. Same if you typed some character that translit3
>> mapped, but that is not the part of current sequence: no CTRL-H/BS
>> will allow old sequence to continue.)
>
>
> to Nikolay Pavlov:
>
> You are absolutely right!
> But I know that I will never use the word "АУЬ" (FEM in Russian
> keymap) in Russian language, since it can not be even an
> abbreviation.
> So for the few macros I have liked to use in English I just tried to make the analogue in Russuan:
> In file ~/.vim/ftplugin/latex-suite/elementmacros.vim
> I found the command:
> if g:Tex_FontMaps | exe 'call IMAP ("FEM", "\\emph{<++>}<++>", "tex")' | endif
> and created another one:
> if g:Tex_FontMaps | exe 'call IMAP ("АУЬ", "\\emph{<++>}<++>", "tex")' | endif
> (FEM and АУЬ occupy the same physical keys on the keybord for
> English and Russian keymap)
>
> But ... it does not work((

It seems that IMAP is one of those badly written plugins that still think that one character occupies exactly one byte: in the plugin/imaps.vim I found the following:

    let lastLHSChar = a:lhs[strlen(a:lhs)-1]

which is then escaped and used as an argument to :inoremap. You may try to change this with

    let lastLHSChar = matchstr(a:lhs, '.$')

, but it is likely not the only place where author assumed 1 character == 1 byte.

> Finally I wonder why is it only me who tries to use vim-latex
> macros in Russian on other languages???
>
> I understand your critics of vim-latex mappings:
> it may happen that you will need FEM in your text, f.e. FEM as an
> acronym for "finite element method",
> but anyway there is a need for such macros: it is much easier to
> type FEM and get \emph{<++>}<++> than typing it directly,
> not to mention `/ for \frac{}{<++>}<++> etc.

For every mapping or abbreviation I create in any of my plugins there is a way to customize leader for a specific group of mappings and the mapping lhs itself (this is a feature from my framework). Vim-latex-suite lacks this. Thus I have configured my ftplugin/tex/my.vim and translit3 plugin to ease my life and added dummy IMAP function to the aforementioned my.vim that prevents such macros from being ever defined. And I also do not like these placeholders.

> Thank you!
>
>
>
>
> --
> --
> 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.

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

Post a Comment