vim-rmarkdown插件配置

vim-rmarkdown plugin configuration

我刚刚安装了 vim-rmarkdown、vim-pandoc 和 vim-pandoc-syntax 插件以及 Vundle(最新的 github 版本) .

当我在 vim 中打开 RMarkdown 文件 (.Rmd) 时,正如预期的那样,它检测到文件类型为 rmarkdown;它用 lambda 符号等标记 R 代码块的开始(替换```),正如我在示例 vim-rmarkdown 屏幕截图中看到的那样。

让我发疯的是 vim 决定突出显示一些字符串(无益地完全模糊了文本,就好像它被编辑了一样)。我通常会点击 space 来清除搜索词的突出显示;不是那样的。它还隐藏了 R 块的终止 ```;只有当您将光标移到该行上时它们才会可见。

任何人都可以帮忙:

  1. 指向 vim-rmarkdown FAQs/docs 的指针(:h rmarkdown 仅调用您在 github 页面上获得的相同基本信息),
  2. 为什么它会覆盖(用纯色突出显示)一些文本以及如何停止它,
  3. 如何显示 R 代码块的结尾 (```),或者更好地区分 "text" 和 R 代码块。

根据可用的 vim-rmarkdown 文档,我在 .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

可以找到您需要更改的相关设置in the vim-pandoc-syntax plugin

基本上,将其放入您的 .vimrc 应该可以解决问题:

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

如果向下滚动,您会发现一种更精细的方法来针对特定文件类型禁用此功能,以及针对特定覆盖的特定设置,但您似乎只想全面禁用它。

这似乎在文档中,但不是来自 vim-rmarkdown 的文档(我承认,这有点令人困惑)。尝试 :help pandoc-syntax,您应该会找到所有设置的说明。

可以在 :help conceal 中找到有关使用语法设置隐藏文本的一些一般说明。

感谢您提出问题,我想我也遇到了同样的问题。

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

据我所知,vim-rmarkdown 插件只是为 R 代码块和帮助文档中描述的 :RMarkdown 命令添加语法突出显示。您可能要查找的大部分文档都与 vim-pandoc 和 vim-pandoc 语法模块相关,因此 :help vim-pandoc:help vim-pandoc-syntax 涵盖了大部分问题。

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

我不知道你是否遇到了与我相同的问题,但由于拼写检查和我在终端中使用的特定配色方案(iTerm 具有深色配色方案),我看到了这种行为遮挡文字。通过关闭拼写检查 let g:pandoc#modules#disabled = ["spell"] 或修改配色方案(在我的情况下增加 iTerm 中的最小对比度设置有帮助)

为我解决了这个问题
  1. How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.

我对这个问题的解决方案是关闭隐藏,反正这让我很困惑。 (我不够聪明,无法处理编辑器对我隐藏的东西,所以我也关闭了折叠)对于想要隐藏的人来说,可能有更好的方法来处理这个问题,但我不知道。

我添加到我的 .vimrc 以管理我的问题的行 vim-rmarkdown:

" configuration for vim-pandoc and vim-rmarkdown
let g:pandoc#modules#disabled = ["folding", "spell"]
let g:pandoc#syntax#conceal#use = 0

只是整理一下我得到的有用答案,以防其他人遇到这个问题 post:

添加到我的 .vimrc,

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

直接解决了部分文本("words")被完全遮挡的问题(在我的dark-theme终端编辑器中);

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

直接解决了(对我来说)有点over-zealous隐藏代码段的问题。

:help pandoc-syntax

通常是非常有用的文档,用于控制语法突出显示使用我的 rmarkdown。

感谢大家。