Mercurial > vim
annotate runtime/ftplugin/rmd.vim @ 24334:a6b803f72ff7
Added tag v8.2.2707 for changeset 47d55d8a93c9c1efec1a6a6d8a901ce08bf24d03
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Apr 2021 15:15:04 +0200 |
parents | 0ecb909e3249 |
children | 5bda4653aced |
rev | line source |
---|---|
6051 | 1 " Vim filetype plugin file |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
2 " Language: R Markdown file |
6051 | 3 " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6051
diff
changeset
|
4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
14637 | 5 " Last Change: Sun Jul 22, 2018 06:51PM |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
6 " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) |
6051 | 7 |
8 " Only do this when not yet done for this buffer | |
9 if exists("b:did_ftplugin") | |
10 finish | |
11 endif | |
12 | |
14637 | 13 if exists('g:rmd_include_html') && g:rmd_include_html |
14 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
15 endif |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
8497
diff
changeset
|
16 |
14637 | 17 setlocal comments=fb:*,fb:-,fb:+,n:> |
18 setlocal commentstring=#\ %s | |
6051 | 19 setlocal formatoptions+=tcqln |
20 setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ | |
21 setlocal iskeyword=@,48-57,_,. | |
22 | |
23 let s:cpo_save = &cpo | |
24 set cpo&vim | |
25 | |
14637 | 26 function! FormatRmd() |
27 if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW") | |
28 setlocal comments=:#',:###,:##,:# | |
29 else | |
30 setlocal comments=fb:*,fb:-,fb:+,n:> | |
31 endif | |
32 return 1 | |
33 endfunction | |
34 | |
35 " If you do not want 'comments' dynamically defined, put in your vimrc: | |
36 " let g:rmd_dynamic_comments = 0 | |
37 if !exists("g:rmd_dynamic_comments") || (exists("g:rmd_dynamic_comments") && g:rmd_dynamic_comments == 1) | |
38 setlocal formatexpr=FormatRmd() | |
39 endif | |
40 | |
41 | |
6051 | 42 " Enables pandoc if it is installed |
43 unlet! b:did_ftplugin | |
44 runtime ftplugin/pandoc.vim | |
45 | |
46 " Don't load another plugin for this buffer | |
47 let b:did_ftplugin = 1 | |
48 | |
49 if has("gui_win32") && !exists("b:browsefilter") | |
50 let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . | |
51 \ "All Files (*.*)\t*.*\n" | |
52 endif | |
53 | |
54 if exists('b:undo_ftplugin') | |
55 let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter" | |
56 else | |
57 let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter" | |
58 endif | |
59 | |
60 let &cpo = s:cpo_save | |
61 unlet s:cpo_save | |
62 | |
63 " vim: sw=2 |