I'm trying to create my own syntax configuration file for vim.

I have then created a ~/.vim/filetype.vim file with the following content:

augroup filetypedetect autocmd BufNewFile,BufRead *.todo setfiletype todo augroup END

and the syntax configuration file lives in ~/.vim/todo.vim.

But this configuration file is not taken into account. I know the syntax to be right, because when I add its content to ~/.vimrc the syntax is applied. But to every files, and not only to those ending with .todo.

I have found this dirty hack to create a symbolic link from this file to /usr/share/vim/vim73/syntax/todo.vim.

This link will be deleted as soon as the vim package will be upgraded.

So is there a better way to perform this purpose?

Thanks a lot for your answer :)

link|improve this question

56% accept rate
feedback

2 Answers

The syntax file should live in ~/.vim/syntax, that's all.

link|improve this answer
thanks for your answer, indeed your advice solved my trouble :) – philippe Dec 3 '11 at 17:16
feedback

like what martian said.

the syntax file should live under ~/.vim/syntax/todo.vim
the plugin file should live under ~/.vim/filetype.vim

setting those will probably resolve your issue with detection, since the syntax in your filetype.vim seems correct.

what might be a funny issue is to have problems due to writing setfiletype todo instead of setfiletype=todo

link|improve this answer
Indeed, this solved my problem. Thanks for your advice! And the syntax setfiletype todo was correct – philippe Dec 3 '11 at 17:15
feedback

Your Answer

 
or
required, but never shown

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