Wednesday, June 22, 2011

Re: Exasperated with folding

On Jun 22, 2011, at 10:16 AM, Christian Brabandt wrote:

> On Wed, June 22, 2011 4:02 pm, Eric Weir wrote:
>>
>> On Jun 21, 2011, at 8:53 PM, Tim Gray wrote:
>>
>>> On Jun 21, 2011 at 08:44 PM -0400, Eric Weir wrote:
>>>> But that gives rise to another question: Could I associate other
>>>> extents with the markdown filetype, e.g., mmd?
>>>
>>> I mentioned how to do this on the spell checking thread we were
>>> corresponding on.
>>>
>>> au BufRead,BufNewFile *.ext :set ft=markdown
>>>
>>> Replace 'ext' with the extension that you want to add.
>>
>> I tried putting this in ~/.vim/after/ftplugin/markdown.vim and it didn't
>> work. I moved it to my .vimrc and it worked. I don't know if that's the
>> best place for it, though.
>
> You don't want that in a filetype plugin. Because after all, vim
> doesn't know yet, that it should handle the *.ext extension as markdown.
> So why do you expect it to read a markdown specific script?
> The correct solution is described in the help at:
> :h new-filetype

First, I misquoted in the command above. What I actually put in ~/.vim/after/ftplugin/markdown.vim, and subsequently in my .vimrc was:

au BufRead,BufNewFile *.mmd :set ft=markdown

Second, I am new to Vim and not a programmer. Use of the command above was suggested as a way to add an extent to those already recognized by the already existing markdown filetype. Before putting the command anywhere, I tried to find where the markdown filetype is defined, thinking that would provide guidance as to where the command adding the new extent should be placed, but I was unable to do so.

Finally, while I don't know anything, my understanding is that I don't need to create a new filetype, just to add one to those already recognized by an existing filetype. It seems that I've succeeded in doing that by placing the command in my .vimrc. Whether it's the proper or best solution -- as I say, I know nothing. Except that it works.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eeweir@bellsouth.net


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