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.

3 Answers 3


Add something like this to ~/.vimrc:

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

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


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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