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

vim-markdown Clashes with vim-r-plugin

Open tinyheero opened this issue 9 years ago • 5 comments

Hello,

It seems that when vim-markdown and vim-r-plugin, there is some clashing happening and removes the syntax highlighting in rmarkdown code chunks. For instance, when it is just the vim-r-plugin:

vim-with-r-plugin

When the vim-markdown plugin is installed with putting the following in my ~/.vimrc:

Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'

The syntax highlighting becomes all green.

vim-markdown-with-r-plugin

This is the same issue that was raised here - https://github.com/jcfaria/Vim-R-plugin/issues/186.

  • vim-markdown (version 9dd8d7c09eff15f845edfa88cb22df88a5b6b8c6)
  • vim-r-plugin (1.2.7)

tinyheero avatar Feb 21 '16 23:02 tinyheero

Same issue with Nvim-R / vim-markdown (#da5a7ac).

Would it be possible to either extend vim-markdown to support RMarkdown code blocks, e.g.

```{r optional_chunk_name, kwarg1="foo", kwarg2=3.5, etc..} (some code..) ```

Or, perhaps provide an option to disable syntax highlighting and allow it to be handled by other plugins?

khughitt avatar Sep 11 '19 12:09 khughitt

The Vim-R-plugin was superseded by Nvim-R. So maybe the issue could be renamed.

I still have the same issue. When I activate vim-markdown, I loose syntax highlight and autocomplete on R code chunks. This message from the author of N-vimR seems to be relevant https://github.com/jcfaria/Vim-R-plugin/issues/186#issuecomment-185138005 :

"I guess that whatever vim-markdown is doing, it should do only if &filetype == "markdown" or at least &filetype != "rmd". "

But in fact I would like to have both work in the same file. I have an auto command setting the file type to ft=rmd.markdown to have both file types for R markdown files. It seems like disabling the plugin for r code chunks might help.

I have posted a minimal reproducible example with 2 different .vimrc files and one markdown file under that issue: https://github.com/jalvesaq/Nvim-R/issues/505

paulrougieux avatar Jun 23 '20 10:06 paulrougieux

Did anyone ever find a way to disable vim-markdown for rmd files?

It's not even a "clash" of vim-markdown with nvim-r. Actually, vim-markdown just gets rmd highlighting wrong. I uninstalled nvim-r, and highlighting was still broken.

protist avatar Oct 21 '21 06:10 protist

I stopped using vim-markdown. Instead, I use the pandoc plugin for Markdown citation and syntax and the Voom plugin to generate table of contents and move/upgrade/downgrade sections of markdown documents.

Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'vim-voom/VOoM'

Voom file type association and creation of a Toc command

let voom_ft_modes = {'markdown': 'pandoc', 'pandoc': 'pandoc', 'rmd': 'pandoc', 'tex': 'latex', 'rnoweb' : 'latex'}

" Create a Toc command
augroup Toc
    autocmd!
    autocmd Filetype markdown command! -buffer Toc Voom
    autocmd Filetype rmd command! -buffer Toc Voom
    " rnoweb are the Rnw notebooks mixing latex and R code
    autocmd Filetype rnoweb command! -buffer Toc Voom
    autocmd Filetype tex command! -buffer Toc VimtexTocOpen
augroup END

paulrougieux avatar Oct 21 '21 09:10 paulrougieux

Thanks @paulrougieux. FWIW I had previously tested the vim-pandoc plugin, but I had found several bugs that were just too annoying for my particular workflow. In general I found vim-markdown less buggy (at least for the content in most my files).

I had a bit more of a search, but I couldn't find a generic way to disable a vim plugin for a particular filetype. Presumably this needs to be supported by the plugin's options itself, but I don't think vim-markdown can do this.

protist avatar Nov 05 '21 01:11 protist