On 06/05/09 23:10, Gary Johnson wrote:
>
> On 2009-05-06, Miao Jiang wrote:
>> I write my own indent file indent/sphinx.vim for sphinx.conf
>> and add
>> au! BufRead,BufNewFile sphinx.* setfiletype sphinx
>> to the .vimrc
>>
>> but when I try edit sphinx.conf. the filetype still show conf instead
>> of sphinx.
>> How can I solve the problem?
>>
>> My vim version: 7.1.314 (Debian 5 vim-full)
>
> The simplest solution is to change your autocommand to use
>
>      set filetype=sphinx
>
> instead of
>
>      setfiletype sphinx
>
> so that the result would be
>
>      au! BufRead,BufNewFile sphinx.* set filetype=sphinx
>
> It would also work to move your current autocommand towards the top
> of your .vimrc, ahead of your "filetype plugin indent on" command.
>
> Both of these solutions worked for me, using vim-7.2.148.
>
> A more correct solution would be to follow the instructions here:
>
>      :help new-filetype
>
> HTH,
> Gary

Since with ":setf", the first setting wins, you should put that command 
in ~/.vim/filetype.vim or $VIM/vimfiles/filetype.vim but _not_ in an 
after-directory, and in an autocommand for the BufRead[Post],BufNewFile 
events in the "filetypedetect" (all lowercase and without the quotes) 
autocommand group.

When you run ":filetype [plugin] [indent] on", Vim will do the 
equivalent of ":runtime! filetype.vim" so your file in ~/.vim or 
$VIM/vimfiles/ will be sourced before the file of the same name in 
$VIMRUNTIME.


Best regards,
Tony.
-- 
The Abrams' Principle:
        The shortest distance between two points is off the wall.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to