mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
vim-patch:fc65cabb15d0
Update runtime files.
fc65cabb15
---
vim-patch:8.0.1279: initializing menus can be slow
Problem: Initializing menus can be slow, especially when there are many
keymaps, color schemes, etc.
Solution: Do the globbing for runtime files lazlily. (Ken Takata)
This commit is contained in:
parent
f5406dfe77
commit
2c7ed420d9
3382
runtime/autoload/haskellcomplete.vim
Normal file
3382
runtime/autoload/haskellcomplete.vim
Normal file
File diff suppressed because it is too large
Load Diff
@ -155,7 +155,7 @@ fun! tar#Browse(tarfile)
|
||||
let curlast= line("$")
|
||||
if tarfile =~# '\.\(gz\|tgz\)$'
|
||||
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
|
||||
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||
elseif tarfile =~# '\.lrp'
|
||||
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
|
||||
exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||
@ -292,7 +292,7 @@ fun! tar#Read(fname,mode)
|
||||
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||
elseif tarfile =~# '\.\(gz\|tgz\)$'
|
||||
" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
|
||||
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||
elseif tarfile =~# '\.lrp$'
|
||||
" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
|
||||
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||
|
@ -921,6 +921,13 @@ These three can be repeated and mixed. Examples:
|
||||
|
||||
expr8 *expr8*
|
||||
-----
|
||||
This expression is either |expr9| or a sequence of the alternatives below,
|
||||
in any order. E.g., these are all possible:
|
||||
expr9[expr1].name
|
||||
expr9.name[expr1]
|
||||
expr9(expr1, ...)[expr1].name
|
||||
|
||||
|
||||
expr8[expr1] item of String or |List| *expr-[]* *E111*
|
||||
*subscript*
|
||||
|
||||
|
@ -573,11 +573,31 @@ By default the following options are set, in accordance with PEP8: >
|
||||
|
||||
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
|
||||
|
||||
To disable this behaviour, set the following variable in your vimrc: >
|
||||
To disable this behavior, set the following variable in your vimrc: >
|
||||
|
||||
let g:python_recommended_style = 0
|
||||
|
||||
|
||||
R MARKDOWN *ft-rmd-plugin*
|
||||
|
||||
By default ftplugin/html.vim is not sourced. If you want it sourced, add to
|
||||
your |vimrc|: >
|
||||
let rmd_include_html = 1
|
||||
|
||||
The 'formatexpr' option is set dynamically with different values for R code
|
||||
and for Markdown code. If you prefer that 'formatexpr' is not set, add to your
|
||||
|vimrc|: >
|
||||
let rmd_dynamic_comments = 0
|
||||
|
||||
|
||||
R RESTRUCTURED TEXT *ft-rrst-plugin*
|
||||
|
||||
The 'formatexpr' option is set dynamically with different values for R code
|
||||
and for ReStructured text. If you prefer that 'formatexpr' is not set, add to
|
||||
your |vimrc|: >
|
||||
let rrst_dynamic_comments = 0
|
||||
|
||||
|
||||
RPM SPEC *ft-spec-plugin*
|
||||
|
||||
Since the text for this plugin is rather long it has been put in a separate
|
||||
|
@ -974,6 +974,11 @@ Below is an example of indentation with and without this option enabled:
|
||||
paste(x) paste(x)
|
||||
} }
|
||||
<
|
||||
The code will be indented after lines that match the pattern
|
||||
`'\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'`. If you want indentation after
|
||||
lines that match a different pattern, you should set the appropriate value of
|
||||
`r_indent_op_pattern` in your |vimrc|.
|
||||
|
||||
|
||||
SHELL *ft-sh-indent*
|
||||
|
||||
|
@ -1026,13 +1026,13 @@ The function must return the column where the completion starts. It must be a
|
||||
number between zero and the cursor column "col('.')". This involves looking
|
||||
at the characters just before the cursor and including those characters that
|
||||
could be part of the completed item. The text between this column and the
|
||||
cursor column will be replaced with the matches.
|
||||
cursor column will be replaced with the matches. If the returned value is
|
||||
larger than the cursor column, the cursor column is used.
|
||||
|
||||
Special return values:
|
||||
-1 If no completion can be done, the completion will be cancelled with an
|
||||
error message.
|
||||
-2 To cancel silently and stay in completion mode.
|
||||
-3 To cancel silently and leave completion mode.
|
||||
Negative return values:
|
||||
-2 To cancel silently and stay in completion mode.
|
||||
-3 To cancel silently and leave completion mode.
|
||||
Another negative value: completion starts at the cursor column
|
||||
|
||||
On the second invocation the arguments are:
|
||||
a:findstart 0
|
||||
|
@ -3201,8 +3201,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
so far, matches. The matched string is highlighted. If the pattern
|
||||
is invalid or not found, nothing is shown. The screen will be updated
|
||||
often, this is only useful on fast terminals.
|
||||
Also applies to the `:s`, `:g` and `:v` commands.
|
||||
Note that the match will be shown, but the cursor will return to its
|
||||
< Note that the match will be shown, but the cursor will return to its
|
||||
original position when no match is found and when pressing <Esc>. You
|
||||
still need to finish the search command with <Enter> to move the
|
||||
cursor to the match.
|
||||
|
@ -1243,7 +1243,7 @@ doxygen_javadoc_autobrief 1 Set to 0 to disable javadoc autobrief
|
||||
doxygen_end_punctuation '[.]' Set to regexp match for the ending
|
||||
punctuation of brief
|
||||
|
||||
There are also some hilight groups worth mentioning as they can be useful in
|
||||
There are also some highlight groups worth mentioning as they can be useful in
|
||||
configuration.
|
||||
|
||||
Highlight Effect ~
|
||||
@ -2610,6 +2610,48 @@ Any combination of these three variables is legal, but might highlight more
|
||||
commands than are actually available to you by the game.
|
||||
|
||||
|
||||
R *r.vim* *ft-r-syntax*
|
||||
|
||||
The parsing of R code for syntax highlight starts 40 lines backwards, but you
|
||||
can set a different value in your |vimrc|. Example: >
|
||||
let r_syntax_minlines = 60
|
||||
|
||||
You can also turn off syntax highlighting of ROxygen: >
|
||||
let r_syntax_hl_roxygen = 0
|
||||
|
||||
enable folding of code delimited by parentheses, square brackets and curly
|
||||
braces: >
|
||||
let r_syntax_folding = 1
|
||||
|
||||
and highlight as functions all keywords followed by an opening parenthesis: >
|
||||
let r_syntax_fun_pattern = 1
|
||||
|
||||
|
||||
R MARKDOWN *rmd.vim* *ft-rmd-syntax*
|
||||
|
||||
To disable syntax highlight of YAML header, add to your |vimrc|: >
|
||||
let rmd_syn_hl_yaml = 0
|
||||
|
||||
To disable syntax highlighting of citation keys: >
|
||||
let rmd_syn_hl_citations = 0
|
||||
|
||||
To highlight R code in knitr chunk headers: >
|
||||
let rmd_syn_hl_chunk = 1
|
||||
|
||||
By default, chunks of R code will be highlighted following the rules of R
|
||||
language. If you want proper syntax highlighting of chunks of other languages,
|
||||
you should add them to either `markdown_fenced_languages` or
|
||||
`rmd_fenced_languages`. For example to properly highlight both R and Python,
|
||||
you may add this to your |vimrc|: >
|
||||
let rmd_fenced_languages = ['r', 'python']
|
||||
|
||||
|
||||
R RESTRUCTURED TEXT *rrst.vim* *ft-rrst-syntax*
|
||||
|
||||
To highlight R code in knitr chunk headers, add to your |vimrc|: >
|
||||
let rrst_syn_hl_chunk = 1
|
||||
|
||||
|
||||
READLINE *readline.vim* *ft-readline-syntax*
|
||||
|
||||
The readline library is primarily used by the BASH shell, which adds quite a
|
||||
|
@ -283,6 +283,8 @@ machines. Therefore, don't rely on Vim always warning you.
|
||||
If you really don't want to see this message, you can add the 'A' flag to the
|
||||
'shortmess' option. But it's very unusual that you need this.
|
||||
|
||||
For programatic access to the swap file, see |swapinfo()|.
|
||||
|
||||
==============================================================================
|
||||
*11.4* Further reading
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Haskell
|
||||
" Maintainer: Daniel Campoverde <alx@sillybytes.net>
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2008-07-09
|
||||
" Latest Revision: 2018-08-27
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
@ -15,6 +16,7 @@ let b:undo_ftplugin = "setl com< cms< fo<"
|
||||
|
||||
setlocal comments=s1fl:{-,mb:-,ex:-},:-- commentstring=--\ %s
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
setlocal omnifunc=haskellcomplete#Complete
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: R Markdown file
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Mon Jun 06, 2016 09:41PM
|
||||
" Last Change: Sun Jul 22, 2018 06:51PM
|
||||
" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
@ -10,19 +10,12 @@ if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
|
||||
" Nvim-R plugin needs this
|
||||
if exists("*CompleteR")
|
||||
if &omnifunc == "CompleteR"
|
||||
let b:rplugin_nonr_omnifunc = ""
|
||||
else
|
||||
let b:rplugin_nonr_omnifunc = &omnifunc
|
||||
endif
|
||||
set omnifunc=CompleteR
|
||||
if exists('g:rmd_include_html') && g:rmd_include_html
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
endif
|
||||
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:>
|
||||
setlocal commentstring=#\ %s
|
||||
setlocal formatoptions+=tcqln
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
@ -30,6 +23,22 @@ setlocal iskeyword=@,48-57,_,.
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! FormatRmd()
|
||||
if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW")
|
||||
setlocal comments=:#',:###,:##,:#
|
||||
else
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:>
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" If you do not want 'comments' dynamically defined, put in your vimrc:
|
||||
" let g:rmd_dynamic_comments = 0
|
||||
if !exists("g:rmd_dynamic_comments") || (exists("g:rmd_dynamic_comments") && g:rmd_dynamic_comments == 1)
|
||||
setlocal formatexpr=FormatRmd()
|
||||
endif
|
||||
|
||||
|
||||
" Enables pandoc if it is installed
|
||||
unlet! b:did_ftplugin
|
||||
runtime ftplugin/pandoc.vim
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: reStructuredText documentation format with R code
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
" Last Change: Wed Nov 01, 2017 10:47PM
|
||||
" Original work by Alex Zvoleff
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
@ -16,11 +16,27 @@ let b:did_ftplugin = 1
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:>
|
||||
setlocal commentstring=#\ %s
|
||||
setlocal formatoptions+=tcqln
|
||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
|
||||
function! FormatRrst()
|
||||
if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW")
|
||||
setlocal comments=:#',:###,:##,:#
|
||||
else
|
||||
setlocal comments=fb:*,fb:-,fb:+,n:>
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" If you do not want 'comments' dynamically defined, put in your vimrc:
|
||||
" let g:rrst_dynamic_comments = 0
|
||||
if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g:rrst_dynamic_comments == 1)
|
||||
setlocal formatexpr=FormatRrst()
|
||||
endif
|
||||
|
||||
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"
|
||||
|
@ -3,9 +3,6 @@
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2011-07-08
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal indentexpr=GetDTDIndent()
|
||||
setlocal indentkeys=!^F,o,O,>
|
||||
setlocal nosmartindent
|
||||
@ -14,6 +11,9 @@ if exists("*GetDTDIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" TODO: Needs to be adjusted to stop at [, <, and ].
|
||||
let s:token_pattern = '^[^[:space:]]\+'
|
||||
|
||||
|
@ -663,7 +663,7 @@ func! s:CSSIndent()
|
||||
else
|
||||
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
|
||||
let prev_unfinished = s:CssUnfinished(prev_text)
|
||||
if !cur_hasfield && (prev_hasfield || prev_unfinished)
|
||||
if prev_unfinished
|
||||
" Continuation line has extra indent if the previous line was not a
|
||||
" continuation line.
|
||||
let extra = shiftwidth()
|
||||
@ -716,9 +716,13 @@ func! s:CSSIndent()
|
||||
endfunc "}}}
|
||||
|
||||
" Inside <style>: Whether a line is unfinished.
|
||||
" tag:
|
||||
" tag: blah
|
||||
" tag: blah &&
|
||||
" tag: blah ||
|
||||
func! s:CssUnfinished(text)
|
||||
"{{{
|
||||
return a:text =~ '\s\(||\|&&\|:\)\s*$'
|
||||
return a:text =~ '\(||\|&&\|:\|\k\)\s*$'
|
||||
endfunc "}}}
|
||||
|
||||
" Search back for the first unfinished line above "lnum".
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: R
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Thu Feb 18, 2016 06:32AM
|
||||
" Last Change: Sun Aug 19, 2018 09:13PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
@ -19,22 +19,16 @@ if exists("*GetRIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Options to make the indentation more similar to Emacs/ESS:
|
||||
if !exists("g:r_indent_align_args")
|
||||
let g:r_indent_align_args = 1
|
||||
endif
|
||||
if !exists("g:r_indent_ess_comments")
|
||||
let g:r_indent_ess_comments = 0
|
||||
endif
|
||||
if !exists("g:r_indent_comment_column")
|
||||
let g:r_indent_comment_column = 40
|
||||
endif
|
||||
if ! exists("g:r_indent_ess_compatible")
|
||||
let g:r_indent_ess_compatible = 0
|
||||
endif
|
||||
if ! exists("g:r_indent_op_pattern")
|
||||
let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
|
||||
endif
|
||||
let g:r_indent_align_args = get(g:, 'r_indent_align_args', 1)
|
||||
let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0)
|
||||
let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40)
|
||||
let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0)
|
||||
let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern',
|
||||
\ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$')
|
||||
|
||||
function s:RDelete_quotes(line)
|
||||
let i = 0
|
||||
@ -231,7 +225,7 @@ function GetRIndent()
|
||||
|
||||
let cline = SanitizeRLine(cline)
|
||||
|
||||
if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
|
||||
if cline =~ '^\s*}'
|
||||
let indline = s:Get_matching_brace(clnum, '{', '}', 1)
|
||||
if indline > 0 && indline != clnum
|
||||
let iline = SanitizeRLine(getline(indline))
|
||||
@ -244,6 +238,11 @@ function GetRIndent()
|
||||
endif
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*)$'
|
||||
let indline = s:Get_matching_brace(clnum, '(', ')', 1)
|
||||
return indent(indline)
|
||||
endif
|
||||
|
||||
" Find the first non blank line above the current line
|
||||
let lnum = s:Get_prev_line(clnum)
|
||||
" Hit the start of the file, use zero indent.
|
||||
@ -515,7 +514,9 @@ function GetRIndent()
|
||||
endwhile
|
||||
|
||||
return ind
|
||||
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: Rmd
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
" Last Change: Sun Aug 19, 2018 09:14PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
@ -20,7 +20,10 @@ if exists("*GetRmdIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function GetMdIndent()
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function s: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\+'
|
||||
@ -33,15 +36,31 @@ function GetMdIndent()
|
||||
return indent(prevnonblank(v:lnum - 1))
|
||||
endfunction
|
||||
|
||||
function s:GetYamlIndent()
|
||||
let pline = getline(v:lnum - 1)
|
||||
if pline =~ ':\s*$'
|
||||
return indent(v:lnum) + &sw
|
||||
elseif pline =~ '^\s*- '
|
||||
return indent(v:lnum) + 2
|
||||
endif
|
||||
return indent(prevnonblank(v:lnum - 1))
|
||||
endfunction
|
||||
|
||||
function GetRmdIndent()
|
||||
if getline(".") =~ '^[ \t]*```{r .*}$' || getline(".") =~ '^[ \t]*```$'
|
||||
return 0
|
||||
endif
|
||||
if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW")
|
||||
return s:RIndent()
|
||||
elseif v:lnum > 1 && search('^---$', "bnW") == 1 &&
|
||||
\ (search('^---$', "nW") > v:lnum || search('^...$', "nW") > v:lnum)
|
||||
return s:GetYamlIndent()
|
||||
else
|
||||
return GetMdIndent()
|
||||
return s:GetMdIndent()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2
|
||||
|
@ -21,7 +21,7 @@ else
|
||||
let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
|
||||
endif
|
||||
|
||||
unlet b:did_indent
|
||||
unlet! b:did_indent
|
||||
runtime indent/r.vim
|
||||
let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
|
||||
let b:did_indent = 1
|
||||
|
196
runtime/menu.vim
196
runtime/menu.vim
@ -2,7 +2,7 @@
|
||||
" You can also use this as a start for your own set of menus.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2017 Mar 04
|
||||
" Last Change: 2018 May 17
|
||||
|
||||
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
|
||||
" in all modes and avoid side effects from mappings defined by the user.
|
||||
@ -56,6 +56,13 @@ if exists("v:lang") || &langmenu != ""
|
||||
let s:lang = substitute(s:lang, '\.[^.]*', "", "")
|
||||
exe "runtime! lang/menu_" . s:lang . "[^a-z]*vim"
|
||||
|
||||
if !exists("did_menu_trans") && s:lang =~ '_'
|
||||
" If the language includes a region try matching without that region.
|
||||
" (e.g. find menu_de.vim if s:lang == de_DE).
|
||||
let langonly = substitute(s:lang, '_.*', "", "")
|
||||
exe "runtime! lang/menu_" . langonly . "[^a-z]*vim"
|
||||
endif
|
||||
|
||||
if !exists("did_menu_trans") && strlen($LANG) > 1 && s:lang !~ '^en_us'
|
||||
" On windows locale names are complicated, try using $LANG, it might
|
||||
" have been set by set_init_1(). But don't do this for "en" or "en_us".
|
||||
@ -159,7 +166,7 @@ nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p
|
||||
inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p
|
||||
nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p
|
||||
inoremenu &Edit.Put\ &After<Tab>]p <C-O>]p
|
||||
if has("win32") || has("win16")
|
||||
if has("win32")
|
||||
vnoremenu 20.390 &Edit.&Delete<Tab>x x
|
||||
endif
|
||||
noremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG :<C-U>call <SID>SelectAll()<CR>
|
||||
@ -167,7 +174,7 @@ inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>S
|
||||
cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR>
|
||||
|
||||
an 20.405 &Edit.-SEP2- <Nop>
|
||||
if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif")
|
||||
if has("win32") || has("gui_gtk") || has("gui_kde") || has("gui_motif")
|
||||
an 20.410 &Edit.&Find\.\.\. :promptfind<CR>
|
||||
vunmenu &Edit.&Find\.\.\.
|
||||
vnoremenu <silent> &Edit.&Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
|
||||
@ -194,6 +201,8 @@ fun! s:EditVimrc()
|
||||
else
|
||||
let fname = $VIM . "/_vimrc"
|
||||
endif
|
||||
elseif has("amiga")
|
||||
let fname = "s:.vimrc"
|
||||
else
|
||||
let fname = $HOME . "/.vimrc"
|
||||
endif
|
||||
@ -337,57 +346,77 @@ fun! s:FileFormat()
|
||||
endif
|
||||
endfun
|
||||
|
||||
let s:did_setup_color_schemes = 0
|
||||
|
||||
" Setup the Edit.Color Scheme submenu
|
||||
func! s:SetupColorSchemes() abort
|
||||
if s:did_setup_color_schemes
|
||||
return
|
||||
endif
|
||||
let s:did_setup_color_schemes = 1
|
||||
|
||||
" get NL separated string with file names
|
||||
let s:n = globpath(&runtimepath, "colors/*.vim")
|
||||
let n = globpath(&runtimepath, "colors/*.vim", 1, 1)
|
||||
let n += globpath(&runtimepath, "pack/*/start/*/colors/*.vim", 1, 1)
|
||||
let n += globpath(&runtimepath, "pack/*/opt/*/colors/*.vim", 1, 1)
|
||||
|
||||
" split at NL, ignore case for Windows, sort on name
|
||||
let s:names = sort(map(split(s:n, "\n"), 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1)
|
||||
" Ignore case for VMS and windows, sort on name
|
||||
let names = sort(map(n, 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1)
|
||||
|
||||
" define all the submenu entries
|
||||
let s:idx = 100
|
||||
for s:name in s:names
|
||||
exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>"
|
||||
let s:idx = s:idx + 10
|
||||
endfor
|
||||
unlet s:name s:names s:n s:idx
|
||||
" define all the submenu entries
|
||||
let idx = 100
|
||||
for name in names
|
||||
exe "an 20.450." . idx . ' &Edit.C&olor\ Scheme.' . name . " :colors " . name . "<CR>"
|
||||
let idx = idx + 10
|
||||
endfor
|
||||
silent! aunmenu &Edit.Show\ C&olor\ Schemes\ in\ Menu
|
||||
endfun
|
||||
if exists("do_no_lazyload_menus")
|
||||
call s:SetupColorSchemes()
|
||||
else
|
||||
an <silent> 20.450 &Edit.Show\ C&olor\ Schemes\ in\ Menu :call <SID>SetupColorSchemes()<CR>
|
||||
endif
|
||||
|
||||
|
||||
" Setup the Edit.Keymap submenu
|
||||
if has("keymap")
|
||||
let s:n = globpath(&runtimepath, "keymap/*.vim")
|
||||
if s:n != ""
|
||||
let s:idx = 100
|
||||
an 20.460.90 &Edit.&Keymap.None :set keymap=<CR>
|
||||
while strlen(s:n) > 0
|
||||
let s:i = stridx(s:n, "\n")
|
||||
if s:i < 0
|
||||
let s:name = s:n
|
||||
let s:n = ""
|
||||
else
|
||||
let s:name = strpart(s:n, 0, s:i)
|
||||
let s:n = strpart(s:n, s:i + 1, 19999)
|
||||
endif
|
||||
" Ignore case for Windows
|
||||
let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '')
|
||||
exe "an 20.460." . s:idx . ' &Edit.&Keymap.' . s:name . " :set keymap=" . s:name . "<CR>"
|
||||
unlet s:name
|
||||
unlet s:i
|
||||
let s:idx = s:idx + 10
|
||||
endwhile
|
||||
unlet s:idx
|
||||
let s:did_setup_keymaps = 0
|
||||
|
||||
func! s:SetupKeymaps() abort
|
||||
if s:did_setup_keymaps
|
||||
return
|
||||
endif
|
||||
let s:did_setup_keymaps = 1
|
||||
|
||||
let n = globpath(&runtimepath, "keymap/*.vim", 1, 1)
|
||||
if !empty(n)
|
||||
let idx = 100
|
||||
an 20.460.90 &Edit.&Keymap.None :set keymap=<CR>
|
||||
for name in n
|
||||
" Ignore case for VMS and windows
|
||||
let name = substitute(name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '')
|
||||
exe "an 20.460." . idx . ' &Edit.&Keymap.' . name . " :set keymap=" . name . "<CR>"
|
||||
let idx = idx + 10
|
||||
endfor
|
||||
endif
|
||||
silent! aunmenu &Edit.Show\ &Keymaps\ in\ Menu
|
||||
endfun
|
||||
if exists("do_no_lazyload_menus")
|
||||
call s:SetupKeymaps()
|
||||
else
|
||||
an <silent> 20.460 &Edit.Show\ &Keymaps\ in\ Menu :call <SID>SetupKeymaps()<CR>
|
||||
endif
|
||||
unlet s:n
|
||||
endif
|
||||
if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_mac")
|
||||
if has("win32") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac")
|
||||
an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR>
|
||||
endif
|
||||
|
||||
" Programming menu
|
||||
if !exists("g:ctags_command")
|
||||
let g:ctags_command = "ctags -R ."
|
||||
if has("vms")
|
||||
let g:ctags_command = "mc vim:ctags *.*"
|
||||
else
|
||||
let g:ctags_command = "ctags -R ."
|
||||
endif
|
||||
endif
|
||||
|
||||
an 40.300 &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]>
|
||||
@ -435,10 +464,10 @@ if has("spell")
|
||||
endif
|
||||
|
||||
let found = 0
|
||||
let s = globpath(&rtp, "spell/*." . enc . ".spl")
|
||||
if s != ""
|
||||
let s = globpath(&runtimepath, "spell/*." . enc . ".spl", 1, 1)
|
||||
if !empty(s)
|
||||
let n = 300
|
||||
for f in split(s, "\n")
|
||||
for f in s
|
||||
let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "")
|
||||
if nm != "en" && nm !~ '/'
|
||||
let _nm = nm
|
||||
@ -532,8 +561,12 @@ an <silent> 40.540 &Tools.Conve&rt\ Back<Tab>:%!xxd\ -r
|
||||
" set.
|
||||
func! s:XxdConv()
|
||||
let mod = &mod
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '"'
|
||||
if has("vms")
|
||||
%!mc vim:xxd
|
||||
else
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '"'
|
||||
endif
|
||||
if getline(1) =~ "^0000000:" " only if it worked
|
||||
set ft=xxd
|
||||
endif
|
||||
@ -542,8 +575,12 @@ endfun
|
||||
|
||||
func! s:XxdBack()
|
||||
let mod = &mod
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '" -r'
|
||||
if has("vms")
|
||||
%!mc vim:xxd -r
|
||||
else
|
||||
call s:XxdFind()
|
||||
exe '%!"' . g:xxdprogram . '" -r'
|
||||
endif
|
||||
set ft=
|
||||
doautocmd filetypedetect BufReadPost
|
||||
let &mod = mod
|
||||
@ -560,27 +597,46 @@ func! s:XxdFind()
|
||||
endif
|
||||
endfun
|
||||
|
||||
let s:did_setup_compilers = 0
|
||||
|
||||
" Setup the Tools.Compiler submenu
|
||||
let s:n = globpath(&runtimepath, "compiler/*.vim")
|
||||
let s:idx = 100
|
||||
while strlen(s:n) > 0
|
||||
let s:i = stridx(s:n, "\n")
|
||||
if s:i < 0
|
||||
let s:name = s:n
|
||||
let s:n = ""
|
||||
else
|
||||
let s:name = strpart(s:n, 0, s:i)
|
||||
let s:n = strpart(s:n, s:i + 1, 19999)
|
||||
func! s:SetupCompilers() abort
|
||||
if s:did_setup_compilers
|
||||
return
|
||||
endif
|
||||
" Ignore case for Windows
|
||||
let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
|
||||
exe "an 30.440." . s:idx . ' &Tools.Se&t\ Compiler.' . s:name . " :compiler " . s:name . "<CR>"
|
||||
unlet s:name
|
||||
unlet s:i
|
||||
let s:idx = s:idx + 10
|
||||
endwhile
|
||||
unlet s:n
|
||||
unlet s:idx
|
||||
let s:did_setup_compilers = 1
|
||||
|
||||
let n = globpath(&runtimepath, "compiler/*.vim", 1, 1)
|
||||
let idx = 100
|
||||
for name in n
|
||||
" Ignore case for VMS and windows
|
||||
let name = substitute(name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
|
||||
exe "an 30.440." . idx . ' &Tools.Se&t\ Compiler.' . name . " :compiler " . name . "<CR>"
|
||||
let idx = idx + 10
|
||||
endfor
|
||||
silent! aunmenu &Tools.Show\ Compiler\ Se&ttings\ in\ Menu
|
||||
endfun
|
||||
if exists("do_no_lazyload_menus")
|
||||
call s:SetupCompilers()
|
||||
else
|
||||
an <silent> 30.440 &Tools.Show\ Compiler\ Se&ttings\ in\ Menu :call <SID>SetupCompilers()<CR>
|
||||
endif
|
||||
|
||||
" Load ColorScheme, Compiler Setting and Keymap menus when idle.
|
||||
if !exists("do_no_lazyload_menus")
|
||||
func! s:SetupLazyloadMenus()
|
||||
call s:SetupColorSchemes()
|
||||
call s:SetupCompilers()
|
||||
if has("keymap")
|
||||
call s:SetupKeymaps()
|
||||
endif
|
||||
endfunc
|
||||
augroup SetupLazyloadMenus
|
||||
au!
|
||||
au CursorHold,CursorHoldI * call <SID>SetupLazyloadMenus() | au! SetupLazyloadMenus
|
||||
augroup END
|
||||
endif
|
||||
|
||||
|
||||
if !exists("no_buffers_menu")
|
||||
|
||||
@ -683,13 +739,21 @@ endfunc
|
||||
func! s:BMHash(name)
|
||||
" Make name all upper case, so that chars are between 32 and 96
|
||||
let nm = substitute(a:name, ".*", '\U\0', "")
|
||||
let sp = char2nr(' ')
|
||||
if has("ebcdic")
|
||||
" HACK: Replace all non alphabetics with 'Z'
|
||||
" Just to make it work for now.
|
||||
let nm = substitute(nm, "[^A-Z]", 'Z', "g")
|
||||
let sp = char2nr('A') - 1
|
||||
else
|
||||
let sp = char2nr(' ')
|
||||
endif
|
||||
" convert first six chars into a number for sorting:
|
||||
return (char2nr(nm[0]) - sp) * 0x800000 + (char2nr(nm[1]) - sp) * 0x20000 + (char2nr(nm[2]) - sp) * 0x1000 + (char2nr(nm[3]) - sp) * 0x80 + (char2nr(nm[4]) - sp) * 0x20 + (char2nr(nm[5]) - sp)
|
||||
endfunc
|
||||
|
||||
func! s:BMHash2(name)
|
||||
let nm = substitute(a:name, ".", '\L\0', "")
|
||||
" Not exactly right for EBCDIC...
|
||||
if nm[0] < 'a' || nm[0] > 'z'
|
||||
return '&others.'
|
||||
elseif nm[0] <= 'd'
|
||||
@ -1082,7 +1146,7 @@ if (exists("did_load_filetypes") || exists("syntax_on"))
|
||||
if exists("do_syntax_sel_menu")
|
||||
runtime! synmenu.vim
|
||||
else
|
||||
an 50.10 &Syntax.&Show\ File\ Types\ in\ Menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ File\ Types\ in\ Menu<CR>
|
||||
an <silent> 50.10 &Syntax.&Show\ File\ Types\ in\ Menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ File\ Types\ in\ Menu<CR>
|
||||
an 50.195 &Syntax.-SEP1- <Nop>
|
||||
endif
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
" Tom Payne <tom@tompayne.org>
|
||||
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Apr 08, 2017 07:01PM
|
||||
" Last Change: Wed Aug 01, 2018 10:10PM
|
||||
" Filenames: *.R *.r *.Rhistory *.Rt
|
||||
"
|
||||
" NOTE: The highlighting of R functions might be defined in
|
||||
@ -43,15 +43,17 @@ endif
|
||||
if exists("g:r_syntax_folding") && g:r_syntax_folding
|
||||
setlocal foldmethod=syntax
|
||||
endif
|
||||
if !exists("g:r_syntax_hl_roxygen")
|
||||
let g:r_syntax_hl_roxygen = 1
|
||||
endif
|
||||
|
||||
let g:r_syntax_hl_roxygen = get(g:, 'r_syntax_hl_roxygen', 1)
|
||||
|
||||
syn case match
|
||||
|
||||
" Comment
|
||||
syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
|
||||
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
|
||||
syn match rTodoParen contained "\(BUG\|FIXME\|NOTE\|TODO\)\s*(.\{-})\s*:" contains=rTodoKeyw,rTodoInfo transparent
|
||||
syn keyword rTodoKeyw BUG FIXME NOTE TODO contained
|
||||
syn match rTodoInfo "(\zs.\{-}\ze)" contained
|
||||
syn match rComment contains=@Spell,rCommentTodo,rTodoParen,rOBlock "#.*"
|
||||
|
||||
" Roxygen
|
||||
if g:r_syntax_hl_roxygen
|
||||
@ -65,7 +67,7 @@ if g:r_syntax_hl_roxygen
|
||||
|
||||
" 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.
|
||||
" overridden 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
|
||||
|
||||
@ -91,7 +93,7 @@ if g:r_syntax_hl_roxygen
|
||||
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 match rOCommentKey "^\s*#\{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
|
||||
@ -256,6 +258,7 @@ if exists("g:r_syntax_folding")
|
||||
syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
|
||||
syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold
|
||||
syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold
|
||||
syn region rSection matchgroup=Title start=/^#.*[-=#]\{4,}/ end=/^#.*[-=#]\{4,}/ms=s-2,me=s-1 transparent contains=ALL fold
|
||||
else
|
||||
syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError
|
||||
syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
|
||||
@ -282,13 +285,8 @@ endif
|
||||
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
|
||||
" Nvim-R:
|
||||
runtime R/functions.vim
|
||||
endif
|
||||
|
||||
syn match rDollar display contained "\$"
|
||||
@ -311,7 +309,7 @@ syn keyword rType array category character complex double function integer list
|
||||
|
||||
" Name of object with spaces
|
||||
if &filetype != "rmd" && &filetype != "rrst"
|
||||
syn region rNameWSpace start="`" end="`"
|
||||
syn region rNameWSpace start="`" end="`" contains=rSpaceFun
|
||||
endif
|
||||
|
||||
if &filetype == "rhelp"
|
||||
@ -331,7 +329,10 @@ hi def link rAssign Statement
|
||||
hi def link rBoolean Boolean
|
||||
hi def link rBraceError Error
|
||||
hi def link rComment Comment
|
||||
hi def link rTodoParen Comment
|
||||
hi def link rTodoInfo SpecialComment
|
||||
hi def link rCommentTodo Todo
|
||||
hi def link rTodoKeyw Todo
|
||||
hi def link rComplex Number
|
||||
hi def link rConditional Conditional
|
||||
hi def link rConstant Constant
|
||||
@ -341,6 +342,7 @@ hi def link rDollar SpecialChar
|
||||
hi def link rError Error
|
||||
hi def link rFloat Float
|
||||
hi def link rFunction Function
|
||||
hi def link rSpaceFun Function
|
||||
hi def link rHelpIdent Identifier
|
||||
hi def link rhPreProc PreProc
|
||||
hi def link rhSection PreCondit
|
||||
|
@ -1,123 +1,118 @@
|
||||
" markdown Text with R statements
|
||||
" Language: markdown with R code chunks
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Jan 28, 2017 10:06PM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc (e.g. .config/nvim/init.vim):
|
||||
" let rmd_syn_hl_chunk = 1
|
||||
" Last Change: Sat Aug 25, 2018 03:44PM
|
||||
"
|
||||
" 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, e.g. from
|
||||
" Configuration if not using pandoc syntax:
|
||||
" Add syntax highlighting of YAML header
|
||||
let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1)
|
||||
" Add syntax highlighting of citation keys
|
||||
let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1)
|
||||
" Highlight the header of the chunk of R code
|
||||
let g:rmd_syn_hl_chunk = get(g:, 'g:rmd_syn_hl_chunk', 0)
|
||||
|
||||
" Pandoc-syntax has more features, but it is slower.
|
||||
" https://github.com/vim-pandoc/vim-pandoc-syntax
|
||||
let g:pandoc#syntax#codeblocks#embeds#langs = get(g:, 'pandoc#syntax#codeblocks#embeds#langs', ['r'])
|
||||
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
|
||||
|
||||
" 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
|
||||
" Fix recognition of R code
|
||||
syn region pandocDelimitedCodeBlock_r start=/^```{r\>.*}$/ end=/^```$/ contained containedin=pandocDelimitedCodeBlock contains=@R
|
||||
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend
|
||||
hi def link rmdInlineDelim Delimiter
|
||||
let b:current_syntax = "rmd"
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:rmd_syn_langs")
|
||||
let g:rmd_syn_langs = ["r"]
|
||||
else
|
||||
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"]
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" R chunks will not be highlighted by syntax/markdown because their headers
|
||||
" follow a non standard pattern: "```{lang" instead of "^```lang".
|
||||
" Make a copy of g:markdown_fenced_languages to highlight the chunks later:
|
||||
if exists('g:markdown_fenced_languages')
|
||||
if !exists('g:rmd_fenced_languages')
|
||||
let g:rmd_fenced_languages = deepcopy(g:markdown_fenced_languages)
|
||||
let g:markdown_fenced_languages = []
|
||||
endif
|
||||
else
|
||||
let g:rmd_fenced_languages = ['r']
|
||||
endif
|
||||
|
||||
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'
|
||||
runtime syntax/markdown.vim
|
||||
|
||||
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
|
||||
" Now highlight chunks:
|
||||
for s:type in g:rmd_fenced_languages
|
||||
if s:type =~ '='
|
||||
let s:lng = substitute(s:type, '=.*', '')
|
||||
let s:nm = substitute(s:type, '.*=', '')
|
||||
else
|
||||
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" contained'
|
||||
let s:lng = s:type
|
||||
let s:nm = s:type
|
||||
endif
|
||||
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```$" contained'
|
||||
unlet! b:current_syntax
|
||||
exe 'syn include @Rmd'.s:nm.' syntax/'.s:lng.'.vim'
|
||||
if g:rmd_syn_hl_chunk
|
||||
exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmd'.s:nm
|
||||
exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm
|
||||
else
|
||||
exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@Rmd'.s:nm
|
||||
endif
|
||||
exe 'syn region rmd'.s:nm.'Inline matchgroup=rmdInlineDelim start="`'.s:nm.' " end="`" contains=@Rmd'.s:nm.' keepend'
|
||||
endfor
|
||||
unlet! s:type
|
||||
|
||||
hi def link rmdInlineDelim Delimiter
|
||||
hi def link rmdCodeDelim Delimiter
|
||||
|
||||
" also match and syntax highlight in-line R code
|
||||
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 "\*\*\*"
|
||||
|
||||
|
||||
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 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
|
||||
" You don't need this if either your markdown/syntax.vim already highlights
|
||||
" the YAML header or you are writing standard markdown
|
||||
if g:rmd_syn_hl_yaml
|
||||
" Minimum highlighting of yaml header
|
||||
syn match rmdYamlFieldTtl /^\s*\zs\w*\ze:/ contained
|
||||
syn match rmdYamlFieldTtl /^\s*-\s*\zs\w*\ze:/ contained
|
||||
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"' contains=yamlEscape,rmdrInline contained
|
||||
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'" contains=yamlSingleEscape,rmdrInline contained
|
||||
syn match yamlEscape contained '\\\%([\\"abefnrtv\^0_ NLP\n]\|x\x\x\|u\x\{4}\|U\x\{8}\)'
|
||||
syn match yamlSingleEscape contained "''"
|
||||
syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=rmdYamlFieldTtl,yamlFlowString
|
||||
hi def link rmdYamlBlockDelim Delimiter
|
||||
hi def link rmdYamlFieldTtl Identifier
|
||||
hi def link yamlFlowString String
|
||||
endif
|
||||
|
||||
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 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
|
||||
" You don't need this if either your markdown/syntax.vim already highlights
|
||||
" citations or you are writing standard markdown
|
||||
if g:rmd_syn_hl_citations
|
||||
" From vim-pandoc-syntax
|
||||
" parenthetical citations
|
||||
syn match pandocPCite /\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display
|
||||
" in-text citations with location
|
||||
syn match pandocICite /@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\s\[.\{-1,}\]/ contains=pandocCiteKey,@Spell display
|
||||
" cite keys
|
||||
syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
|
||||
syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
|
||||
syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
|
||||
hi def link pandocPCite Operator
|
||||
hi def link pandocICite Operator
|
||||
hi def link pandocCiteKey Label
|
||||
hi def link pandocCiteAnchor Operator
|
||||
hi def link pandocCiteLocator Operator
|
||||
endif
|
||||
|
||||
let b:current_syntax = "rmd"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: ts=8 sw=2
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: R noweb Files
|
||||
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: Sat Feb 06, 2016 06:47AM
|
||||
" Last Change: Thu Apr 05, 2018 11:06PM
|
||||
" Version: 0.9.1
|
||||
" Remarks: - This file is inspired by the proposal of
|
||||
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
@ -16,7 +16,7 @@ syn case match
|
||||
|
||||
" Extension of Tex clusters {{{1
|
||||
runtime syntax/tex.vim
|
||||
unlet b:current_syntax
|
||||
unlet! b:current_syntax
|
||||
|
||||
syn cluster texMatchGroup add=@rnoweb
|
||||
syn cluster texMathMatchGroup add=rnowebSexpr
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: reST with R code chunks
|
||||
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Jun 28, 2016 08:53AM
|
||||
" Last Change: Thu Apr 05, 2018 11:06PM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
@ -14,7 +14,7 @@ endif
|
||||
|
||||
" load all of the rst info
|
||||
runtime syntax/rst.vim
|
||||
unlet b:current_syntax
|
||||
unlet! b:current_syntax
|
||||
|
||||
" load all of the r syntax highlighting rules into @R
|
||||
syntax include @R syntax/r.vim
|
||||
|
@ -1,8 +1,9 @@
|
||||
" Vim syntax file
|
||||
" Language: sudoers(5) configuration files
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2018-07-19
|
||||
" Latest Revision: 2018-08-18
|
||||
" Recent Changes: Support for #include and #includedir.
|
||||
" Added many new options (Samuel D. Leslie)
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@ -152,77 +153,120 @@ syn match sudoersDefaultTypeGreaterThan contained '>' nextgroup=@sudoersUser s
|
||||
" TODO: could also deal with special characters here
|
||||
syn match sudoersBooleanParameter contained '!' nextgroup=sudoersBooleanParameter skipwhite skipnl
|
||||
syn keyword sudoersBooleanParameter contained skipwhite skipnl
|
||||
\ always_query_group_plugin
|
||||
\ always_set_home
|
||||
\ authenticate
|
||||
\ closefrom_override
|
||||
\ compress_io
|
||||
\ env_editor
|
||||
\ env_reset
|
||||
\ exec_background
|
||||
\ fast_glob
|
||||
\ fqdn
|
||||
\ ignore_audit_errors
|
||||
\ ignore_dot
|
||||
\ ignore_iolog_errors
|
||||
\ ignore_local_sudoers
|
||||
\ ignore_logfile_errors
|
||||
\ ignore_unknown_defaults
|
||||
\ insults
|
||||
\ log_host
|
||||
\ log_input
|
||||
\ log_output
|
||||
\ log_year
|
||||
\ long_otp_prompt
|
||||
\ mail_all_cmnds
|
||||
\ mail_always
|
||||
\ mail_badpass
|
||||
\ mail_no_host
|
||||
\ mail_no_perms
|
||||
\ mail_no_user
|
||||
\ match_group_by_gid
|
||||
\ netgroup_tuple
|
||||
\ noexec
|
||||
\ path_info
|
||||
\ pam_session
|
||||
\ pam_setcred
|
||||
\ passprompt_override
|
||||
\ path_info
|
||||
\ preserve_groups
|
||||
\ pwfeedback
|
||||
\ requiretty
|
||||
\ root_sudo
|
||||
\ rootpw
|
||||
\ runaspw
|
||||
\ set_home
|
||||
\ set_logname
|
||||
\ set_utmp
|
||||
\ setenv
|
||||
\ shell_noargs
|
||||
\ stay_setuid
|
||||
\ sudoedit_checkdir
|
||||
\ sudoedit_fellow
|
||||
\ syslog_pid
|
||||
\ targetpw
|
||||
\ tty_tickets
|
||||
\ umask_override
|
||||
\ use_netgroups
|
||||
\ use_pty
|
||||
\ user_command_timeouts
|
||||
\ utmp_runas
|
||||
\ visiblepw
|
||||
|
||||
syn keyword sudoersIntegerParameter contained
|
||||
\ nextgroup=sudoersIntegerParameterEquals
|
||||
\ skipwhite skipnl
|
||||
\ closefrom
|
||||
\ passwd_tries
|
||||
\ command_timeout
|
||||
\ loglinelen
|
||||
\ maxseq
|
||||
\ passwd_timeout
|
||||
\ passwd_tries
|
||||
\ syslog_maxlen
|
||||
\ timestamp_timeout
|
||||
\ umask
|
||||
|
||||
syn keyword sudoersStringParameter contained
|
||||
\ nextgroup=sudoersStringParameterEquals
|
||||
\ skipwhite skipnl
|
||||
\ askpass
|
||||
\ badpass_message
|
||||
\ editor
|
||||
\ mailsub
|
||||
\ noexec_file
|
||||
\ passprompt
|
||||
\ runas_default
|
||||
\ syslog_badpri
|
||||
\ syslog_goodpri
|
||||
\ sudoers_locale
|
||||
\ timestampdir
|
||||
\ timestampowner
|
||||
\ askpass
|
||||
\ env_file
|
||||
\ exempt_group
|
||||
\ fdexec
|
||||
\ group_plugin
|
||||
\ iolog_dir
|
||||
\ iolog_file
|
||||
\ iolog_flush
|
||||
\ iolog_group
|
||||
\ iolog_mode
|
||||
\ iolog_user
|
||||
\ lecture
|
||||
\ lecture_file
|
||||
\ lecture_status_dir
|
||||
\ listpw
|
||||
\ logfile
|
||||
\ mailerflags
|
||||
\ mailerpath
|
||||
\ mailfrom
|
||||
\ mailsub
|
||||
\ mailto
|
||||
\ noexec_file
|
||||
\ pam_login_service
|
||||
\ pam_service
|
||||
\ passprompt
|
||||
\ restricted_env_file
|
||||
\ role
|
||||
\ runas_default
|
||||
\ secure_path
|
||||
\ sudoers_locale
|
||||
\ syslog
|
||||
\ syslog_badpri
|
||||
\ syslog_goodpri
|
||||
\ timestamp_type
|
||||
\ timestampdir
|
||||
\ timestampowner
|
||||
\ type
|
||||
\ verifypw
|
||||
|
||||
syn keyword sudoersListParameter contained
|
||||
|
Loading…
Reference in New Issue
Block a user