1

Currently, I load my syntax manually in vim by :set filetype=python. Depending on what kind of file I'm working on, I change it manually. I think there should be a more smarter way. Probably some lines to be placed in my .vimrc file

Solution: I had all the standard lines such as:

syntax on
filetype plugin indent on

but the problem is actually the filetype not being recognized, I noticed that I needed a ftplugin.vim at my $VIMRUNTIME and this solves my problem.

Thanks for the help.

2
  • I don't use graphical vim, what does ftplugin.vim do? I mean, it looks like it handles the filetypes... but that's just a guess.
    – icedwater
    Jul 16, 2013 at 9:10
  • 1
    There's no way this file would be missing from even the most basic installation. That's a problem in and of itself so you should ask another question and explain carefully where things are and how they ended up there.
    – romainl
    Jul 16, 2013 at 9:17

3 Answers 3

2

Try adding to your .vimrc;

syntax on
filetype plugin indent on

If you're using Vundle or Pathogen, make sure you add these lines after they are finished. See :help syntax and :help filetype for more information.

2
  • I had these commands in my .vimrc but it did not helped. I'll update my problem and solution on my post.
    – Nicholas TJ
    Jul 16, 2013 at 8:56
  • your answer and romaini are the best. I'll just pick this. But the problem I had was the missing ftplugin.vim, but anyway, still a good answer
    – Nicholas TJ
    Jul 16, 2013 at 9:03
0

Most files are recognised if you write syntax on in your .vimrc.

3
  • 2
    I had that but it did not helped. I found out my problem. Will update on my asnwer.
    – Nicholas TJ
    Jul 16, 2013 at 8:55
  • I would make sure it is near the top. Also, it seems to be possible if I set foldmethod=syntax without syntax on, maybe some implicit setting is going on there.
    – icedwater
    Jul 16, 2013 at 8:58
  • yeah, i think i should delete this.
    – Nicholas TJ
    Jul 16, 2013 at 9:00
0

Place these two lines at the top of your ~/.vimrc:

filetype plugin indent on
syntax on

and read :help :filetype and :help syntax.

1
  • :help :syntax just shows a little about the command itself. The help section has a whole chapter on syntax highlighting if you call :help syntax.
    – SamStudio8
    Jul 16, 2013 at 8:50

You must log in to answer this question.