Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I make vim automatically apply c++ syntax highlight on Arduino files (.ino/.pde)?

Or how does vim syntax highlight know what is a c++ file? And how can I tell him that files that is called .ino and .pde is also c++ files.

share|improve this question
up vote 10 down vote accepted

Add something like this to ~/.vimrc:

autocmd BufNewFile,BufReadPost *.ino,*.pde set filetype=cpp

Or more correctly, to ~/.vim/ftdetect/cpp.vim.

share|improve this answer

You can create an autocommand as follows:

au BufRead,BufNewFile *.pde,*.ino set filetype=c++

Put this into your .vimrc to make the setting persistent.

share|improve this answer

Vim searches for syntax files named {name}.vim where name represents the language, for example cpp.vim for c++ files. If you want that an .ino file has his own syntax highlight create a file called ~/.vim/syntax/ino.vim and you can start use it with :set syntax=ino. In your case you can create a link to a cpp.vim file.

ln -s /usr/share/vim/vimcurrent/syntax/cpp.vim ~/.vim/syntax/ino.vim

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.