Monday, January 30, 2012

Set 'filetype' by filename extensions

I have some files named in the *.kshlib format which are ksh scripts but vim always recongnized them as "ft=conf". So how can I force vim to consider those files as "ft=sh"?

I tried following in vimrc but it did not work:

autocmd BufReadPost *
        \ if bufname('%') =~ '^.*\.kshlib$' |
        \   exe 'normal set ft=sh' |
        \ endif

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: