Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim-rmarkdown plugin configuration

I've just installed vim-rmarkdown, vim-pandoc, and vim-pandoc-syntax plugins in conjunction with Vundle (latest github versions).

When I open an RMarkdown file (.Rmd) in vim, as expected it detects the filetype as rmarkdown; it marks the start of an R code chunk with a lambda symbol etc. (replacing the ```), as I've seen on an example vim-rmarkdown screenshot.

What is driving me nuts is that vim has decided to highlight some strings (unhelpfully completely obscuring the text as if it were redacted). I would normally hit space to clear the highlighting of search terms; it isn't that. It also hides terminating ``` for R chunks; they only become visible when you move the cursor over that line.

Can anyone help with:

  1. Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),
  2. Why it is overwriting (highlighting with solid colour) some text and how to stop it,
  3. How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.

As per the vim-rmarkdown documentation available, I've added the following to the start of my .vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'vim-pandoc/vim-rmarkdown'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
like image 590
doctorG Avatar asked Dec 16 '15 14:12

doctorG


3 Answers

Thanks for posting the question, I think I came across the same issues.

  1. Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),

As far as I can tell the vim-rmarkdown plugin just adds syntax highlighting for R code chunks and the :RMarkdown command described in the help docs. Most of the documentation that you're probably looking for is related to the vim-pandoc and vim-pandoc-syntax modules so :help vim-pandoc and :help vim-pandoc-syntax cover most of the issues.

  1. Why it is overwriting (highlighting with solid colour) some text and how to stop it,

I don't know if you're having the same issue I am, but I saw this behavior because of the spell checking and the particular color scheme I am using in my terminal (iTerm with a dark color scheme) obscuring the text. It was solved for me by either turning off spell checking let g:pandoc#modules#disabled = ["spell"] or modifying the color scheme (in my case increasing the minimum contrast setting in iTerm helped)

  1. How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.

My solution to this issue was to turn off concealing, it just confuses me anyway. (I'm not smart enough to handle an editor hiding stuff from me so I turn off folding too) There's probably a better way to deal with this for people who want concealing, but I don't know it.

The lines I added to my .vimrc to manage my issues with vim-rmarkdown:

" configuration for vim-pandoc and vim-rmarkdown
let g:pandoc#modules#disabled = ["folding", "spell"]
let g:pandoc#syntax#conceal#use = 0
like image 188
Arjun Prasad Avatar answered Nov 13 '22 13:11

Arjun Prasad


The relevant setting you need to change can be found in the vim-pandoc-syntax plugin

Basically, putting this in your .vimrc should solve the issue:

let g:pandoc#syntax#conceal#use = 0

If you scroll down, you'll find a more granular way to disable this for particular filetypes, and specific settings for specific overrides, but it seems like you just want to disable it wholesale.

This seems to be in the documentation, but not the one from vim-rmarkdown (which, I admit, is a bit confusing). Try :help pandoc-syntax and you should find explanations on all the settings.

Some general explanation on hiding text with syntax settings can be found with :help conceal.

like image 40
Andrew Radev Avatar answered Nov 13 '22 13:11

Andrew Radev


Just to pull together the helpful answers I got, in case anyone else comes by this post:

adding to my .vimrc,

let g:pandoc#modules#disabled = ["spell"]

directly solved the issue of some text ("words") being completely obscured (in my dark-theme terminal editor);

let g:pandoc#syntax#conceal#use = 0

directly resolved what (to me) was somewhat over-zealous concealing of code segments.

:help pandoc-syntax

is generally very useful documentation for controlling the syntax highlighting used my rmarkdown.

Thanks to all.

like image 1
doctorG Avatar answered Nov 13 '22 14:11

doctorG