Elentok's Blog

About me

Writing hebrew text using Vim

Usually when you write hebrew in Vim, you have to write from left to right, which is a little annoying. Vim has two settings that allow typing hebrew easier:

  • set rightleft (or set rl) - display the entire buffer from right to left
  • set keymap=hebrew - changes the keyboard mapping to hebrew (doesn't effect the OS mapping)

I wrote a simple function that toggles between hebrew mode (right-to-left and hebrew mapping) and normal mode (left-to-right and english mapping):

imap <f2> <c-o>:call ToggleHebrew()<cr>
map <f2> :call ToggleHebrew()<cr>

func! ToggleHebrew()
  if &rl
    set norl
    set keymap=
  else
    set rl
    set keymap=hebrew
  end
endfunc

I'm binding this function to the <f2> key so I can easily switch between english and hebrew modes.

Next:ActiveRecord+PostgreSQL mass-insertion benchmarks