diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2020-06-18 07:31:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-18 07:31:24 -0400 |
commit | 25aa2969f25a1a6554e7ecd48692c60852d74101 (patch) | |
tree | 639b7e3114c9b0df180c39905ae9706f5294fe48 | |
parent | e628a05b51d4620e91662f857d29f1ac8fc67862 (diff) | |
parent | 8498c40fcf55a00fb426239cc87ca242fc38163e (diff) | |
download | rneovim-25aa2969f25a1a6554e7ecd48692c60852d74101.tar.gz rneovim-25aa2969f25a1a6554e7ecd48692c60852d74101.tar.bz2 rneovim-25aa2969f25a1a6554e7ecd48692c60852d74101.zip |
Merge pull request #12497 from leun4m/patch/tex-runtime
Apply several upstream changes to text-runtime
-rw-r--r-- | runtime/indent/tex.vim | 22 | ||||
-rw-r--r-- | runtime/syntax/tex.vim | 37 |
2 files changed, 41 insertions, 18 deletions
diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index a748cfbb40..8a44ade1ac 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -64,14 +64,17 @@ " style) is supported. Thanks Miles Wheeler for reporting. " 2018/02/07 by Yichao Zhou <broken.zhou AT gmail.com> " (*) Make indentation more smart in the normal mode +" 2020/04/26 by Yichao Zhou <broken.zhou AT gmail.com> +" (*) Fix a bug related to \[ & \]. Thanks Manuel Boni for +" reporting. " " }}} " Document: {{{ " -" To set the following options (ok, currently it's just one), add a line like -" let g:tex_indent_items = 1 -" to your ~/.vimrc. +" For proper latex experience, please put +" let g:tex_flavor = "latex" +" into your vimrc. " " * g:tex_indent_brace " @@ -184,13 +187,18 @@ function! GetTeXIndent() " {{{ let line = substitute(getline(lnum), '\s*%.*', '','g') " last line let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line + let ccol = 1 + while cline[ccol] =~ '\s' + let ccol += 1 + endwhile + " We are in verbatim, so do what our user what. - if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone" + if synIDattr(synID(v:lnum, ccol, 1), "name") == "texZone" if empty(cline) return indent(lnum) else return indent(v:lnum) - end + endif endif if lnum == 0 @@ -253,13 +261,13 @@ function! GetTeXIndent() " {{{ let stay = 0 endif - if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum)) + if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, ccol) let ind -= shiftwidth() let stay = 0 endif if line !~ '^\s*\\\?[\]}]' - for i in range(indent(lnum)+1, strlen(line)-1) + for i in range(1, strlen(line)-1) let char = line[i] if char == ']' || char == '}' if s:CheckPairedIsLastCharacter(lnum, i) diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 363c781d0f..b3a8f96b6b 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX -" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: May 14, 2019 -" Version: 114 +" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> +" Last Change: Jun 07, 2020 +" Version: 118 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -147,6 +147,11 @@ if exists("g:tex_nospell") && g:tex_nospell else let s:tex_nospell = 0 endif +if exists("g:tex_excludematcher") + let s:tex_excludematcher= g:tex_excludematcher +else + let s:tex_excludematcher= 0 +endif " Clusters: {{{1 " -------- @@ -156,8 +161,12 @@ if !s:tex_no_error endif syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texEmphStyle,texNoSpell -syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell -syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texEmphStyle,texItalBoldStyle,texNoSpell +syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell +syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texEmphStyle,texItalBoldStyle,texNoSpell +if !s:tex_excludematcher + syn cluster texBoldGroup add=texMatcher + syn cluster texItalGroup add=texMatcher +endif if !s:tex_nospell syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell @@ -305,11 +314,6 @@ if s:tex_conceal !~# 'b' endif syn match texTypeStyle "\\textmd\>" syn match texTypeStyle "\\textrm\>" -syn match texTypeStyle "\\textsc\>" -syn match texTypeStyle "\\textsf\>" -syn match texTypeStyle "\\textsl\>" -syn match texTypeStyle "\\texttt\>" -syn match texTypeStyle "\\textup\>" syn match texTypeStyle "\\mathbb\>" syn match texTypeStyle "\\mathbf\>" @@ -386,12 +390,18 @@ if s:tex_fast =~# 'b' syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell syn region texEmphStyle matchgroup=texTypeStyle start="\\emph\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell + syn region texEmphStyle matchgroup=texTypeStyle start="\\texts[cfl]\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell + syn region texEmphStyle matchgroup=texTypeStyle start="\\textup\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell + syn region texEmphStyle matchgroup=texTypeStyle start="\\texttt\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell else syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup syn region texEmphStyle matchgroup=texTypeStyle start="\\emph\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup + syn region texEmphStyle matchgroup=texTypeStyle start="\\texts[cfl]\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texEmphGroup + syn region texEmphStyle matchgroup=texTypeStyle start="\\textup\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texEmphGroup + syn region texEmphStyle matchgroup=texTypeStyle start="\\texttt\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texEmphGroup endif endif endif @@ -624,7 +634,7 @@ if s:tex_fast =~# 'r' syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite endif -syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite +syn match texRefZone '\\cite\%([tp]\*\=\)\=\>' nextgroup=texRefOption,texCite " Handle newcommand, newenvironment : {{{1 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl @@ -745,6 +755,8 @@ if has("conceal") && &enc == 'utf-8' \ ['lceil' , '⌈'], \ ['ldots' , '…'], \ ['le' , '≤'], + \ ['left|' , '|'], + \ ['left\|' , '‖'], \ ['left(' , '('], \ ['left\[' , '['], \ ['left\\{' , '{'], @@ -795,6 +807,8 @@ if has("conceal") && &enc == 'utf-8' \ ['quad' , ' '], \ ['qquad' , ' '], \ ['rfloor' , '⌋'], + \ ['right|' , '|'], + \ ['right\\|' , '‖'], \ ['right)' , ')'], \ ['right]' , ']'], \ ['right\\}' , '}'], @@ -1047,6 +1061,7 @@ if has("conceal") && &enc == 'utf-8' call s:SuperSub('texSuperscript','\^','R','ᴿ') call s:SuperSub('texSuperscript','\^','T','ᵀ') call s:SuperSub('texSuperscript','\^','U','ᵁ') + call s:SuperSub('texSuperscript','\^','V','ⱽ') call s:SuperSub('texSuperscript','\^','W','ᵂ') call s:SuperSub('texSuperscript','\^',',','︐') call s:SuperSub('texSuperscript','\^',':','︓') |