【问题标题】:vim-rmarkdown plugin configurationvim-rmarkdown 插件配置
【发布时间】:2015-12-16 14:10:19
【问题描述】:

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

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

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

谁能帮忙:

  1. 指向 vim-rmarkdown 常见问题解答/文档的指针(:h rmarkdown 仅调用您在 github 页面上获得的相同基本信息),
  2. 为什么会覆盖(用纯色突出显示)某些文本以及如何阻止它,
  3. 如何显示 R 代码块 (```) 的结尾,或者更好地区分“文本”和 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

【问题讨论】:

    标签: r vim r-markdown vim-plugin


    【解决方案1】:

    感谢您发布问题,我想我遇到了同样的问题。

    1. 指向 vim-rmarkdown 常见问题解答/文档的指针(:h rmarkdown 仅调用您在 github 页面上获得的相同基本信息),

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

    1. 为什么会覆盖(用纯色突出显示)某些文本以及如何阻止它,

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

    1. 如何显示 R 代码块 (```) 的结尾,或者更好地区分“文本”和 R 代码块。

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

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

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

    【讨论】:

    • 感谢 Arjun,您正确识别了这两个问题。我也有一个黑暗的终端主题;正如您所建议的那样,禁用拼写模块可以清除文本的遮挡。关闭隐藏对我来说也是一个好的开始,所以感谢您的两个提示。 (我已经对你的答案投了赞成票,但显然,在我获得更高的声誉分数之前它不会显示)
    【解决方案2】:

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

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

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

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

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

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

    【讨论】:

    • 谢谢 Andrew,我会跟进你的 pandoc-syntax 帮助(正如你所说,rmarkdown 特定的帮助不是很有启发性)。我对你的答案投了赞成票,但在我的声望提高之前它不会显示。
    【解决方案3】:

    只是为了汇总我得到的有用答案,以防其他人通过这篇文章:

    添加到我的 .vimrc,

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

    直接解决了部分文本(“单词”)被完全遮挡的问题(在我的深色主题终端编辑器中);

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

    直接解决了(对我而言)有点过分热衷于隐藏代码段的问题。

    :help pandoc-syntax
    

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

    谢谢大家。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多