blob: 3bed4b42cbcdb7d0e1f7c10851703c609e1b01d1 [file] [log] [blame]
Bram Moolenaardb6ea062014-07-10 22:01:47 +02001" Vim filetype plugin file
2" Language: Rnoweb
Christian Brabandtf9ca1392024-02-19 20:37:11 +01003" Maintainer: This runtime file is looking for a new maintainer.
4" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
5" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
6" Last Change: 2023 Feb 27 07:16PM
Doug Kearns93197fd2024-01-14 20:59:02 +01007" 2024 Jan 14 by Vim Project (browsefilter)
Christian Brabandtf9ca1392024-02-19 20:37:11 +01008" 2024 Feb 19 by Vim Project (announce adoption)
Bram Moolenaardb6ea062014-07-10 22:01:47 +02009
10" Only do this when not yet done for this buffer
11if exists("b:did_ftplugin")
12 finish
13endif
14
15let s:cpo_save = &cpo
16set cpo&vim
17
18runtime! ftplugin/tex.vim
19
20" Don't load another plugin for this buffer
21let b:did_ftplugin = 1
22
23" Enables Vim-Latex-Suite, LaTeX-Box if installed
24runtime ftplugin/tex_*.vim
25
26setlocal iskeyword=@,48-57,_,.
27setlocal suffixesadd=.bib,.tex
28setlocal comments=b:%,b:#,b:##,b:###,b:#'
29
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +020030if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
Doug Kearns93197fd2024-01-14 20:59:02 +010031 let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
32 if has("win32")
33 let b:browsefilter .= "All Files (*.*)\t*\n"
34 else
35 let b:browsefilter .= "All Files (*)\t*\n"
36 endif
Bram Moolenaardb6ea062014-07-10 22:01:47 +020037endif
38
Bram Moolenaar71badf92023-04-22 22:40:14 +010039function SetRnwCommentStr()
Bram Moolenaardd60c362023-02-27 15:49:53 +000040 if (search("^\s*<<.*>>=", "bncW") > search("^@", "bncW"))
41 set commentstring=#\ %s
42 else
43 set commentstring=%\ %s
44 endif
45endfunction
46
47" If you do not want both 'comments' and 'commentstring' dynamically defined,
48" put in your vimrc: let g:rnw_dynamic_comments = 0
49if !exists("g:rnw_dynamic_comments") || (exists("g:rnw_dynamic_comments") && g:rnw_dynamic_comments == 1)
50 augroup RnwCStr
51 autocmd!
52 autocmd CursorMoved <buffer> call SetRnwCommentStr()
53 augroup END
54endif
55
Bram Moolenaardb6ea062014-07-10 22:01:47 +020056if exists('b:undo_ftplugin')
Bram Moolenaar71badf92023-04-22 22:40:14 +010057 let b:undo_ftplugin .= " | setl isk< sua< com< cms< | unlet! b:browsefilter"
Bram Moolenaardb6ea062014-07-10 22:01:47 +020058else
Bram Moolenaar71badf92023-04-22 22:40:14 +010059 let b:undo_ftplugin = "setl isk< sua< com< cms< | unlet! b:browsefilter"
Bram Moolenaardb6ea062014-07-10 22:01:47 +020060endif
61
62let &cpo = s:cpo_save
63unlet s:cpo_save
64
65" vim: sw=2