vim-pandoc-markdown-preview
vim-pandoc-markdown-preview copied to clipboard
Work with vim-pandoc plugin?
Some user use plugins such as https://github.com/vim-pandoc/vim-pandoc-syntax#standalone (especially because this plugin is for pandoc), and the ftdetect feature of this plugin may interact badly with the given plugin. (markdown / markdown.pandoc)
Suggestion: remove the ftdetect part entirely. (I think in the newest Vim version md files are automatically mapped to markdown by default)
That's right. I did three things and now this plugin cooperates with vim-pandoc and supports more file extensions:
-
Removed the
ftdetectdirectory altogether, sincevim-pandocdoes a more general job at detecting the file type. -
I rewrote the
BufWritePostto use a conditional based on the filetype, instead of relying on file extensions. This makes it more general because it can work with simplemarkdownfiles as detected by standardvimor other Markdown plugins, or withpandocfiles as detected byvim-pandoc. I'm usingautocmd BufWritePost * if &filetype == "pandoc" || &filetype == "markdown" | call s:CompileMd() | endif -
Added a hard link so
ftplugin/pandoc.vimandftplugin/markdown.vimare the same file. That way the previewer works with either filetype, again making this plugin work nicely with standardvim, othermarkdownplugins, andvim-pandoc.
I believe #12 should take care of this.