-1

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

2 Answers 2

1

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

1
  • thanks for your answer, indeed your advice solved my trouble :)
    – philippe
    Dec 3, 2011 at 17:16
1

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

1
  • Indeed, this solved my problem. Thanks for your advice! And the syntax setfiletype todo was correct
    – philippe
    Dec 3, 2011 at 17:15

Not the answer you're looking for? Browse other questions tagged .