vim-pandoc-markdown-preview icon indicating copy to clipboard operation
vim-pandoc-markdown-preview copied to clipboard

Work with vim-pandoc plugin?

Open user202729 opened this issue 4 years ago • 2 comments

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)

user202729 avatar Sep 04 '21 05:09 user202729

That's right. I did three things and now this plugin cooperates with vim-pandoc and supports more file extensions:

  • Removed the ftdetect directory altogether, since vim-pandoc does a more general job at detecting the file type.

  • I rewrote the BufWritePost to use a conditional based on the filetype, instead of relying on file extensions. This makes it more general because it can work with simple markdown files as detected by standard vim or other Markdown plugins, or with pandoc files as detected by vim-pandoc. I'm using

      autocmd BufWritePost * if &filetype == "pandoc" || &filetype == "markdown" | call s:CompileMd() | endif
    
  • Added a hard link so ftplugin/pandoc.vim and ftplugin/markdown.vim are the same file. That way the previewer works with either filetype, again making this plugin work nicely with standard vim, other markdown plugins, and vim-pandoc.

iamemhn avatar Jul 17 '23 03:07 iamemhn

I believe #12 should take care of this.

iamemhn avatar Jul 17 '23 04:07 iamemhn