mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
parent
8c6a92c6e2
commit
ef7af078ef
@ -1,7 +1,8 @@
|
||||
" Vim compiler file
|
||||
" Compiler: reStructuredText Documentation Format
|
||||
" Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org
|
||||
" Description: reStructuredText Documentation Format
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
" Latest Revision: 2017-03-31
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@ -11,12 +12,18 @@ let current_compiler = "rst"
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal errorformat=
|
||||
\%f:%l:\ (%tEBUG/0)\ %m,
|
||||
\%f:%l:\ (%tNFO/1)\ %m,
|
||||
\%f:%l:\ (%tARNING/2)\ %m,
|
||||
\%f:%l:\ (%tRROR/3)\ %m,
|
||||
\%f:%l:\ (%tEVERE/3)\ %m,
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet errorformat=
|
||||
\%f\\:%l:\ %tEBUG:\ %m,
|
||||
\%f\\:%l:\ %tNFO:\ %m,
|
||||
\%f\\:%l:\ %tARNING:\ %m,
|
||||
\%f\\:%l:\ %tRROR:\ %m,
|
||||
\%f\\:%l:\ %tEVERE:\ %m,
|
||||
\%f\\:%s:\ %tARNING:\ %m,
|
||||
\%f\\:%s:\ %tRROR:\ %m,
|
||||
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
|
||||
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
|
||||
\%DMaking\ %*\\a\ in\ %f
|
||||
|
@ -616,7 +616,7 @@ FileChangedShell When Vim notices that the modification time of
|
||||
to tell Vim what to do next.
|
||||
NOTE: When this autocommand is executed, the
|
||||
current buffer "%" may be different from the
|
||||
buffer that was changed "<afile>".
|
||||
buffer that was changed, which is in "<afile>".
|
||||
NOTE: The commands must not change the current
|
||||
buffer, jump to another buffer or delete a
|
||||
buffer. *E246* *E811*
|
||||
|
@ -4079,12 +4079,15 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but
|
||||
includes an extra item in the list:
|
||||
[bufnum, lnum, col, off, curswant] ~
|
||||
The "curswant" number is the preferred column when moving the
|
||||
cursor vertically.
|
||||
cursor vertically. Also see |getpos()|.
|
||||
|
||||
This can be used to save and restore the cursor position: >
|
||||
let save_cursor = getcurpos()
|
||||
MoveTheCursorAround
|
||||
call setpos('.', save_cursor)
|
||||
<
|
||||
< Note that this only works within the window. See
|
||||
|winrestview()| for restoring more state.
|
||||
|
||||
getcwd([{winnr}[, {tabnr}]]) *getcwd()*
|
||||
With no arguments the result is a String, which is the name of
|
||||
the current effective working directory. With {winnr} or
|
||||
@ -4382,11 +4385,13 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
|
||||
getwinposx() The result is a Number, which is the X coordinate in pixels of
|
||||
the left hand side of the GUI Vim window. The result will be
|
||||
-1 if the information is not available.
|
||||
The value can be used with `:winpos`.
|
||||
|
||||
*getwinposy()*
|
||||
getwinposy() The result is a Number, which is the Y coordinate in pixels of
|
||||
the top of the GUI Vim window. The result will be -1 if the
|
||||
information is not available.
|
||||
The value can be used with `:winpos`.
|
||||
|
||||
getwininfo([{winid}]) *getwininfo()*
|
||||
Returns information about windows as a List with Dictionaries.
|
||||
@ -8271,7 +8276,7 @@ lispindent Compiled with support for lisp indenting.
|
||||
listcmds Compiled with commands for the buffer list |:files|
|
||||
and the argument list |arglist|.
|
||||
localmap Compiled with local mappings and abbr. |:map-local|
|
||||
mac macOS version of Vim.
|
||||
mac macOS version of Nvim.
|
||||
menu Compiled with support for |:menu|.
|
||||
mksession Compiled with support for |:mksession|.
|
||||
modify_fname Compiled with file name modifiers. |filename-modifiers|
|
||||
@ -10417,6 +10422,22 @@ missing: >
|
||||
: echo "You will _never_ see this message"
|
||||
:endif
|
||||
|
||||
To execute a command only when the |+eval| feature is disabled requires a trick,
|
||||
as this example shows: >
|
||||
if 1
|
||||
nnoremap : :"
|
||||
endif
|
||||
normal :set history=111<CR>
|
||||
if 1
|
||||
nunmap :
|
||||
endif
|
||||
|
||||
The "<CR>" here is a real CR character, type CTRL-V Enter to get it.
|
||||
|
||||
When the |+eval| feature is available the ":" is remapped to add a double
|
||||
quote, which has the effect of commenging-out the command. without the
|
||||
|+eval| feature the nnoremap command is skipped and the command is executed.
|
||||
|
||||
==============================================================================
|
||||
11. The sandbox *eval-sandbox* *sandbox* *E48*
|
||||
|
||||
|
@ -146,7 +146,8 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R*
|
||||
CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O*
|
||||
Insert the contents of a register literally and don't
|
||||
auto-indent. Does the same as pasting with the mouse
|
||||
|<MiddleMouse>|.
|
||||
|<MiddleMouse>|. When the register is linewise this will
|
||||
insert the text above the current line, like with `P`.
|
||||
Does not replace characters!
|
||||
The '.' register (last inserted text) is still inserted as
|
||||
typed.
|
||||
|
@ -274,7 +274,7 @@ function GetRIndent()
|
||||
let nlnum = s:Get_prev_line(nlnum)
|
||||
let nline = SanitizeRLine(getline(nlnum)) . nline
|
||||
endwhile
|
||||
if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
|
||||
if nline =~ '^\s*function\s*(' && indent(nlnum) == shiftwidth()
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
@ -285,7 +285,7 @@ function GetRIndent()
|
||||
|
||||
" line is an incomplete command:
|
||||
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$'
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
|
||||
" Deal with () and []
|
||||
@ -293,14 +293,14 @@ function GetRIndent()
|
||||
let pb = s:Get_paren_balance(line, '(', ')')
|
||||
|
||||
if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$'))
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
|
||||
let s:curtabstop = repeat(' ', &tabstop)
|
||||
|
||||
if g:r_indent_align_args == 1
|
||||
if pb > 0 && line =~ '{$'
|
||||
return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
|
||||
return s:Get_last_paren_idx(line, '(', ')', pb) + shiftwidth()
|
||||
endif
|
||||
|
||||
let bb = s:Get_paren_balance(line, '[', ']')
|
||||
@ -364,11 +364,11 @@ function GetRIndent()
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
else
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum) - &sw
|
||||
return indent(lnum) - shiftwidth()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@ -383,7 +383,7 @@ function GetRIndent()
|
||||
let line = linepiece . line
|
||||
endwhile
|
||||
if line =~ '{$' && post_block == 0
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
|
||||
" Now we can do some tests again
|
||||
@ -393,19 +393,19 @@ function GetRIndent()
|
||||
if post_block == 0
|
||||
let newl = SanitizeRLine(line)
|
||||
if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$'
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*else'
|
||||
if line =~ '<-\s*if\s*()'
|
||||
return indent(lnum) + &sw
|
||||
return indent(lnum) + shiftwidth()
|
||||
else
|
||||
if line =~ '\<if\s*()'
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) - &sw
|
||||
return indent(lnum) - shiftwidth()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@ -474,12 +474,12 @@ function GetRIndent()
|
||||
let ind = indent(lnum)
|
||||
|
||||
if g:r_indent_align_args == 0 && pb != 0
|
||||
let ind += pb * &sw
|
||||
let ind += pb * shiftwidth()
|
||||
return ind
|
||||
endif
|
||||
|
||||
if g:r_indent_align_args == 0 && bb != 0
|
||||
let ind += bb * &sw
|
||||
let ind += bb * shiftwidth()
|
||||
return ind
|
||||
endif
|
||||
|
||||
@ -489,7 +489,7 @@ function GetRIndent()
|
||||
let pind = 0
|
||||
endif
|
||||
|
||||
if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
|
||||
if ind == pind || (ind == (pind + shiftwidth()) && pline =~ '{$' && ppost_else == 0)
|
||||
return ind
|
||||
endif
|
||||
|
||||
@ -509,7 +509,7 @@ function GetRIndent()
|
||||
let pbb = s:Get_paren_balance(pline, '[', ']')
|
||||
endwhile
|
||||
let pind = indent(plnum)
|
||||
if ind == (pind + &sw) && pline =~ '{$'
|
||||
if ind == (pind + shiftwidth()) && pline =~ '{$'
|
||||
return ind
|
||||
endif
|
||||
endwhile
|
||||
|
@ -82,7 +82,7 @@ function GetRHelpIndent()
|
||||
let closeb = strlen(line2) - strlen(line3)
|
||||
let bb = openb - closeb
|
||||
|
||||
let ind = indent(lnum) + (bb * &sw)
|
||||
let ind = indent(lnum) + (bb * shiftwidth())
|
||||
|
||||
if line =~ '^\s*}\s*$'
|
||||
let ind = indent(lnum)
|
||||
|
@ -1,6 +1,6 @@
|
||||
" Vim script to work like "less"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2015 Nov 15
|
||||
" Last Change: 2017 Mar 31
|
||||
|
||||
" Avoid loading this file twice, allow the user to define his own script.
|
||||
if exists("loaded_less")
|
||||
@ -81,6 +81,10 @@ fun! s:Help()
|
||||
echo "\n"
|
||||
echo "/pattern Search for pattern ?pattern Search backward for pattern"
|
||||
echo "n next pattern match N Previous pattern match"
|
||||
if &foldmethod != "manual"
|
||||
echo "\n"
|
||||
echo "zR open all folds zm increase fold level"
|
||||
endif
|
||||
echo "\n"
|
||||
echo ":n<Enter> Next file :p<Enter> Previous file"
|
||||
echo "\n"
|
||||
@ -96,7 +100,11 @@ map <C-F> <Space>
|
||||
map <PageDown> <Space>
|
||||
map <kPageDown> <Space>
|
||||
map <S-Down> <Space>
|
||||
map z <Space>
|
||||
" If 'foldmethod' was changed keep the "z" commands, e.g. "zR" to open all
|
||||
" folds.
|
||||
if &foldmethod == "manual"
|
||||
map z <Space>
|
||||
endif
|
||||
map <Esc><Space> <Space>
|
||||
fun! s:NextPage()
|
||||
if line(".") == line("$")
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: AutoHotkey script file
|
||||
" Maintainer: Michael Wong
|
||||
" https://github.com/mmikeww/autohotkey.vim
|
||||
" Latest Revision: 2017-01-23
|
||||
" Latest Revision: 2017-04-03
|
||||
" Previous Maintainers: SungHyun Nam <goweol@gmail.com>
|
||||
" Nikolai Weibull <now@bitwi.se>
|
||||
|
||||
@ -106,6 +106,7 @@ syn keyword autohotkeyCommand
|
||||
\ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos
|
||||
\ StringLeft StringRight StringLower StringUpper StringMid StringReplace
|
||||
\ StringSplit StringTrimLeft StringTrimRight StringLen
|
||||
\ StrSplit StrReplace Throw
|
||||
\ Control ControlClick ControlFocus ControlGet ControlGetFocus
|
||||
\ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw
|
||||
\ ControlSetText Menu PostMessage SendMessage SetControlDelay
|
||||
@ -119,17 +120,18 @@ syn keyword autohotkeyCommand
|
||||
\ SetCapsLockState SetNumLockState SetScrollLockState
|
||||
|
||||
syn keyword autohotkeyFunction
|
||||
\ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr
|
||||
\ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func
|
||||
\ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage
|
||||
\ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan
|
||||
\ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback
|
||||
\ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen
|
||||
\ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet
|
||||
\ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject
|
||||
\ Format Exception
|
||||
|
||||
syn keyword autohotkeyStatement
|
||||
\ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return
|
||||
\ Suspend Reload
|
||||
\ Suspend Reload new class extends
|
||||
|
||||
syn keyword autohotkeyRepeat
|
||||
\ Loop
|
||||
@ -138,7 +140,7 @@ syn keyword autohotkeyConditional
|
||||
\ IfExist IfNotExist If IfEqual IfLess IfGreater Else
|
||||
\ IfWinExist IfWinNotExist IfWinActive IfWinNotActive
|
||||
\ IfNotEqual IfLessOrEqual IfGreaterOrEqual
|
||||
\ while until for in
|
||||
\ while until for in try catch finally
|
||||
|
||||
syn match autohotkeyPreProcStart
|
||||
\ nextgroup=
|
||||
@ -178,7 +180,7 @@ syn keyword autohotkeyPreProc
|
||||
\ Warn
|
||||
|
||||
syn keyword autohotkeyMatchClass
|
||||
\ ahk_group ahk_class ahk_id ahk_pid
|
||||
\ ahk_group ahk_class ahk_id ahk_pid ahk_exe
|
||||
|
||||
syn match autohotkeyNumbers
|
||||
\ display
|
||||
@ -217,7 +219,7 @@ syn match autohotkeyHotkey
|
||||
\ contains=autohotkeyKey,
|
||||
\ autohotkeyHotkeyDelimiter
|
||||
\ display
|
||||
\ '^.\{-}::'
|
||||
\ '^\s*\S*\%( Up\)\?::'
|
||||
|
||||
syn match autohotkeyKey
|
||||
\ contained
|
||||
|
@ -5,10 +5,10 @@
|
||||
" Tom Payne <tom@tompayne.org>
|
||||
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Thu Aug 25, 2016 08:52PM
|
||||
" Last Change: Sat Apr 08, 2017 07:01PM
|
||||
" Filenames: *.R *.r *.Rhistory *.Rt
|
||||
"
|
||||
" NOTE: The highlighting of R functions is defined in
|
||||
" NOTE: The highlighting of R functions might be defined in
|
||||
" runtime files created by a filetype plugin, if installed.
|
||||
"
|
||||
" CONFIGURATION:
|
||||
@ -18,7 +18,7 @@
|
||||
"
|
||||
" ROxygen highlighting can be turned off by
|
||||
"
|
||||
" let r_hl_roxygen = 0
|
||||
" let r_syntax_hl_roxygen = 0
|
||||
"
|
||||
" Some lines of code were borrowed from Zhuojun Chen.
|
||||
|
||||
@ -26,13 +26,25 @@ if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn iskeyword @,48-57,_,.
|
||||
if has("patch-7.4.1142")
|
||||
syn iskeyword @,48-57,_,.
|
||||
else
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
endif
|
||||
|
||||
" The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017.
|
||||
if exists("g:r_hl_roxygen")
|
||||
let g:r_syntax_hl_roxygen = g:r_hl_roxygen
|
||||
endif
|
||||
if exists("g:r_syn_minlines")
|
||||
let g:r_syntax_minlines = g:r_syn_minlines
|
||||
endif
|
||||
|
||||
if exists("g:r_syntax_folding") && g:r_syntax_folding
|
||||
setlocal foldmethod=syntax
|
||||
endif
|
||||
if !exists("g:r_hl_roxygen")
|
||||
let g:r_hl_roxygen = 1
|
||||
if !exists("g:r_syntax_hl_roxygen")
|
||||
let g:r_syntax_hl_roxygen = 1
|
||||
endif
|
||||
|
||||
syn case match
|
||||
@ -42,19 +54,106 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
|
||||
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
|
||||
|
||||
" Roxygen
|
||||
if g:r_hl_roxygen
|
||||
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
|
||||
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
|
||||
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
|
||||
if g:r_syntax_hl_roxygen
|
||||
" A roxygen block can start at the beginning of a file (first version) and
|
||||
" after a blank line (second version). It ends when a line that does not
|
||||
" contain a roxygen comment. In the following comments, any line containing
|
||||
" a roxygen comment marker (one or two hash signs # followed by a single
|
||||
" quote ' and preceded only by whitespace) is called a roxygen line. A
|
||||
" roxygen line containing only a roxygen comment marker, optionally followed
|
||||
" by whitespace is called an empty roxygen line.
|
||||
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
|
||||
" First we match all roxygen blocks as containing only a title. In case an
|
||||
" empty roxygen line ending the title or a tag is found, this will be
|
||||
" overriden later by the definitions of rOBlock.
|
||||
syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
|
||||
syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
|
||||
|
||||
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|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\|useDynLib\)"
|
||||
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
|
||||
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
|
||||
" When a roxygen block has a title and additional content, the title
|
||||
" consists of one or more roxygen lines (as little as possible are matched),
|
||||
" followed either by an empty roxygen line
|
||||
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
|
||||
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
|
||||
|
||||
" or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @).
|
||||
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
|
||||
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
|
||||
|
||||
" If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title
|
||||
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
|
||||
syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
|
||||
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
|
||||
syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
|
||||
|
||||
" A title as part of a block is always at the beginning of the block, i.e.
|
||||
" either at the start of a file or after a completely empty line.
|
||||
syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
|
||||
syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
|
||||
syn match rOTitleTag contained "@title"
|
||||
|
||||
syn match rOCommentKey "#\{1,2}'" contained
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
|
||||
|
||||
" rOTag list generated from the lists in
|
||||
" https://github.com/klutometis/roxygen/R/rd.R and
|
||||
" https://github.com/klutometis/roxygen/R/namespace.R
|
||||
" using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/
|
||||
" Plus we need the @include tag
|
||||
|
||||
" rd.R
|
||||
syn match rOTag contained "@aliases"
|
||||
syn match rOTag contained "@author"
|
||||
syn match rOTag contained "@backref"
|
||||
syn match rOTag contained "@concept"
|
||||
syn match rOTag contained "@describeIn"
|
||||
syn match rOTag contained "@description"
|
||||
syn match rOTag contained "@details"
|
||||
syn match rOTag contained "@docType"
|
||||
syn match rOTag contained "@encoding"
|
||||
syn match rOTag contained "@evalRd"
|
||||
syn match rOTag contained "@example"
|
||||
syn match rOTag contained "@examples"
|
||||
syn match rOTag contained "@family"
|
||||
syn match rOTag contained "@field"
|
||||
syn match rOTag contained "@format"
|
||||
syn match rOTag contained "@inherit"
|
||||
syn match rOTag contained "@inheritParams"
|
||||
syn match rOTag contained "@inheritDotParams"
|
||||
syn match rOTag contained "@inheritSection"
|
||||
syn match rOTag contained "@keywords"
|
||||
syn match rOTag contained "@method"
|
||||
syn match rOTag contained "@name"
|
||||
syn match rOTag contained "@md"
|
||||
syn match rOTag contained "@noMd"
|
||||
syn match rOTag contained "@noRd"
|
||||
syn match rOTag contained "@note"
|
||||
syn match rOTag contained "@param"
|
||||
syn match rOTag contained "@rdname"
|
||||
syn match rOTag contained "@rawRd"
|
||||
syn match rOTag contained "@references"
|
||||
syn match rOTag contained "@return"
|
||||
syn match rOTag contained "@section"
|
||||
syn match rOTag contained "@seealso"
|
||||
syn match rOTag contained "@slot"
|
||||
syn match rOTag contained "@source"
|
||||
syn match rOTag contained "@template"
|
||||
syn match rOTag contained "@templateVar"
|
||||
syn match rOTag contained "@title"
|
||||
syn match rOTag contained "@usage"
|
||||
" namespace.R
|
||||
syn match rOTag contained "@export"
|
||||
syn match rOTag contained "@exportClass"
|
||||
syn match rOTag contained "@exportMethod"
|
||||
syn match rOTag contained "@exportPattern"
|
||||
syn match rOTag contained "@import"
|
||||
syn match rOTag contained "@importClassesFrom"
|
||||
syn match rOTag contained "@importFrom"
|
||||
syn match rOTag contained "@importMethodsFrom"
|
||||
syn match rOTag contained "@rawNamespace"
|
||||
syn match rOTag contained "@S3method"
|
||||
syn match rOTag contained "@useDynLib"
|
||||
" other
|
||||
syn match rOTag contained "@include"
|
||||
endif
|
||||
|
||||
|
||||
@ -168,12 +267,28 @@ syn match rBraceError "[)}]" contained
|
||||
syn match rCurlyError "[)\]]" contained
|
||||
syn match rParenError "[\]}]" contained
|
||||
|
||||
if !exists("g:R_hi_fun")
|
||||
let g:R_hi_fun = 1
|
||||
" Use Nvim-R to highlight functions dynamically if it is installed
|
||||
if !exists("g:r_syntax_fun_pattern")
|
||||
let s:ff = split(substitute(globpath(&rtp, "R/functions.vim"), "functions.vim", "", "g"), "\n")
|
||||
if len(s:ff) > 0
|
||||
let g:r_syntax_fun_pattern = 0
|
||||
else
|
||||
let g:r_syntax_fun_pattern = 1
|
||||
endif
|
||||
endif
|
||||
if g:R_hi_fun
|
||||
|
||||
" Only use Nvim-R to highlight functions if they should not be highlighted
|
||||
" according to a generic pattern
|
||||
if g:r_syntax_fun_pattern == 1
|
||||
syn match rFunction '[0-9a-zA-Z_\.]\+\s*\ze('
|
||||
else
|
||||
if !exists("g:R_hi_fun")
|
||||
let g:R_hi_fun = 1
|
||||
endif
|
||||
if g:R_hi_fun
|
||||
" Nvim-R:
|
||||
runtime R/functions.vim
|
||||
endif
|
||||
endif
|
||||
|
||||
syn match rDollar display contained "\$"
|
||||
@ -205,8 +320,8 @@ if &filetype == "rhelp"
|
||||
syn match rhSection "\\dontrun\>"
|
||||
endif
|
||||
|
||||
if exists("r_syn_minlines")
|
||||
exe "syn sync minlines=" . r_syn_minlines
|
||||
if exists("r_syntax_minlines")
|
||||
exe "syn sync minlines=" . r_syntax_minlines
|
||||
else
|
||||
syn sync minlines=40
|
||||
endif
|
||||
@ -243,15 +358,17 @@ hi def link rStatement Statement
|
||||
hi def link rString String
|
||||
hi def link rStrError Error
|
||||
hi def link rType Type
|
||||
if g:r_hl_roxygen
|
||||
hi def link rOKeyword Title
|
||||
if g:r_syntax_hl_roxygen
|
||||
hi def link rOTitleTag Operator
|
||||
hi def link rOTag Operator
|
||||
hi def link rOTitleBlock Title
|
||||
hi def link rOBlock Comment
|
||||
hi def link rOBlockNoTitle Comment
|
||||
hi def link rOTitle Title
|
||||
hi def link rOCommentKey Comment
|
||||
hi def link rOExamples SpecialComment
|
||||
endif
|
||||
|
||||
|
||||
let b:current_syntax="r"
|
||||
|
||||
" vim: ts=8 sw=2
|
||||
|
@ -1,17 +1,26 @@
|
||||
" markdown Text with R statements
|
||||
" Language: markdown with R code chunks
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Jun 28, 2016 10:09AM
|
||||
" Last Change: Sat Jan 28, 2017 10:06PM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
" To highlight chunk headers as R code, put in your vimrc (e.g. .config/nvim/init.vim):
|
||||
" let rmd_syn_hl_chunk = 1
|
||||
"
|
||||
" For highlighting pandoc extensions to markdown like citations and TeX and
|
||||
" many other advanced features like folding of markdown sections, it is
|
||||
" recommended to install the vim-pandoc filetype plugin as well as the
|
||||
" vim-pandoc-syntax filetype plugin from https://github.com/vim-pandoc.
|
||||
"
|
||||
" TODO:
|
||||
" - Provide highlighting for rmarkdown parameters in yaml header
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" load all of pandoc info
|
||||
" load all of pandoc info, e.g. from
|
||||
" https://github.com/vim-pandoc/vim-pandoc-syntax
|
||||
runtime syntax/pandoc.vim
|
||||
if exists("b:current_syntax")
|
||||
let rmdIsPandoc = 1
|
||||
@ -22,28 +31,54 @@ else
|
||||
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")
|
||||
" load all of the yaml syntax highlighting rules into @yaml
|
||||
syntax include @yaml syntax/yaml.vim
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
" highlight yaml block commonly used for front matter
|
||||
syntax region rmdYamlBlock matchgroup=rmdYamlBlockDelim start="^---" matchgroup=rmdYamlBlockDelim end="^---" contains=@yaml keepend fold
|
||||
endif
|
||||
|
||||
if exists("g:rmd_syn_hl_chunk")
|
||||
" highlight R code inside chunk header
|
||||
syntax match rmdChunkDelim "^[ \t]*```{r" contained
|
||||
syntax match rmdChunkDelim "}$" contained
|
||||
if !exists("g:rmd_syn_langs")
|
||||
let g:rmd_syn_langs = ["r"]
|
||||
else
|
||||
syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
|
||||
let s:hasr = 0
|
||||
for s:lng in g:rmd_syn_langs
|
||||
if s:lng == "r"
|
||||
let s:hasr = 1
|
||||
endif
|
||||
endfor
|
||||
if s:hasr == 0
|
||||
let g:rmd_syn_langs += ["r"]
|
||||
endif
|
||||
endif
|
||||
syntax match rmdChunkDelim "^[ \t]*```$" contained
|
||||
syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
|
||||
|
||||
for s:lng in g:rmd_syn_langs
|
||||
exe 'syntax include @' . toupper(s:lng) . ' syntax/'. s:lng . '.vim'
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
exe 'syntax region rmd' . toupper(s:lng) . 'Chunk start="^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" end="^[ \t]*```$" contains=@' . toupper(s:lng) . ',rmd' . toupper(s:lng) . 'ChunkDelim keepend fold'
|
||||
|
||||
if exists("g:rmd_syn_hl_chunk") && s:lng == "r"
|
||||
" highlight R code inside chunk header
|
||||
syntax match rmdRChunkDelim "^[ \t]*```{r" contained
|
||||
syntax match rmdRChunkDelim "}$" contained
|
||||
else
|
||||
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" contained'
|
||||
endif
|
||||
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```$" contained'
|
||||
endfor
|
||||
|
||||
|
||||
" 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
|
||||
syntax region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend
|
||||
" I was not able to highlight rmdrInline inside a pandocLaTeXCommand, although
|
||||
" highlighting works within pandocLaTeXRegion and yamlFlowString.
|
||||
syntax cluster texMathZoneGroup add=rmdrInline
|
||||
|
||||
" match slidify special marker
|
||||
syntax match rmdSlidifySpecial "\*\*\*"
|
||||
@ -56,8 +91,6 @@ if rmdIsPandoc == 0
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
" Extend cluster
|
||||
syn cluster texMathZoneGroup add=rmdrInline
|
||||
" Inline
|
||||
syntax match rmdLaTeXInlDelim "\$"
|
||||
syntax match rmdLaTeXInlDelim "\\\$"
|
||||
@ -65,19 +98,24 @@ if rmdIsPandoc == 0
|
||||
" 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
|
||||
syntax match rmdLaTeXSt "\\[a-zA-Z]\+"
|
||||
syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXRegDelim keepend
|
||||
syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXRegDelim keepend
|
||||
hi def link rmdBlockQuote Comment
|
||||
hi def link rmdLaTeXSt Statement
|
||||
hi def link rmdLaTeXInlDelim Special
|
||||
hi def link rmdLaTeXRegDelim Special
|
||||
endif
|
||||
|
||||
syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
|
||||
for s:lng in g:rmd_syn_langs
|
||||
exe 'syn sync match rmd' . toupper(s:lng) . 'SyncChunk grouphere rmd' . toupper(s:lng) . 'Chunk /^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\)/'
|
||||
endfor
|
||||
|
||||
hi def link rmdChunkDelim Special
|
||||
hi def link rmdBeginInline Special
|
||||
hi def link rmdEndInline Special
|
||||
hi def link rmdBlockQuote Comment
|
||||
hi def link rmdYamlBlockDelim Delim
|
||||
for s:lng in g:rmd_syn_langs
|
||||
exe 'hi def link rmd' . toupper(s:lng) . 'ChunkDelim Special'
|
||||
endfor
|
||||
hi def link rmdInlineDelim Special
|
||||
hi def link rmdSlidifySpecial Special
|
||||
|
||||
let b:current_syntax = "rmd"
|
||||
|
Loading…
Reference in New Issue
Block a user