Vim change filetype of file with extension `.pl` to prolog instead of perl

2.6k views Asked by At

The default filetype of a file with .pl extension is perl. However I use prolog more often so every time I open a new file I have to set it manually by running vim command

:set filetype=prolog

I tried to automate it by inserting the the following line into ~/.vimrc

autocmd BufNewFile,BufRead *.pl set syntax=prolog

also tried inserting this line in .vim/ftdetect/pl.vim file in vain.

What should be done to set .pl files to prolog type instead of perl?

1

There are 1 answers

0
Christian Brabandt On

Vim should detect this automatically, but you can override this by setting the variable g:filetype_pl in your .vimrc accordingly:

let g:filetype_pl="prolog"