Monday, January 30, 2012

Re: Set 'filetype' by filename extensions

On Tue, Jan 31, 2012 at 15:11, Christian Brabandt <cblists@256bit.org> wrote:
On Tue, January 31, 2012 8:05 am, Clark J. Wang wrote:
> 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
>

:h new-filetype

Thanks I see the example "au BufRead,BufNewFile *.mine set filetype=mine" and that works for me. But what's wrong with my original post though it's a bit complicated?


regards,
Christian

--
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

--
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:

Post a Comment