Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim inoremap for specific filetypes

I've added some simple inoremap commands to my .vimrc to help with parens and brackets completion, but I only want them to apply to php files.

 inoremap ( ()<Esc>i
 inoremap { {<CR>}<Esc>ko
 inoremap <? <?php ?><Esc><Left>i

How to I set these commands to be active only when I'm editing a .php file?

like image 877
CamelBlues Avatar asked Jan 11 '12 18:01

CamelBlues


1 Answers

There may be a better way to do it, but this should work:

autocmd FileType php call Inoremaps()
fu! Inoremaps()
   inoremap ...
endfu
like image 132
Explosion Pills Avatar answered Sep 30 '22 23:09

Explosion Pills