0

So, I have a bunch of .vim syntax files for different languages inside my $VIMRUNTIME/syntax folder.

How do I make vim use these syntax files ? Currently, vim only looks for syntax.vim (it complains if syntax.vim is not there) and so is there something I should include in syntax.vim for vim to recognize the other language syntax files ?

P.S:

I do have syntax on in my .vimrc

2 Answers 2

1

The only thing you need to do to is to add this line to your ~/.vimrc:

syntax on 

It turns filetype detection and syntax highlighting on so this command should open a syntax highlighted file.py:

$ vim file.py 
Sign up to request clarification or add additional context in comments.

3 Comments

Hmm.. I do have syntax on in my vimrc. But I get the same result - vim complains about the missing syntax.vim file.
Did you do anything in $VIMRUNTIME? What is the path of your vimrc?
So my $VIMRUNTIME="/opt/<some folder>/share/vim". And my vimrc is in ~
0

With :syntax on, Vim should successfully load a syntax script from e.g. $VIMRUNTIME/syntax/java.vim when you do :set syntax=java.

You can verify with the :scriptnames output that this indeed is loaded. Also, you can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for what places Vim has searched.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.