I'm editing Prolog files as part of an exploratory project, and some of the files I'm working with have the extension .pl, which is shared by Perl files. Whenever I do work on a Prolog file named [somefile].pl, Vim gives me syntax highlighting and error detection for Perl, rather than Prolog. I could totally disable syntax highlighting for Perl or force .pl to be recognized as Prolog, but I'd like to know if there's a less dictatorial way of fixing the issue. Is there a way I can set the syntax highlighting programmatically, or use some sort of a key combination to tell Vim that I'm editing a Prolog file rather than a Perl file?
How can I get correct autocompletion for ambiguous file extensions?
ide;syntax highlighting;filetype
I can only answer the second part of your question.You can tell Vim that you're editing a Prolog file with this command::set syntax=prologIf you never work in Perl, then it wouldn't seem dictatorial to add custom configuration in your ~/.vimrc:autocmd BufNewFile,BufRead *.pl setfiletype prolog syntax=prolog