[typing Russian characters in vim with vim-LaTeX]

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[typing Russian characters in vim with vim-LaTeX]

Maxim Abalenkov
Dear all,

I hope all is well with you. This is my first post to the vim mailing list. I use vim for a long time and would consider myself a power user. Occasionally, I need to type documents in Russian in LaTeX format. To use Russian in vim I follow the guidelines from this Habr post (https://habr.com/ru/post/98393/). In short I have the following settings in my .vimrc file:

  set keymap=russian-jcukenmac
  set iminsert=0
  set imsearch=0
  highlight lCursor guifg=NONE guibg=Cyan

With these settings in place I can use “Ctrl+^” to switch between English and Russian languages in vim insert mode. For convenient typing of LaTeX commands in vim I use the Vim-LaTeX distribution (https://sourceforge.net/projects/vim-latex/). The configuration commands relevant to vim-LaTeX in my .vimrc are:

  " envoke LaTeX-Suite on TeX file open
  filetype plugin on

  " load filetype-specific indent files
  filetype indent on

  " load vim-latex for empty TeX files
  let g:tex_flavor='latex'

All is nice and well and I’m satisfied with this setup. However, there is one small problem that makes my life miserable. One of the Russian letters, the small letter «ю», is not typed correctly. When I press the relevant key on the keyboard I get a full stop symbol «.» instead of the small letter «ю». On the other hand, the capital letter «Ю» (when pressing the Shift key) is produced correctly. Would you please be so kind to help me debug the problem? Maybe I have some option clashes with the vim-LaTeX? Thank you and have a good day ahead!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/2C9A3F17-7183-4133-AD0B-852FFB27B039%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [typing Russian characters in vim with vim-LaTeX]

Tony Mechelynck
On Tuesday, June 30, 2020 at 7:46:30 AM UTC+2, Maxim Abalenkov wrote:
Dear all,

I hope all is well with you. This is my first post to the vim mailing list. I use vim for a long time and would consider myself a power user. Occasionally, I need to type documents in Russian in LaTeX format. To use Russian in vim I follow the guidelines from this Habr post (<a href="https://habr.com/ru/post/98393/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fhabr.com%2Fru%2Fpost%2F98393%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEvP7gHA5__iojx7pRzTiaScLMRNQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fhabr.com%2Fru%2Fpost%2F98393%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEvP7gHA5__iojx7pRzTiaScLMRNQ&#39;;return true;">https://habr.com/ru/post/98393/). In short I have the following settings in my .vimrc file:

  set keymap=russian-jcukenmac
  set iminsert=0
  set imsearch=0
  highlight lCursor guifg=NONE guibg=Cyan

With these settings in place I can use “Ctrl+^” to switch between English and Russian languages in vim insert mode. For convenient typing of LaTeX commands in vim I use the Vim-LaTeX distribution (<a href="https://sourceforge.net/projects/vim-latex/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsourceforge.net%2Fprojects%2Fvim-latex%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFW5R5zrYzGSUqEIklQg64pAIruiw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsourceforge.net%2Fprojects%2Fvim-latex%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFW5R5zrYzGSUqEIklQg64pAIruiw&#39;;return true;">https://sourceforge.net/projects/vim-latex/). The configuration commands relevant to vim-LaTeX in my .vimrc are:

  " envoke LaTeX-Suite on TeX file open
  filetype plugin on

  " load filetype-specific indent files
  filetype indent on

  " load vim-latex for empty TeX files
  let g:tex_flavor='latex'

All is nice and well and I’m satisfied with this setup. However, there is one small problem that makes my life miserable. One of the Russian letters, the small letter «ю», is not typed correctly. When I press the relevant key on the keyboard I get a full stop symbol «.» instead of the small letter «ю». On the other hand, the capital letter «Ю» (when pressing the Shift key) is produced correctly. Would you please be so kind to help me debug the problem? Maybe I have some option clashes with the vim-LaTeX? Thank you and have a good day ahead!

When keymaps are active, the "russian-jcukenmac" keymap ought to produce the letter ю when you hit what would be a full stop when keymaps are not active, and a full stop when you hit the key which otherwise would give &. I suggest the following:

1. Make the cursor be of a diferent color when typing Russian:
       hi Cursor ctermbg=bg ctermfg=fg guibg=bg guifg=fg
       hi lCursor ctermbg=red ctermfg=red guibg=#FF0000 guifg=#FF0000
2. Check your mappings:
       :verbose map! .
       :verbose lmap .

(with the full stop at the end in both cases). If all is right, I would expect the answers to be
  No mapping found
and
  . . *@ю
respectively, with possibly an additional ine telling you where the mapping was set.

You can also try test-typing some mixed Cyrillic/Latin text and check that the cursor is red for Cyrillic and "normal" for Latin.

Всего хорошего,
Тоня.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4eeea0c1-13d9-4f88-a3f1-0442949ef73bo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [typing Russian characters in vim with vim-LaTeX]

Andy Wokula
In reply to this post by Maxim Abalenkov
Am 27.06.2020 um 16:59 schrieb Maxim Abalenkov:

> Dear all,
>
> I hope all is well with you. This is my first post to the vim mailing
> list. I use vim for a long time and would consider myself a power
> user. Occasionally, I need to type documents in Russian in LaTeX
> format. To use Russian in vim I follow the guidelines from this Habr
> post (https://habr.com/ru/post/98393/). In short I have the following
> settings in my .vimrc file:
>
>    set keymap=russian-jcukenmac
>    set iminsert=0
>    set imsearch=0
>    highlight lCursor guifg=NONE guibg=Cyan
>
> With these settings in place I can use “Ctrl+^” to switch between
> English and Russian languages in vim insert mode. For convenient
> typing of LaTeX commands in vim I use the Vim-LaTeX distribution
> (https://sourceforge.net/projects/vim-latex/). The configuration
> commands relevant to vim-LaTeX in my .vimrc are:
>
>    " envoke LaTeX-Suite on TeX file open
>    filetype plugin on
>
>    " load filetype-specific indent files
>    filetype indent on
>
>    " load vim-latex for empty TeX files
>    let g:tex_flavor='latex'
>
> All is nice and well and I’m satisfied with this setup. However, there
> is one small problem that makes my life miserable. One of the Russian
> letters, the small letter «ю», is not typed correctly. When I press
> the relevant key on the keyboard I get a full stop symbol «.» instead
> of the small letter «ю». On the other hand, the capital letter «Ю»
> (when pressing the Shift key) is produced correctly. Would you please
> be so kind to help me debug the problem? Maybe I have some option
> clashes with the vim-LaTeX? Thank you and have a good day ahead!
>
> —
> Best wishes,
> Maxim
>
> Maxim Abalenkov \\ [hidden email] <mailto:[hidden email]>
> +44 7 486 486 505 \\ http://mabalenk.gitlab.io

This assumes vim-latex-1.10 ...


The keymap's (buffer-local) language mapping for `.' is overruled by a
buffer-local Insert mode mapping.


To show the problem: in a LaTeX (ft=tex) buffer:
     :imap <buffer> .
(or just)
     :imap .
shows something like (depending on g:Tex_SmartKeyDot)
     <C-R>=<SNR>20_SmartDots()<CR>
or  <C-R>=<SNR>12_LookupCharacter(".")<CR>


You can remove the Insert mode mapping after it gets defined:

Create a file
     after/ftplugin/tex.vim
containing the line

     iunmap <buffer> .

for example the file ~/.vim/after/ftplugin/tex.vim where
~/.vim/after must occur in the 'runtimepath'.

--------------------------------------------------------------
You can ignore what follows.

An alternative is to

put in the vimrc:
     :let g:Tex_SmartKeyDot = 0

and to put in the after/ftplugin/tex.vim file:

" :echo IMAP_list_all('.')
"   tex: "`. => "`.
"   tex: \`. => \`.
"   tex: ``. => ``.
"   tex: `. => \cdot

if exists('*IUNMAP') && maparg('.', 'i') =~# '<SNR>\d\+_LookupCharacter("\.")'
     call IUNMAP('"`.', 'tex')
     call IUNMAP('\`.', 'tex')
     call IUNMAP('``.', 'tex')
     call IUNMAP('`.', 'tex')
endif


Would have been cleaner if there was an IUNMAP_ALL('.', 'tex') function ...

And not sure about the exact consequences ... the mapping for `.' is
created per buffer, but IMAP() creates internal data structures per
filetype.

--
Andy

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5EFCBA7C.9060602%40yahoo.de.
Reply | Threaded
Open this post in threaded view
|

Re: [typing Russian characters in vim with vim-LaTeX]

Maxim Abalenkov
In reply to this post by Tony Mechelynck

On 30 Jun 2020, at 07:20, Tony Mechelynck <[hidden email]> wrote:

On Tuesday, June 30, 2020 at 7:46:30 AM UTC+2, Maxim Abalenkov wrote:
Dear all,

I hope all is well with you. This is my first post to the vim mailing list. I use vim for a long time and would consider myself a power user. Occasionally, I need to type documents in Russian in LaTeX format. To use Russian in vim I follow the guidelines from this Habr post (https://habr.com/ru/post/98393/). In short I have the following settings in my .vimrc file:

  set keymap=russian-jcukenmac
  set iminsert=0
  set imsearch=0
  highlight lCursor guifg=NONE guibg=Cyan

With these settings in place I can use “Ctrl+^” to switch between English and Russian languages in vim insert mode. For convenient typing of LaTeX commands in vim I use the Vim-LaTeX distribution (https://sourceforge.net/projects/vim-latex/). The configuration commands relevant to vim-LaTeX in my .vimrc are:

  " envoke LaTeX-Suite on TeX file open
  filetype plugin on

  " load filetype-specific indent files
  filetype indent on

  " load vim-latex for empty TeX files
  let g:tex_flavor='latex'

All is nice and well and I’m satisfied with this setup. However, there is one small problem that makes my life miserable. One of the Russian letters, the small letter «ю», is not typed correctly. When I press the relevant key on the keyboard I get a full stop symbol «.» instead of the small letter «ю». On the other hand, the capital letter «Ю» (when pressing the Shift key) is produced correctly. Would you please be so kind to help me debug the problem? Maybe I have some option clashes with the vim-LaTeX? Thank you and have a good day ahead!

When keymaps are active, the "russian-jcukenmac" keymap ought to produce the letter ю when you hit what would be a full stop when keymaps are not active, and a full stop when you hit the key which otherwise would give &. I suggest the following:

1. Make the cursor be of a diferent color when typing Russian:
       hi Cursor ctermbg=bg ctermfg=fg guibg=bg guifg=fg
       hi lCursor ctermbg=red ctermfg=red guibg=#FF0000 guifg=#FF0000
2. Check your mappings:
       :verbose map! .
       :verbose lmap .

(with the full stop at the end in both cases). If all is right, I would expect the answers to be
  No mapping found
and
  . . *@ю
respectively, with possibly an additional ine telling you where the mapping was set.

You can also try test-typing some mixed Cyrillic/Latin text and check that the cursor is red for Cyrillic and "normal" for Latin.

Всего хорошего,
Тоня.

Hello Tony et al.,

How are you? Thank you very much for your help. I’m sorry for a delay in my reply. It has been a busy week! I have just tried your suggestions. I have placed the cursor highlight settings into my ~/.vimrc by they don’t appear to have any effect. The colour of the cursor doesn’t change neither in Latin nor in Russian setting.

I have checked the mappings and have something to report back to you.

       :verbose map! .

Produces:

*@<C-R>=<SNR>43_SmartDots()<CR>
        Last set from ~/Dropbox/unix/.vim/ftplugin/latex-suite/main.vim line 865
i  .           * <C-R>=<SNR>22_LookupCharacter(".")<CR>
        Last set from ~/Dropbox/unix/.vim/plugin/imaps.vim line 184

       :verbose lmap .

Results in:

l  .           *@ю
        Last set from /usr/share/vim/vim82/keymap/russian-jcukenmac.vim line 95

All in all it is working now. I figured out my mistake. The conflict was indeed the vim-LaTeX and the Russian keymap settings. I have asked this question on Vim StackExchange (https://tinyurl.com/y9sg3caz). The order of loading vim-LaTeX and Russian keymap was incorrect. To solve the issue I’m loading the Russian keymap first and setting the vim-LaTeX options the last. Thank you for your help and have a good Sunday!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/D853FF5D-C07D-4B0E-BA84-0040669560B0%40gmail.com.