Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 :)

share|improve this question

closed as off topic by SvW, quanta, Ward, mdpc, jscott Dec 12 '12 at 4:00

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

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

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

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

share|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

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