1
0
forked from aniani/vim

Updated runtime files.

This commit is contained in:
Bram Moolenaar 2014-07-10 22:01:47 +02:00
parent 3ed8b1332f
commit db6ea06335
22 changed files with 636 additions and 52 deletions

View File

@ -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 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 The sort is stable, items which compare equal (as number or as
string) will keep their relative position. E.g., when sorting 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. same order as they were originally.
Also see |uniq()|. Also see |uniq()|.

View File

@ -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 VIM REFERENCE MANUAL by Bram Moolenaar
@ -1302,7 +1302,7 @@ HTML *ft-html-omni*
XHTML *ft-xhtml-omni* XHTML *ft-xhtml-omni*
CTRL-X CTRL-O provides completion of various elements of (X)HTML files. It is 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: other versions of HTML. Features:
- after "<" complete tag name depending on context (no div suggestion inside - after "<" complete tag name depending on context (no div suggestion inside

View File

@ -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 VIM REFERENCE MANUAL by Bram Moolenaar
@ -1506,7 +1506,7 @@ most of the information will be restored).
already set (registers, marks, |v:oldfiles|, etc.) already set (registers, marks, |v:oldfiles|, etc.)
will be overwritten {not in Vi} 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). :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
The information in the file is first read in to make The information in the file is first read in to make
a merge between old and new info. When [!] is used, a merge between old and new info. When [!] is used,

View File

@ -4323,6 +4323,7 @@ E882 eval.txt /*E882*
E883 eval.txt /*E883* E883 eval.txt /*E883*
E884 eval.txt /*E884* E884 eval.txt /*E884*
E885 sign.txt /*E885* E885 sign.txt /*E885*
E886 starting.txt /*E886*
E89 message.txt /*E89* E89 message.txt /*E89*
E90 message.txt /*E90* E90 message.txt /*E90*
E91 options.txt /*E91* E91 options.txt /*E91*

View File

@ -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 VIM REFERENCE MANUAL by Bram Moolenaar
@ -34,13 +34,7 @@ not be repeated below, unless there is extra information.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Sort is still not stable, add an index in the array. Forfeit test_listlbr when encoding is not utf8? (Danek Duvall)
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)
Regexp problems: Regexp problems:
- Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$' - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$'
@ -55,26 +49,17 @@ Regexp problems:
- Does not work with NFA regexp engine: - Does not work with NFA regexp engine:
\%u, \%x, \%o, \%d followed by a composing character \%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 Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28) work. (ZyX, 2013 Sep 28)
Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) 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 ":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29) 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 The entries added by matchaddpos() are returned by getmatches() but can't be
set with setmatches(). (lcd47, 2014 Jun 29) 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) 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) 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 "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) functions. (Christian Brabandt, 2013 May 8, update May 21)
Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14) Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14)
Second one. Update May 22. Second one. Update May 22.
Update by Daniel Hahler, 2014 Jul 4.
Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec)

View File

@ -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 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 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 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 Now use the mouse to click on "thisfile" in the top line. The result is

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types " Vim support file to detect file types
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " 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 " Listen very carefully, I will say this only once
if exists("did_load_filetypes") if exists("did_load_filetypes")
@ -864,7 +864,7 @@ func! s:FThtml()
setf xhtml setf xhtml
return return
endif endif
if getline(n) =~ '{%\s*\(extends\|block\)\>' if getline(n) =~ '{%\s*\(extends\|block\|load\)\>'
setf htmldjango setf htmldjango
return return
endif endif
@ -1649,6 +1649,20 @@ else
au BufNewFile,BufRead *.rnw,*.snw setf rnoweb au BufNewFile,BufRead *.rnw,*.snw setf rnoweb
endif 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 " Rexx, Rebol or R
au BufNewFile,BufRead *.r,*.R call s:FTr() 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 " 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 '#'. " 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 " Use the filetype detect plugins. They may overrule any of the previously

31
runtime/ftplugin/r.vim Normal file
View File

@ -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

View File

@ -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

43
runtime/ftplugin/rmd.vim Normal file
View File

@ -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

View File

@ -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

37
runtime/ftplugin/rrst.vim Normal file
View File

@ -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

17
runtime/ftplugin/text.vim Normal file
View File

@ -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=

111
runtime/indent/rhelp.vim Normal file
View File

@ -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

46
runtime/indent/rmd.vim Normal file
View File

@ -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

35
runtime/indent/rnoweb.vim Normal file
View File

@ -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

46
runtime/indent/rrst.vim Normal file
View File

@ -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

View File

@ -1,6 +1,6 @@
" Vim plugin for showing matching parens " Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2014 Jun 17 " Last Change: 2014 Jul 09
" Exit quickly when: " Exit quickly when:
" - this plugin was already loaded (or disabled) " - this plugin was already loaded (or disabled)
@ -54,14 +54,15 @@ function! s:Highlight_Matching_Pair()
let c_col = col('.') let c_col = col('.')
let before = 0 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 plist = split(&matchpairs, '.\zs[:,]')
let i = index(plist, c) let i = index(plist, c)
if i < 0 if i < 0
" not found, in Insert mode try character before the cursor " not found, in Insert mode try character before the cursor
if c_col > 1 && (mode() == 'i' || mode() == 'R') if c_col > 1 && (mode() == 'i' || mode() == 'R')
let before = 1 let before = 1
let c = getline(c_lnum)[c_col - 2] let c = text[c_col - 2]
let i = index(plist, c) let i = index(plist, c)
endif endif
if i < 0 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 " Find the match. When it was just before the cursor move it there for a
" moment. " moment.
if before > 0 if before > 0
let save_cursor = winsaveview() let save_cursor = getcurpos()
call cursor(c_lnum, c_col - before) call cursor(c_lnum, c_col - before)
endif endif
@ -147,7 +148,7 @@ function! s:Highlight_Matching_Pair()
endtry endtry
if before > 0 if before > 0
call winrestview(save_cursor) call setpos('.', save_cursor)
endif endif
" If a match is found setup match highlighting. " If a match is found setup match highlighting.

View File

@ -3,7 +3,7 @@
" Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com>
" Tom Payne <tom@tompayne.org> " 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 " Filenames: *.R *.r *.Rhistory *.Rt
" "
" NOTE: The highlighting of R functions is defined in the " NOTE: The highlighting of R functions is defined in the
@ -30,14 +30,16 @@ endif
syn case match syn case match
" Comment " Comment
syn match rComment contains=@Spell "#.*" syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
syn match rComment contains=@Spell,rCommentTodo "#.*"
" Roxygen " Roxygen
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" 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 "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" 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 "@\(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 "#'.*" syn match rOComment contains=@Spell,rOKeyword "#'.*"
@ -119,7 +121,7 @@ if &filetype != "rmd" && &filetype != "rrst"
else else
syn match rOperator "[|!<>^~`/:]" syn match rOperator "[|!<>^~`/:]"
endif endif
syn match rOperator "%\{2}\|%\S*%" syn match rOperator "%\{2}\|%\S\{-}%"
syn match rOpError '\*\{3}' syn match rOpError '\*\{3}'
syn match rOpError '//' syn match rOpError '//'
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 syn keyword rPreProc library require attach detach source
if &filetype == "rhelp" if &filetype == "rhelp"
syn match rHelpIdent '\\method' syn match rHelpIdent '\\method'
syn match rHelpIdent '\\S4method' syn match rHelpIdent '\\S4method'
endif endif
" Type " Type
@ -187,6 +189,7 @@ hi def link rArrow Statement
hi def link rBoolean Boolean hi def link rBoolean Boolean
hi def link rBraceError Error hi def link rBraceError Error
hi def link rComment Comment hi def link rComment Comment
hi def link rCommentTodo Todo
hi def link rOComment Comment hi def link rOComment Comment
hi def link rComplex Number hi def link rComplex Number
hi def link rConditional Conditional hi def link rConditional Conditional

View File

@ -2,9 +2,7 @@
" Language: R Help File " Language: R Help File
" Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de> " Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
" Last Change: Fri Oct 14, 2011 09:54PM " Last Change: Wed Jul 09, 2014 10:28PM
" Version: 0.7.4
" SVN: $Id: rhelp.vim 90 2010-11-22 10:58:11Z ranke $
" Remarks: - Includes R syntax highlighting in the appropriate " Remarks: - Includes R syntax highlighting in the appropriate
" sections if an r.vim file is in the same directory or in the " sections if an r.vim file is in the same directory or in the
" default debian location. " default debian location.
@ -23,6 +21,8 @@ elseif exists("b:current_syntax")
finish finish
endif endif
setlocal iskeyword=@,48-57,_,.
syn case match syn case match
" R help identifiers {{{1 " 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="\\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="\\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="\\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 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 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 syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend
" Verbatim like {{{1 " Verbatim like {{{1
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment if v:version > 703
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment 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 " Type Styles {{{1
syn match rhelpType "\\emph\>" syn match rhelpType "\\emph\>"
@ -200,6 +210,8 @@ syn match rhelpBraceError /[)}]/ contained
syn match rhelpCurlyError /[)\]]/ contained syn match rhelpCurlyError /[)\]]/ contained
syn match rhelpParenError /[\]}]/ contained syn match rhelpParenError /[\]}]/ contained
syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
" Define the default highlighting {{{1 " Define the default highlighting {{{1
" For version 5.7 and earlier: only when not done already " 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 " 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 endif
let b:current_syntax = "rhelp" let b:current_syntax = "rhelp"
" vim: foldmethod=marker:
" vim: foldmethod=marker sw=2

87
runtime/syntax/rmd.vim Normal file
View File

@ -0,0 +1,87 @@
" markdown Text with R statements
" Language: markdown with R code chunks
" Last Change: Wed Jul 09, 2014 10:29PM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
" let rmd_syn_hl_chunk = 1
" for portability
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" load all of pandoc info
runtime syntax/pandoc.vim
if exists("b:current_syntax")
let rmdIsPandoc = 1
unlet b:current_syntax
else
let rmdIsPandoc = 0
runtime syntax/markdown.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
endif
" load all of the r syntax highlighting rules into @R
syntax include @R syntax/r.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
if exists("g:rmd_syn_hl_chunk")
" highlight R code inside chunk header
syntax match rmdChunkDelim "^[ \t]*```{r" contained
syntax match rmdChunkDelim "}$" contained
else
syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
endif
syntax match rmdChunkDelim "^[ \t]*```$" contained
syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
" also match and syntax highlight in-line R code
syntax match rmdEndInline "`" contained
syntax match rmdBeginInline "`r " contained
syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend
" match slidify special marker
syntax match rmdSlidifySpecial "\*\*\*"
if rmdIsPandoc == 0
syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@<!\n\)*/ skipnl
" LaTeX
syntax include @LaTeX syntax/tex.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
" Inline
syntax match rmdLaTeXInlDelim "\$"
syntax match rmdLaTeXInlDelim "\\\$"
syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
" Region
syntax match rmdLaTeXRegDelim "\$\$" contained
syntax match rmdLaTeXRegDelim "\$\$latex$" contained
syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
hi def link rmdLaTeXSt Statement
hi def link rmdLaTeXInlDelim Special
hi def link rmdLaTeXRegDelim Special
endif
setlocal iskeyword=@,48-57,_,.
syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
hi def link rmdChunkDelim Special
hi def link rmdBeginInline Special
hi def link rmdEndInline Special
hi def link rmdBlockQuote Comment
hi def link rmdSlidifySpecial Special
let b:current_syntax = "rmd"
" vim: ts=8 sw=2

47
runtime/syntax/rrst.vim Normal file
View File

@ -0,0 +1,47 @@
" reStructured Text with R statements
" Language: reST with R code chunks
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
" Last Change: Wed Jul 09, 2014 10:29PM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
" let rrst_syn_hl_chunk = 1
" for portability
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" load all of the rst info
runtime syntax/rst.vim
unlet b:current_syntax
" load all of the r syntax highlighting rules into @R
syntax include @R syntax/r.vim
setlocal iskeyword=@,48-57,_,.
" highlight R chunks
if exists("g:rrst_syn_hl_chunk")
" highlight R code inside chunk header
syntax match rrstChunkDelim "^\.\. {r" contained
syntax match rrstChunkDelim "}$" contained
else
syntax match rrstChunkDelim "^\.\. {r .*}$" contained
endif
syntax match rrstChunkDelim "^\.\. \.\.$" contained
syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold
" also highlight in-line R code
syntax match rrstInlineDelim "`" contained
syntax match rrstInlineDelim ":r:" contained
syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend
hi def link rrstChunkDelim Special
hi def link rrstInlineDelim Special
let b:current_syntax = "rrst"
" vim: ts=8 sw=2