I copied the code from vim-thai-keys to my .vimrc file and made a few adjustments.

My problem: Typing the '2' key while using the Thai keyboard in Normal mode either sends me to /search mode or moves the cursor two spaces to the right and I am thus unable to use 2 in a keystroke navigation or editing combination.

Note: The symbol on the Thai keyboard corresponding to the English key '2' is '/'.

Changes made to .vimrc file and the results of typing '2' from the Thai keyboard while in Normal mode.

  1. :map / 2Result: Cursor moves 2 spaces to the right

  2. :map \/ 2Result: Sent into /search mode

  3. nnoremap / 2Result: Cursor moves 2 spaces to the right

  4. nnoremap \/ /Result: Sent into /search mode

    All of the other numbers and key stroke mappings seem to work wonderfully.

(Yes, I restarted vim after editing the .vimrc file) :) :)

Question: Is there a way to map the '2' key so that while in the Thai keyboard in Normal mode I am able to use it as a normal 2 in navigation and editing keystroke combinations?

Bonus points: Should I use :map or nnoremap in my .vimrc file for these key stroke mappings and why.

  • 1
    You might have an extra space character after the nnoremap / 2. If so, you're basically moving 2 spaces to the right, since :h <Space> states that it is equivalent to l (move "[count] chars to the right"). Alway use the *noremap form, unless you know you need recursive mappings.
    – VanLaser
    Nov 14 '15 at 14:13
  • Yes indeed. There was a space after the 2. Nov 15 '15 at 18:30

A simple solution is to use the <Leader> key which I have chosen to map to <space>.

map <space> <Leader>
nnoremap <Leader>/ 2

Make sure there are no spaces after the 2.

Another useful mapping for Thai is:

nnoremap <Leader>ไ W

This resolves the conflict on the Thai keyboard with the " key while removing the need to include the <shift> key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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