On Jun 11, 2011 at 04:19 PM -0400, Eric Weir wrote:
As I understand it, I could create a "txt" filetype. While I'm not clear at this point how to do that, would there be any reason to prefer one method over the other, i.e., your suggestion or creating a new filetype?

Yes, you could. I'm not sure if that is the right way to go though for 'txt' files. The '.txt' extension is used for a lot of different kind of files; it might be a be bit too generic to assign it a filetype. On the other hand, you know your usage scenarios, so if you know that won't cause problems, go ahead. The reality of it is that if you are only setting one setting for '.txt' files, it's less typing in your .vimrc to just attach the settings to the file extension, bypassing the creation of a new file type.

However, if you can set a file's filetype on things other than just it's extension. For example, you can set it based on another part of it's filename or part of of it's path (directory). So you can see, there is some flexibility gained by using filetypes...

Here's an alternate suggestion. I seem to recall you are working in Markdown or MultiMarkdown, or some other light weight markup language. If that's the case, here's what I do: I downloaded one of the Markdown vim plugin which gave me nice syntax coloring and defined a Markdown filetype for me. Then all you have to do is use the extensions defined in the plugin, '.md' in the case of Markdown (of course, you can add your own as well which I did). Finally, for specific filetype settings, create a file in `~/.vim/after/ftpluging/filetype.vim`, replacing 'filetype' with the filetype you want to define settings for - I used 'markdown.vim'. Inside that file, put whatever vim commands you want, like enabling spell checking, turning on or off line numbers, etc. I'd use the 'setlocal' variant of set. Then, every time you open up a file ending in '.md', vim sets the filetype to 'markdown' and runs the settings you want.

--
You received this message from the "vim_mac" 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

Reply via email to