Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start using vim with a non-english keyboard

Tags:

vim

keyboard

I recently started using git, and by default it would want to use vim. I always wanted to look a bit deeper in this editor, but was always thrown back, only using it if for some reason (such as in case of a near dead Linux system) it was unavoidable. Even now I soon ended up reconfiguring git to use mcedit instead (which I use for programming).

The problem was that OK, I gave the command :help to see how I could start. Then in the help system it suggests me to jump to the subject interesting me using CTRL-]. And here I am lost. I have a Hungarian keyboard, and simply couldn't find where it excepted to find ]. So I can just scroll around in a list of topics I can not enter.

This is just the beginning: In general how much such "weird" combinations I may except? And how I could fix those up? An other problem with the Hungarian language is that it has a bunch of extra vowels which have to be mapped on the same amount of keys like English with it's 26 letters (there are 9 extra letters, so 9 keys "lost"!). Would this hinder the use of vim for writing Hungarian text (where I would require these keys to produce the language-specific vowels)?

How this problem could be solved in a way that if I happen to get an English keyboard (for which layout I guess vim was originally designed), I wouldn't have to re-learn the positioning of the keys? (Since I have no English keyboard around I can't try what happens. As I tried neither of the two keys on the left of 'P' would suffice for the CTRL-] combination while as far as the layouts I checked the second should be it. Of course my system is configured for Hungarian layout)

The language truly is irrelevant, I guess everyone having non-English keyboards might face similar problems. So how you work yourself around these?

like image 784
Jubatian Avatar asked Mar 30 '14 15:03

Jubatian


People also ask

What is Vim keyboard?

Vim is a text editor known for its variety of keyboard shortcuts and its different editing modes. Vim is very customizable, and there are many plugins on the internet that allow you to extend Vim's functionality.


1 Answers

Look at /usr/share/vim/vim74/keymap/ directory (in debian/ubuntu it is a part of the vim-runtime package), you should see a bunch of keymap files for different locales. Chose the one you like. In the example I use russian-jcukenwin.vim.

Add to your .vimrc file →

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

Now you can switch layout with Ctrl-^ keys. Note: layout is switchable when in insert-mode.

As you can guess the first line is the name of the file I mentioned. The next two lines sets the iminsert and imsearch in order to start writing the very first time with latin layout. In fact Ctrl-^ toggles them between 1 and 0. And the last line draws the caret with cyan color when layout is changed.

like image 156
Hi-Angel Avatar answered Sep 23 '22 03:09

Hi-Angel