vim-rmarkdown插件配置

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

当我在vim中打开一个RMarkdown文件(.Rmd),它会将文件类型识别为rmarkdown,并用lambda符号等标记R代码块的开始(替换```),就像我在vim-rmarkdown截图示例中看到的那样。但让我感到困惑的是,vim决定高亮一些字符串(完全遮盖了文本,就好像它被编辑一样)。通常我按空格键即可清除搜索术语的高亮显示;但这并不是那个问题。它还隐藏了R代码块的终止符```,只有在将光标移动到该行时才会变得可见。请问有哪位能帮忙:

1.提供vim-rmarkdown FAQs/docs的指引(: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
3个回答

7

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

  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代码块。

我的解决方法是关闭concealing,它只会让我感到困惑。(我不够聪明,无法处理编辑器从我隐藏的内容,所以我也关闭了折叠)对于希望使用concealing的人,可能有更好的处理方法,但我不知道。

我在我的.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,你把两个问题都识别对了。我也使用了黑色终端主题;禁用你建议的拼写模块,清除了文本的遮盖。关闭concealing对我来说也是一个好的开始,所以感谢你的建议。(我已经投票赞成你的答案,但显然要等我获得更高的声望才能显示出来) - doctorG

4

你需要更改的相关设置可以在 vim-pandoc-syntax插件中找到

基本上,将此放入您的.vimrc中应该解决此问题:

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

如果你向下滚动,你会找到一种更细致的方式来禁用特定文件类型和特定设置的覆盖,但似乎你只是想整体禁用它。
这似乎在文档中有提到,但不在vim-rmarkdown的文档中(我承认,这有点令人困惑)。尝试使用:help pandoc-syntax,你应该能够找到所有设置的说明。
关于使用语法设置隐藏文本的一些一般解释可以在:help conceal中找到。

谢谢Andrew,我会跟进你的pandoc-syntax帮助(正如你所说,rmarkdown特定的帮助并没有很有启发性)。我已经投票支持你的答案,但在我的声望提高之前不会显示。 - doctorG

1

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

在我的 .vimrc 文件中添加以下内容:

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

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

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

直接解决了对我来说有点过于热衷于隐藏代码段的问题。
:help pandoc-syntax

这是一份非常有用的文档,可以控制rmarkdown使用的语法高亮。

感谢大家。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接