Add the % on tab when working with HAML on vim -
i'd ability type h3 tab , have output %h3 when working haml. work other selectors such p or section.
i've installed tim pope's vim-haml plugin, doesn't seem provide shortcut. have missed something?
two possible solution come head:
1) hardcode using insert mode abbreviations (aka easy way):
function! s:haml_settings() iabbrev h3 %h3 iabbrev p %p iabbrev section %section endfunction autocmd filetype haml call <sid>haml_settings() although way use h3<space> instead of h3<tab>.
more information: :help abbreviations, :help :iabbrev
2) remap tab key (the more advanced way):
remap tab first execute function, checks word under cursor , transforms text if found can work with, or use standard behaviour of <tab> otherwise.
more information: :help map-expression
Comments
Post a Comment