Monday, July 30, 2012

Re: Filetype detection on vim

On 7/29/2012 10:28 PM, Ben Fritz wrote:
> On Saturday, July 28, 2012 11:10:35 PM UTC-5, Tony Mechelynck wrote:
>> On 27/07/12 12:49, ansuman wrote:
>>
>>> Hi,
>>
>>>
>>
>>> I am not getting how to add a new filetype to vim. I am on windows and I am
>>
>>> using vim73.
>>
>>>
>>
>>> I want to add a new filetype with extention .pn. For this I had done
>>
>>> following:
>>
>>>
>>
>>> I went to vim installation directory i.e. vim73 and I edited filetype.vim. I
>>
>>> added following line
>>
>>>
>>
>>> au BufNewFile,BufRead *.pn setf potion
>>
>>>
>>
>>> in between augroup filetypedetect and augroup END
>>
>>
>>
>> Don't change anything in $VIMRUNTIME or below, any upgrade (next week or
>>
>> 10 years from now) may revert your changes without warning.
>>
>>
>>
>>>
>>
>>> Then I opened my vim with a file with extension .pn.
>>
>>> I typed following command
>>
>>> :set filetype?
>>
>>> and got answer
>>
>>> filetype=
>>
>>>
>>
>>> Am I doing any wrong?
>>
>>>
>>
>>> Please help.
>>
>>>
>>
>>> Thanks
>>
>>> Ansuman
>>
>>
>>
>> What I recommend is to add a new filetype.vim in one of the following
>>
>> places (shown as they would appear in Vim):
>>
>>
>>
>> - Single-user on Windows
>>
>> $HOME/vimfiles/filetype.vim
>>
>
> I actually prefer creating a file per filetype in $HOME/vimfiles/ftdetect, as detailed at the beginning of :help new-filetype
>
ft detection is always confusing for me.
are there a complete flow chart of how vim detect FT so we can have an
overview of the whole picture/story?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: