2

I am using Vim with a QWERTY/BÉPO langmap setting which allows me to use the French dvorak-like keymap for inputting text and the QWERTY commands for the normal and visual mode.

Background:

I am really satisfied with this dual keymap solution, as inputting text in Bépo has really become physical muscle memory, and I do not have to think at all about the location of each letter but I am rather focused on the words and the general content.

On the other hand, vim commands are letter-based, so having two different letters depending on the context (normal mode or insert mode) for the same key has really become second nature.

Question:

However, I don’t know how to be able to use the mappings for some commands in insert mode, like expression register.

  • in QWERTY:
    • ctrl+R = displays the input for quick calculation as expected in insert mode.
  • in BÉPO:
    • ctrl+O in normal mode is equivalent to ctrl+R, and works as expected.
    • In insert mode, neither ctrl+O = nor ctrl+O % work. I get the (insert) status bar, that is expected but(see edit below) I do not get the command input that I would like to get.

Does anyone knows whether it is possible and how to implement a mapping for this ?

Thanks!

added for clarification and additionnal findings

I am wondering if this is a bug related to ctrl + O taking precedence despite the langmap. I could not find a way to reproduce it using only the QWERTY layout, so I am not totally sure if CTRL+<KEY> in insert mode uses the original language or the one remapped using langmap.

:h langmap


   This will allow you to activate vim actions without having to switch
   back and forth between the languages.  Your language characters will
   be understood as normal vim English characters (according to the
   langmap mappings) in the following cases:
    o Normal/Visual mode (commands, buffer/register names, user mappings)
    o Insert/Replace Mode: Register names after CTRL-R
    o Insert/Replace Mode: Mappings

** steps to reproduce the bug **

- without langmap:

  • vim -u DEFAULTS or nvim -u NORC

  • enter insert mode and type abc abc abc

  • ctrl + R displays " in place, waiting for a register. Typing = triggers the expression register and open = in the command bar. Typing 1+2 <Enter> inserts 3, text becomes abc abc abc 3

  • ctrl + W deletes 3

  • ctrl + O displays -- (insert) -- in the status line for a one-shot normal mode action

- with langmap

  • <esc>:set langmap=or,éw<enter>

  • i to enter insert mode again

  • ctrl + É deletes the word before, as ctrl + W did.

  • ctrl + O still activates -- (insert) --, I expected " in the text as ctrl + R did.

I could not find for a Qwerty layout a key equivalent to the é that would enable to reproduce the discrepancy of behavior that I get with Bépo.

I believe this question could be of interest / tested by Colemak or Dvorak users that have switched to these new layouts after learning vim and use langmap to keep using QWERTY and their muscle memory for vim commands, as described in this Vim tip.

3
  • Welcome to Vi and Vim!
    – filbranden
    May 17, 2020 at 17:52
  • I'm not 100% certain what the issue is. Paraphrasing :h 'langmap' Your language characters will be understood as normal vim English characters(according to the langmap mappings) when typing Register names after CTRL-R in Insert/Replace Mode. Is it NOT behaving that way? Or are you talking about what to use for CTRL-R itself? Ctrl-R, no?
    – B Layer
    May 17, 2020 at 18:14
  • It's an interesting question, but I guess it's a little bit hard to follow. (Probably me not being too experienced with non-querty keymaps doesn't help either...) What's your setup? Do you have your O.S. set up to send querty keys to Vim and then you're using Vim's 'keymap' option to remap them to bépo in insert mode? I understand that "O" in bépo is where "R" is in querty... So in Insert mode you have to use Ctrl+O (in bépo) instead of Ctrl+R to enter a register... Are you talking about using Ctrl+R (in bépo) to enter a register when using bépo keymap?
    – filbranden
    May 17, 2020 at 18:18

1 Answer 1

1

I could solve the problem by adding this mapping just for this command.

:inoremap <silent> <C-o> <C-r>

This workaround (or is this the expected behavior ?) enables to keep :set langmap=or active.

Note that adding:

:inoremap <silent> <C-é> <C-w> breaks <C-é>, if :set langmap=éw is active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.