diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-07-10 22:01:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-07-10 22:01:47 +0200 |
commit | db6ea063352ec1c88c7bc0839fa2bf75bae56cf0 (patch) | |
tree | d645ba12242f3155e172cd758dc832da80e30740 | |
parent | 3ed8b1332f7b84e40c89069e54d411d0ddfec3f1 (diff) |
Updated runtime files.
-rw-r--r-- | runtime/doc/eval.txt | 4 | ||||
-rw-r--r-- | runtime/doc/insert.txt | 4 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 4 | ||||
-rw-r--r-- | runtime/doc/tags | 1 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 29 | ||||
-rw-r--r-- | runtime/doc/usr_08.txt | 4 | ||||
-rw-r--r-- | runtime/filetype.vim | 20 | ||||
-rw-r--r-- | runtime/ftplugin/r.vim | 31 | ||||
-rw-r--r-- | runtime/ftplugin/rhelp.vim | 29 | ||||
-rw-r--r-- | runtime/ftplugin/rmd.vim | 43 | ||||
-rw-r--r-- | runtime/ftplugin/rnoweb.vim | 40 | ||||
-rw-r--r-- | runtime/ftplugin/rrst.vim | 37 | ||||
-rw-r--r-- | runtime/ftplugin/text.vim | 17 | ||||
-rw-r--r-- | runtime/indent/rhelp.vim | 111 | ||||
-rw-r--r-- | runtime/indent/rmd.vim | 46 | ||||
-rw-r--r-- | runtime/indent/rnoweb.vim | 35 | ||||
-rw-r--r-- | runtime/indent/rrst.vim | 46 | ||||
-rw-r--r-- | runtime/plugin/matchparen.vim | 11 | ||||
-rw-r--r-- | runtime/syntax/r.vim | 15 | ||||
-rw-r--r-- | runtime/syntax/rhelp.vim | 27 | ||||
-rw-r--r-- | runtime/syntax/rmd.vim | 87 | ||||
-rw-r--r-- | runtime/syntax/rrst.vim | 47 |
22 files changed, 636 insertions, 52 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 42cf14cbbc..d75799ab5b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Jul 02 +*eval.txt* For Vim version 7.4. Last change: 2014 Jul 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5653,7 +5653,7 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* The sort is stable, items which compare equal (as number or as string) will keep their relative position. E.g., when sorting - on numbers, text strings will sort next to eachother, in the + on numbers, text strings will sort next to each other, in the same order as they were originally. Also see |uniq()|. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 9b9445ae66..4136c91898 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.4. Last change: 2013 Jul 12 +*insert.txt* For Vim version 7.4. Last change: 2014 Jul 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1302,7 +1302,7 @@ HTML *ft-html-omni* XHTML *ft-xhtml-omni* CTRL-X CTRL-O provides completion of various elements of (X)HTML files. It is -designed to support writing of XHTML 1.0 Strict files but will also works for +designed to support writing of XHTML 1.0 Strict files but will also work for other versions of HTML. Features: - after "<" complete tag name depending on context (no div suggestion inside diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 14b0bbffa7..773a3b9125 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.4. Last change: 2014 Jun 14 +*starting.txt* For Vim version 7.4. Last change: 2014 Jul 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1506,7 +1506,7 @@ most of the information will be restored). already set (registers, marks, |v:oldfiles|, etc.) will be overwritten {not in Vi} - *:wv* *:wviminfo* *E137* *E138* *E574* + *:wv* *:wviminfo* *E137* *E138* *E574* *E886* :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above). The information in the file is first read in to make a merge between old and new info. When [!] is used, diff --git a/runtime/doc/tags b/runtime/doc/tags index f063350086..7605ccc996 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4323,6 +4323,7 @@ E882 eval.txt /*E882* E883 eval.txt /*E883* E884 eval.txt /*E884* E885 sign.txt /*E885* +E886 starting.txt /*E886* E89 message.txt /*E89* E90 message.txt /*E90* E91 options.txt /*E91* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 3752f2daf9..fc954cff0c 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Jul 04 +*todo.txt* For Vim version 7.4. Last change: 2014 Jul 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,13 +34,7 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- -Sort is still not stable, add an index in the array. -See patch from Takimoto. - -Another follow-up patch for breakindent. (Christian, 2014 Jun 28) - -After patch 7.4.305 the termresponse isn't requested at all? -(Tomas Janousek, 2014 Jul 1, Jul 2) +Forfeit test_listlbr when encoding is not utf8? (Danek Duvall) Regexp problems: - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$' @@ -55,26 +49,17 @@ Regexp problems: - Does not work with NFA regexp engine: \%u, \%x, \%o, \%d followed by a composing character +Patch to set y_width when getting the register from the clipboard. +(Yukihiro Nakadaira, 2014 Jul 10) + Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) -Patch to avoid inconsistency of using \v and \V after $ in regexp. -(Ozaki Kiichi, 2014 Jul 2) - ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) -Make matchparen faster by not using winsaveview()/winrestview(). -(Alexey Radkov, 2014 Jun 28) - -Patch to avoid flicker when filling the preview window. -(Hirohito Higashi, 2014 Jul 2) - -matchaddpos() doesn't handle wrong byte length well, e.g. using 1 on a -multi-byte charcter. (lcd47, 2014 Jun 29) - The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (lcd47, 2014 Jun 29) @@ -92,9 +77,6 @@ MS-Windows: Crash opening very long file name starting with "\\". Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) -Patch to translate 0xce in K_NUL 3. (Yasuhiro Matsumoto, 2014 June 6) -Update by Nobuhiro Takasaki, Jun 19. - Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 @@ -375,6 +357,7 @@ Patch to allow setting w:quickfix_title via setqflist() and setloclist() functions. (Christian Brabandt, 2013 May 8, update May 21) Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14) Second one. Update May 22. +Update by Daniel Hahler, 2014 Jul 4. Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) diff --git a/runtime/doc/usr_08.txt b/runtime/doc/usr_08.txt index 2ac6fea002..ef26b46eb7 100644 --- a/runtime/doc/usr_08.txt +++ b/runtime/doc/usr_08.txt @@ -1,4 +1,4 @@ -*usr_08.txt* For Vim version 7.4. Last change: 2006 Jul 18 +*usr_08.txt* For Vim version 7.4. Last change: 2014 Jul 06 VIM USER MANUAL - by Bram Moolenaar @@ -532,7 +532,7 @@ window. And you will notice a bar at the top with the two file names: You now have two tab pages. The first one has a window for "thisfile" and the second one a window for "thatfile". It's like two pages that are on top of -eachother, with a tab sticking out of each page showing the file name. +each other, with a tab sticking out of each page showing the file name. Now use the mouse to click on "thisfile" in the top line. The result is diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 17f0257fa2..677e9bbdb0 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jun 12 +" Last Change: 2014 Jul 09 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -864,7 +864,7 @@ func! s:FThtml() setf xhtml return endif - if getline(n) =~ '{%\s*\(extends\|block\)\>' + if getline(n) =~ '{%\s*\(extends\|block\|load\)\>' setf htmldjango return endif @@ -1649,6 +1649,20 @@ else au BufNewFile,BufRead *.rnw,*.snw setf rnoweb endif +" R Markdown file +if has("fname_case") + au BufNewFile,BufRead *.Rmd,*.rmd,*.Smd,*.smd setf rmd +else + au BufNewFile,BufRead *.rmd,*.smd setf rmd +endif + +" R reStructuredText file +if has("fname_case") + au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst setf rrst +else + au BufNewFile,BufRead *.rrst,*.srst setf rrst +endif + " Rexx, Rebol or R au BufNewFile,BufRead *.r,*.R call s:FTr() @@ -2664,7 +2678,7 @@ au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') " Plain text files, needs to be far down to not override others. This avoids " the "conf" type being used if there is a line starting with '#'. -au BufNewFile,BufRead *.txt,*.text setf text +au BufNewFile,BufRead *.txt,*.text,README setf text " Use the filetype detect plugins. They may overrule any of the previously diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim new file mode 100644 index 0000000000..43b208b842 --- /dev/null +++ b/runtime/ftplugin/r.vim @@ -0,0 +1,31 @@ +" Vim filetype plugin file +" Language: R +" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Sun Feb 23, 2014 04:07PM + +" Only do this when not yet done for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal iskeyword=@,48-57,_,. +setlocal formatoptions-=t +setlocal commentstring=#\ %s +setlocal comments=:#',:###,:##,:# + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "R Source Files (*.R)\t*.R\n" . + \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:browsefilter" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim new file mode 100644 index 0000000000..9b72fb42f9 --- /dev/null +++ b/runtime/ftplugin/rhelp.vim @@ -0,0 +1,29 @@ +" Vim filetype plugin file +" Language: R help file +" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 06:23PM + +" Only do this when not yet done for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal iskeyword=@,48-57,_,. + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl isk< | unlet! b:browsefilter" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim new file mode 100644 index 0000000000..55723ff396 --- /dev/null +++ b/runtime/ftplugin/rmd.vim @@ -0,0 +1,43 @@ +" Vim filetype plugin file +" Language: R help file +" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 06:23PM +" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann) + +" Only do this when not yet done for this buffer +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ +setlocal iskeyword=@,48-57,_,. + +let s:cpo_save = &cpo +set cpo&vim + +" Enables pandoc if it is installed +unlet! b:did_ftplugin +runtime ftplugin/pandoc.vim + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "All Files (*.*)\t*.*\n" +endif + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter" +else + let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim new file mode 100644 index 0000000000..baf53d0108 --- /dev/null +++ b/runtime/ftplugin/rnoweb.vim @@ -0,0 +1,40 @@ +" Vim filetype plugin file +" Language: Rnoweb +" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 06:23PM + +" Only do this when not yet done for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +runtime! ftplugin/tex.vim + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +" Enables Vim-Latex-Suite, LaTeX-Box if installed +runtime ftplugin/tex_*.vim + +setlocal iskeyword=@,48-57,_,. +setlocal suffixesadd=.bib,.tex +setlocal comments=b:%,b:#,b:##,b:###,b:#' + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "All Files (*.*)\t*.*\n" +endif + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= " | setl isk< sua< com< | unlet! b:browsefilter" +else + let b:undo_ftplugin = "setl isk< sua< com< | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim new file mode 100644 index 0000000000..8140169e61 --- /dev/null +++ b/runtime/ftplugin/rrst.vim @@ -0,0 +1,37 @@ +" Vim filetype plugin file +" Language: reStructuredText documentation format with R code +" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 06:23PM +" Original work by Alex Zvoleff + +" Only do this when not yet done for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ +setlocal iskeyword=@,48-57,_,. + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "All Files (*.*)\t*.*\n" +endif + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter" +else + let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 diff --git a/runtime/ftplugin/text.vim b/runtime/ftplugin/text.vim new file mode 100644 index 0000000000..ec84ac6f79 --- /dev/null +++ b/runtime/ftplugin/text.vim @@ -0,0 +1,17 @@ +" Vim filetype plugin +" Language: Text +" Maintainer: David Barnett <daviebdawg+vim@gmail.com> +" Last Change: 2014 Jul 09 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = 'setlocal comments< commentstring<' + +" We intentionally don't set formatoptions-=t since text should wrap as text. + +" Pseudo comment leaders to indent bulleted lists. +setlocal comments=fb:-,fb:* +setlocal commentstring= diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim new file mode 100644 index 0000000000..8cc5fdae3b --- /dev/null +++ b/runtime/indent/rhelp.vim @@ -0,0 +1,111 @@ +" Vim indent file +" Language: R Documentation (Help), *.Rd +" Author: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 07:34PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +runtime indent/r.vim +let s:RIndent = function(substitute(&indentexpr, "()", "", "")) +let b:did_indent = 1 + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetRHelpIndent() + +" Only define the function once. +if exists("*GetRHelpIndent") + finish +endif + +setlocal noautoindent +setlocal nocindent +setlocal nosmartindent +setlocal nolisp + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetCorrectRHelpIndent() + +function s:SanitizeRHelpLine(line) + let newline = substitute(a:line, '\\\\', "x", "g") + let newline = substitute(newline, '\\{', "x", "g") + let newline = substitute(newline, '\\}', "x", "g") + let newline = substitute(newline, '\\%', "x", "g") + let newline = substitute(newline, '%.*', "", "") + let newline = substitute(newline, '\s*$', "", "") + return newline +endfunction + +function GetRHelpIndent() + + let clnum = line(".") " current line + if clnum == 1 + return 0 + endif + let cline = getline(clnum) + + if cline =~ '^\s*}\s*$' + let i = clnum + let bb = -1 + while bb != 0 && i > 1 + let i -= 1 + let line = s:SanitizeRHelpLine(getline(i)) + let line2 = substitute(line, "{", "", "g") + let openb = strlen(line) - strlen(line2) + let line3 = substitute(line2, "}", "", "g") + let closeb = strlen(line2) - strlen(line3) + let bb += openb - closeb + endwhile + return indent(i) + endif + + if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>' + return 0 + endif + + let lnum = clnum - 1 + let line = getline(lnum) + if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>' + let lnum -= 1 + let line = getline(lnum) + endif + while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif') + let lnum -= 1 + let line = getline(lnum) + endwhile + if lnum == 1 + return 0 + endif + let line = s:SanitizeRHelpLine(line) + let line2 = substitute(line, "{", "", "g") + let openb = strlen(line) - strlen(line2) + let line3 = substitute(line2, "}", "", "g") + let closeb = strlen(line2) - strlen(line3) + let bb = openb - closeb + + let ind = indent(lnum) + (bb * &sw) + + if line =~ '^\s*}\s*$' + let ind = indent(lnum) + endif + + if ind < 0 + return 0 + endif + + return ind +endfunction + +function GetCorrectRHelpIndent() + let lastsection = search('^\\[a-z]*{', "bncW") + let secname = getline(lastsection) + if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}(' + return s:RIndent() + else + return GetRHelpIndent() + endif +endfunction + +" vim: sw=2 diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim new file mode 100644 index 0000000000..872790e7b1 --- /dev/null +++ b/runtime/indent/rmd.vim @@ -0,0 +1,46 @@ +" Vim indent file +" Language: Rmd +" Author: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 07:33PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +runtime indent/r.vim +let s:RIndent = function(substitute(&indentexpr, "()", "", "")) +let b:did_indent = 1 + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetRmdIndent() + +if exists("*GetRmdIndent") + finish +endif + +function GetMdIndent() + let pline = getline(v:lnum - 1) + let cline = getline(v:lnum) + if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum) + elseif pline =~ '^\s*[-\+\*]\s' + return indent(v:lnum - 1) + 2 + elseif pline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum - 1) + 3 + endif + return indent(prevnonblank(v:lnum - 1)) +endfunction + +function GetRmdIndent() + if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$' + return 0 + endif + if search('^```{r', "bncW") > search('^```$', "bncW") + return s:RIndent() + else + return GetMdIndent() + endif +endfunction + +" vim: sw=2 diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim new file mode 100644 index 0000000000..e69542bd1a --- /dev/null +++ b/runtime/indent/rnoweb.vim @@ -0,0 +1,35 @@ +" Vim indent file +" Language: Rnoweb +" Author: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 07:28PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +runtime indent/tex.vim +let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) +unlet b:did_indent +runtime indent/r.vim +let s:RIndent = function(substitute(&indentexpr, "()", "", "")) +let b:did_indent = 1 + +setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item +setlocal indentexpr=GetRnowebIndent() + +if exists("*GetRnowebIndent") + finish +endif + +function GetRnowebIndent() + if getline(".") =~ "^<<.*>>=$" + return 0 + endif + if search("^<<", "bncW") > search("^@", "bncW") + return s:RIndent() + endif + return s:TeXIndent() +endfunction + +" vim: sw=2 diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim new file mode 100644 index 0000000000..8bfa8344ce --- /dev/null +++ b/runtime/indent/rrst.vim @@ -0,0 +1,46 @@ +" Vim indent file +" Language: Rrst +" Author: Jakson Alves de Aquino <jalvesaq@gmail.com> +" Last Change: Wed Jul 09, 2014 07:33PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +runtime indent/r.vim +let s:RIndent = function(substitute(&indentexpr, "()", "", "")) +let b:did_indent = 1 + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetRrstIndent() + +if exists("*GetRrstIndent") + finish +endif + +function GetRstIndent() + let pline = getline(v:lnum - 1) + let cline = getline(v:lnum) + if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum) + elseif pline =~ '^\s*[-\+\*]\s' + return indent(v:lnum - 1) + 2 + elseif pline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum - 1) + 3 + endif + return indent(prevnonblank(v:lnum - 1)) +endfunction + +function GetRrstIndent() + if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$' + return 0 + endif + if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW") + return s:RIndent() + else + return GetRstIndent() + endif +endfunction + +" vim: sw=2 diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index b490f45ebb..23c79382ff 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jun 17 +" Last Change: 2014 Jul 09 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -54,14 +54,15 @@ function! s:Highlight_Matching_Pair() let c_col = col('.') let before = 0 - let c = getline(c_lnum)[c_col - 1] + let text = getline(c_lnum) + let c = text[c_col - 1] let plist = split(&matchpairs, '.\zs[:,]') let i = index(plist, c) if i < 0 " not found, in Insert mode try character before the cursor if c_col > 1 && (mode() == 'i' || mode() == 'R') let before = 1 - let c = getline(c_lnum)[c_col - 2] + let c = text[c_col - 2] let i = index(plist, c) endif if i < 0 @@ -87,7 +88,7 @@ function! s:Highlight_Matching_Pair() " Find the match. When it was just before the cursor move it there for a " moment. if before > 0 - let save_cursor = winsaveview() + let save_cursor = getcurpos() call cursor(c_lnum, c_col - before) endif @@ -147,7 +148,7 @@ function! s:Highlight_Matching_Pair() endtry if before > 0 - call winrestview(save_cursor) + call setpos('.', save_cursor) endif " If a match is found setup match highlighting. diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index 5e76e7af7f..85a6eaa2ae 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> " Tom Payne <tom@tompayne.org> -" Last Change: Sun May 19, 2013 05:59PM +" Last Change: Wed Jul 09, 2014 10:29PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -30,14 +30,16 @@ endif syn case match " Comment -syn match rComment contains=@Spell "#.*" +syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" +syn match rComment contains=@Spell,rCommentTodo "#.*" " Roxygen syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)" -syn match rOKeyword contained "@\(method\|nord\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" +syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" +syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)" syn match rOComment contains=@Spell,rOKeyword "#'.*" @@ -119,7 +121,7 @@ if &filetype != "rmd" && &filetype != "rrst" else syn match rOperator "[|!<>^~`/:]" endif -syn match rOperator "%\{2}\|%\S*%" +syn match rOperator "%\{2}\|%\S\{-}%" syn match rOpError '\*\{3}' syn match rOpError '//' syn match rOpError '&&&' @@ -164,8 +166,8 @@ syn match rLstElmt "@[a-zA-Z0-9\\._]*" contains=rDollar syn keyword rPreProc library require attach detach source if &filetype == "rhelp" - syn match rHelpIdent '\\method' - syn match rHelpIdent '\\S4method' + syn match rHelpIdent '\\method' + syn match rHelpIdent '\\S4method' endif " Type @@ -187,6 +189,7 @@ hi def link rArrow Statement hi def link rBoolean Boolean hi def link rBraceError Error hi def link rComment Comment +hi def link rCommentTodo Todo hi def link rOComment Comment hi def link rComplex Number hi def link rConditional Conditional diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index 0c07861d94..32c91add48 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -2,9 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: Fri Oct 14, 2011 09:54PM -" Version: 0.7.4 -" SVN: $Id: rhelp.vim 90 2010-11-22 10:58:11Z ranke $ +" Last Change: Wed Jul 09, 2014 10:28PM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. @@ -23,6 +21,8 @@ elseif exists("b:current_syntax") finish endif +setlocal iskeyword=@,48-57,_,. + syn case match " R help identifiers {{{1 @@ -51,7 +51,12 @@ syn region rhelpRcode matchgroup=Delimiter start="\\examples{" matchgroup=Delimi syn region rhelpRcode matchgroup=Delimiter start="\\usage{" matchgroup=Delimiter transparent end="}" contains=@R,rhelpIdentifier,rhelpS4method syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimiter transparent end="}" contains=@R syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end="}" contains=@R -syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@<!{.\{-}\\\@<!}' transparent end="}" contains=@R,rhelpDots,rhelpString,rhelpSpecialChar,rhelpLink keepend + +if v:version > 703 + syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@1<!{.\{-}\\\@1<!}' transparent end="}" contains=@R,rhelpDots,rhelpString,rhelpSpecialChar,rhelpLink keepend +else + syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@<!{.\{-}\\\@<!}' transparent end="}" contains=@R,rhelpDots,rhelpString,rhelpSpecialChar,rhelpLink keepend +endif syn region rhelpS4method matchgroup=Delimiter start="\\S4method{.*}(" matchgroup=Delimiter transparent end=")" contains=@R,rhelpDots syn region rhelpSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter transparent end="}" contains=@R @@ -127,8 +132,13 @@ syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" co syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend " Verbatim like {{{1 -syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment -syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment +if v:version > 703 + syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment + syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +else + syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment + syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment +endif " Type Styles {{{1 syn match rhelpType "\\emph\>" @@ -200,6 +210,8 @@ syn match rhelpBraceError /[)}]/ contained syn match rhelpCurlyError /[)\]]/ contained syn match rhelpParenError /[\]}]/ contained +syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{" + " Define the default highlighting {{{1 " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet @@ -233,4 +245,5 @@ if version >= 508 || !exists("did_rhelp_syntax_inits") endif let b:current_syntax = "rhelp" |