vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
426 stars 61 forks source link

Syntax file throws errors Vim 7.3 #113

Open trendels opened 9 years ago

trendels commented 9 years ago

Apologies if this is already known. Vim 7.3 (which ships on Ubuntu 12.04 LTS) has +conceal, but doesn't support the \@1 syntax in regular expressions.

vim --version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May  4 2012 04:22:36)
Included patches: 1-429
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
[...]

Loading the syntax file produces:

Error detected while processing /home/st/.vim/syntax/pandoc.vim:
line  213:
E59: invalid character after \@
E475: Invalid argument: pandocBlockQuote /^\s\{,3}>.*\n\(.*\n\@1<!\n\)*/ contain
s=@Spell,pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscri
pt,pandocStrikeout,pandocUListItem,pandocNoFormatted skipnl
line  231:
E59: invalid character after \@
E475: Invalid argument: pandocReferenceURL matchgroup=Operator start=/\]\@1<=(/ 
end=/)/ keepend display 
line  234:
E59: invalid character after \@
E475: Invalid argument: pandocNoLabel /\]\@1<!\s\+\[[^\[\]]\{-}\]\s\+[\[(]\@!/ c
ontains=pandocPCite
Error detected while processing function <SNR>21_WithConceal:
line    7:
E59: invalid character after \@
E475: Invalid argument: pandocEmphasis matchgroup=Operator start=/\\\@1<!\(\_^\|
\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\
)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath conceale
nds
E59: invalid character after \@
E475: Invalid argument: pandocEmphasis matchgroup=Operator start=/\\\@1<!\(\_^\|
\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\
|\_$\)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath con
cealends
E59: invalid character after \@
E475: Invalid argument: pandocEmphasisInStrong matchgroup=Operator start=/\\\@1<
!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punc
t:]]\|\s\|\_$\)\@=/ contained containedin=pandocStrong contains=@Spell concealen
ds
Error detected while processing /home/st/.vim/syntax/pandoc.vim:
line  344:
E59: invalid character after \@
E475: Invalid argument: pandocGridTable start=/\%#=2\n\@1<=+-/ end=/+\n\n/ conta
inedin=ALLBUT,pandocDelimitedCodeBlock keepend
line  346:
E59: invalid character after \@
E475: Invalid argument: pandocGridTableDelims /\%#=2\([\-+][\-+=]\@=\|[\-+=]\@1<
=[\-+]\)/ contained containedin=pandocGridTable
line  353:
E59: invalid character after \@
E475: Invalid argument: pandocPipeTable start=/\%#=2\([+|]\n\)\@<!\n\@1<=|\(.*|\
)\@=/ end=/|.*\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock keepend 
fmoralesc commented 9 years ago

Thanks for the heads up.

I also think there might be some issues with some regexes with include an engine selector, which I also think 7.3 lacks, but I'm not sure.

I have pushed a syntax file with some changes to the 7.3 branch, please confirm if that solves the issues under 7.3. I decided againts introducing version checks into the main syntax file because that will clutter things up. I'm not yet decided what the best strategy forward should be.

That said, I would suggest to update vim if at all possible, because 7.4 has significant performance improvements relevant to syntax files.

trendels commented 9 years ago

Hi, the errors are gone when using the 7.3 branch. Thank you for the quick fix.

Not sure what to do about the version support. Vim 7.3 will probably be around for a while, due to it being shipped with an LTS release. Personally I don't mind upgrading vim, but so far it's the only time the version has been a problem (otoh, I don't use a lot of extensions to begin with).

fmoralesc commented 9 years ago

7.3 is also shipped in OSX, if i remember correctly, so this is a concern.

jeetsukumaran commented 9 years ago

I can confirm that OSX ships with 7.3, and this error occurs for when when using the stock Vim on this platform as well.

jeetsukumaran commented 9 years ago

I wonder if it would be possible to have a top-level conditional, e.g.

if v:version >= 704
    " the master/currently-maintained definitions
else
    " legacy definitions
endif

It will be ugly, maybe. But the legacy definitions do not need to be updated maintained (very much). It will just be a snapshot of the 7.3 branch. Right now, it is very difficult to use this plugin if you are forced to use different versions of Vim in different contexts (e.g., remotely on a cluster vs. at work vs. at home) and they all share the same configuration repo. The above hack will at least avoid the cascade of errors on-startup when using older Vim's.