When I write an HTML file I always write in Haml first and generate HTML by
haml command. Haml is so handy that Haml makes us free from writing closing tags like
The problem in Haml is that it is very difficult to type
% very often. The symbol is the second most difficult location (*1) in a keyboard.
The solution is to write the following code on you
~/.vim/ftplugin/haml.vim which let
: key as
% only in Haml file and when the cursor is on the top of the line.
inoremap <buffer><expr> : <SID>on_the_top() ? '%' : ':' function! s:on_the_top() return col('.') == 1 || getline(line('.'))[0:col('.')] =~ '^\s*$' endfunction
Note that I swapped
;. If you didn't swap them, just to swap your keyboard or the code.
- (*1) The most difficult location key is
^(shift + 6). If you want to make a programming language which is highly difficult to code, use