5

I'm using NERD Commenter. I want to add a new filetype to it. In the latest version, the filetypes definitions start in line 69. I want to add delimiters for .pde (Arduino). Since .pde files follow the same style as C++, I'm just copying the C++ line (line 115) and changing the extension. It looks like this:

....    
....    
\ 'pde': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
....    
....

And that seems right. However, I cannot get it to work when I open a .pde file. Instead of using '//', it uses '#'. Am I missing something?

Thanks!

UPDATE: It seems I'm doing it write. Look at the commit for when they added commenting support for gsp. They are just doing the same as me. Hmmm....

Xavier T.
  • 40,509
  • 10
  • 68
  • 97
Sparragus
  • 883
  • 1
  • 9
  • 24

1 Answers1

4

It is probably because the filetype pde does not exist in filetype.vim.

Basically you have to create you own filetype.vim in ~/.vim/ (which will be sourced before the system filetype.vim), or add to your .vimrc:
" Arduino files
au BufNewFile,BufRead *.pde setf pde

(On the other hand, gspdoes already exist in the default filetype.vim on line 763
" GNU Server Pages
au BufNewFile,BufRead *.gsp setf gsp
)

See :help new-filetype for more information on ways to implement a new file type.

Xavier T.
  • 40,509
  • 10
  • 68
  • 97
  • You are awesome! Thanks! I decided to name the filetype to 'arduino'. After all, the extension might be .pde, but the filetype is arduino. Thanks! :D – Sparragus Dec 08 '10 at 08:35