Friday, January 11, 2013

Re: How to highlight markdown headings in .txt files?

On Friday, January 11, 2013 7:22:43 PM UTC-7, Tim Chase wrote:
> On 01/11/13 20:10, wolfv wrote:
>
> > Vim will highlight markdown headings (e.g. #heading1) in files with the �.markdown� suffix.
>
> >
>
> > Is there a way to highlight markdown headings in files with the �.txt� sufix?
>
>
>
> My 7.2 doesn't seem to do markdown by default. However, you can
>
> override the 'filetype' in a .txt file by setting it to the same
>
> thing it is in a .markdown file. You can find this with the following:
>
>
>
> :e /path/to/file.markdown
>
> :set ft?
>
>
>
> take a note of the value, perhaps something obvious like "markdown".
>
> Then use it to set the 'filetype' in your .txt files:
>
>
>
> :e /path/to/markdownish_file.txt
>
> :set ft=markdown
>
>
>
> If it's something you want to do regularly, you could set up an
>
> autocmd to set the filetype every time you open a .txt file.
>
>
>
> -tim

Thanks Tim. That worked! I added this to my _vimrc file (I am using Vim 7.3):

" if .txt file, render markdown highlighting
au BufRead,BufNewFile *.txt setlocal ft=markdown

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