greyblake / vim-preview

Vim plugin for previewing markup files(markdown,rdoc,textile,html)
GNU General Public License v2.0
209 stars 29 forks source link

Use/prefer filetype instead of file extension for detection #20

Closed blueyed closed 12 years ago

blueyed commented 12 years ago

When trying to :Preview a foo.txt file (which has filetype rst), it fails with: Preview: don't know how to handle .txt format

Instead, it should have used the filetype to branch out to calling :PreviewRst.

greyblake commented 12 years ago

There is no strong convention to use txt as RST. It can be Textile or something else as well. If you want preview plugin to understand that all your txt files are RST you can easy customize it by adding the next line to you .vimrc file:

let g:PreviewRstExt .= ',txt'
blueyed commented 12 years ago

You misunderstood me: you should not use the file extensions, but the file type (as setup in Vim).

So after :set filetype=rst it would use :PreviewRst.

Instead of mapping file extensions to commands, you would map file types (as in &filetype).

greyblake commented 12 years ago

Oh! I see. Your idea is great, thanks!

greyblake commented 12 years ago

It's fixed with issue #24 by this commit: dd7bcfa