tags:

views:

68

answers:

1

So I am giving Vim , a serious try for coding my python apps.

However Vim is proving so flexible, I was thinking to use it as my main editor at work (lawyer / legal documents) . The problem is that my mother tongue is not English but Greek. So I have mapped the ALT+SHIFT to change between English - Greek. The issue I am experience is that I have to ALT-SHIFT each time I want to enter a VIM command (to return but to English). So its ALT+SHIFT when I type my document then ALT-SHIFT again to enter vim commands. This defeats the purpose of using Vim, speed of use.

So my question is simple, is there any way to avoid ALT-SHIFT for using Vim commands with the Greek Language ?

+1  A: 

This problem can be solved using Vim's keymap option. It allows to define alternate keymap to use in insert and replace modes. There are many predefined keymaps for some languages, you can browse them all using :e $VIMRUNTIME/keymap in Vim itself.

To switch between default and alternate keymap use Ctrl+^ in insert and replace mode. Regardless of current keymap in insert and replace mode, keymap in normal mode stays default, so you can leave insert mode writing greek and immediately use Vim keybindings without switching layout. And when you return in insert or replace mode (or start search by /), Vim will switch you to greek keymap automatically. Thus, keymap is remembered between inserts.

I recommend you to add this line to your .vimrc file:

set keymap=greek_utf-8

(Note that there are several other greek keymaps (which probably differ only by encoding) provided in Vim, so you can choose one that suits your configuration.) With this option set, you should work in Vim using English keyboard layout and switch keymap using Ctrl+^ and not your system-wide layout switch.

I also recommend setting these:

set iminsert=0
set imsearch=-1

See :help iminsert and :help imsearch to ensure that it does not contradict with your configuration.

There is also langmap mode, which was introduced in Vim earlier than keymap, as far as I know, and allows to achieve somewhat like keymap by manual specifying letter pairs that correspond to the same keys on keyboard. I strongly recommend using keymap instead. (My native language is not English too, and I'm using similar keymap configuration as I described above.)

ib
You are amazing!!! Your suggestion did not work, but you pointed me to the correct direction. All I had to do was to change set keymap=greek_utf-8 to set keymap = greek_iso-8859-7 . For a stange reason greek utf displays weird characters, the same happens with my firefox when it chooses utf, but iso also work there. Everything else worked like a charm I just press ctrl+^ in edit mode as you suggested and I can change between greek and englis while the command interface remains in english . You are a life savior , thanks.
Kilon
Thanks, I'm glad to help!
ib