6

I am using a bépo keymap (http://bepo.fr) and seeking the perfect vim mapping.

So far I used a long list of noremap, but for many binding (for exemple, the motion aw or Ctrl+r), the first keystroke is well remaped but not the others, I reckon it's the expected behaviour, but then this is not what I need.

Ideally I would have my keyboard totally remaped in a higher level (before the map commands) except when typing text (in insertion mode and when typing a substitution for exemple). What I'm looking for seems to be langmap, but I have problems using it.

I added this langmap to my .vimrc, It seems perfect but it broke some of my plugins. SuperTab now insert <Plug>SuperTabForward when pressing Tab in insertion mode, I have t<SNR>24_SelectCompletion(1) when pressing enter.

Does someone know how to fix this langmap issue or a better way to remap my keyboard?

How Chen
  • 1,340
  • 2
  • 17
  • 37
Dettorer
  • 1,247
  • 1
  • 8
  • 26
  • 1
    Similar question with answer : http://stackoverflow.com/questions/7889080/vim-set-langmap-eh-breaks-supertab-plugin – Xavier T. Jun 26 '14 at 15:24
  • @XavierT. This is the same problem indeed, but the only "solution" there is a workaround that won't work for me since I remap _every_ key. In fact, I think langmap is more intended to be used for mapping things like Russian characters, I'd accept an answer saying "langmap is not intended for this usage" but this is never the answer given to that problem. Meanwhile, I still have my hundred `noremap` :D – Dettorer Oct 03 '14 at 12:41
  • Remapping the whole keyboard is a stupid idea: `b` is not `b` because of any physical property of the `b` key; it is `b` because `b` is the first letter of `beginning`. And the same goes for almost every command. You are not only forcing yourself to map dozens and dozens of letters to other letters, completely loosing their mnemonic nature but you are also fighting against Vim with dirty hacks that don't even work. `b` is `b`, no matter where it is on your keyboard. – romainl Oct 15 '14 at 08:40
  • This is not what is happening. When I type for example the `e` motion (which is the `p` key in bépo), I think "e", not "p", and "e" is still what is printed on my keyboard. But the real reason for this is that I really want to use the `hjkl` keys to move around, in bépo that would be like using (respectively) `.pbo` which is unusable. But if a remap that, i use the `ctsr` keys, and then need to remap those keys. I could remap only the really problematic keys, but having just half of my keys remap seems like an even worse idea. – Dettorer Oct 15 '14 at 08:46
  • I would consider this a bug and asked Bram to [clarify](https://groups.google.com/d/msg/vim_dev/QnNwLWhJ744/1qNcD7d9OvgJ) – Christian Brabandt Oct 15 '14 at 15:23

1 Answers1

4

This is a known bug, that has been discussed before. I have made a patch (see the thread starting here) and hopefully Bram will include this change soon.

Update 11/05/2014
This has been fixed by patch 7.4.502. Use the langnoremap option to fix this.

Christian Brabandt
  • 8,038
  • 1
  • 28
  • 32
  • (Sorry for the late reaction). Thanks for starting a new thread and making a patch! I tested it, but I still get the supertab message inserted when I hit `tab`. I applied the patch, ran `./configure --prefix=$HOME/.local --with-vim-name=vim-test --with-features=huge` then `make` and `make install` and tested on a C++ file with `~/.local/bin/vim-test`. Did I do something wrong? – Dettorer Oct 18 '14 at 16:13
  • I am not sure, which patch you used. The latest one introduced a `'langnoremap'` option. which by default is off and you explicitly need to set it. BTW: If you used it and it works, please report back at that mentioned thread. – Christian Brabandt Oct 18 '14 at 17:44
  • Er… sorry, I saw it, then forgot about it. There's evolution, now hitting tab inserts ` SuperTab('n')` (still instead of autocompletion). Yes, I'll post on the mailing list when it works! – Dettorer Oct 19 '14 at 00:32
  • Can you find out, which of your langmap causes this? So far, I have not been able to replicate this. – Christian Brabandt Oct 20 '14 at 06:46
  • I narrowed it down to remaping `=`: `langmap==-` inserts "`SuperTab('n')`" with or without `set langnoremap`. – Dettorer Oct 20 '14 at 13:54
  • I see the problem. I'll look into fixing it and will post an updated patch then – Christian Brabandt Oct 20 '14 at 19:31
  • Seems to work! I'll use it tomorrow to see if there isn't some other corner cases I can find. I'll post on the thread then, but I can already accept your answer and give the bounty :). Thanks! – Dettorer Oct 20 '14 at 20:38
  • The patched Vim does not work for me. For example, setting `set langnoremap`, `nnoremap / r`, `set langmap=é/` does not work as expected when pressing `<é>` key. – Alexey Apr 02 '15 at 15:05
  • @Alexey, please provide detailed steps at the vim-dev mailinglist I'll try to fix it. What's your Vim version, btw? – Christian Brabandt Apr 02 '15 at 19:19
  • Ok, i'll do it, thanks. I have Vim 7.4.622. The steps are the ones i've mentioned above: i put these three commands in a file, execute it with `:so %`, and try if it works -- it does not. – Alexey Apr 02 '15 at 19:29
  • Sorry, i was not clear: it does not work in a funny way: `langmap` itself works, it is `nnoremap` that is ignored if i try with `é` or `ç`, but works with `a`. – Alexey Apr 02 '15 at 19:39
  • I've posted to **vim_dev**. – Alexey Apr 02 '15 at 20:14
  • 1
    Thanks. I'll have a look later. Looks like issue 297 (https://code.google.com/p/vim/issues/detail?id=297) – Christian Brabandt Apr 03 '15 at 11:44