Attempt to make syntax matches closer to Emacs' Org mode

This commit is contained in:
Alex Vear
2020-05-02 20:39:29 +01:00
parent be53a9cb85
commit 315733a7ed
2 changed files with 12 additions and 6 deletions

6
TODO
View File

@@ -2,6 +2,12 @@ MAYBE:
- Syntax highlight checkboxes and checkbox cookies - Syntax highlight checkboxes and checkbox cookies
- Separate syntax group for heading delimiters - Separate syntax group for heading delimiters
- Syntax highlight and indent properties - Syntax highlight and indent properties
- Hightlight concealed TeX the same as normal text
- TeX math fragments in bold, italic, etc. text
- Close inline block using same number of starting delimiters.
- Grey out strikethrough text.
- Try to get text attributes to stack (e.g. underlined text in bold text)
- Set a max number of lines to search for end delimiter for bold/italic/etc. to 3 (might not be possible)
UNLIKELY: UNLIKELY:
- Implement Emacs's abbreviations (e.g. '\<s<TAB>') - Implement Emacs's abbreviations (e.g. '\<s<TAB>')

View File

@@ -18,10 +18,10 @@ endif
syntax spell toplevel syntax spell toplevel
" Bold, underine, italic, etc. " Bold, underine, italic, etc.
syntax region orgItalic matchgroup=orgItalicDelimiter start="[^ \t\k]\@<!\/\k\@=\/\@!" end="\k\@<=\/\@<!\/" keepend contains=@Spell syntax region orgItalic matchgroup=orgItalicDelimiter start="\(^\|[- '"({\]]\)\@<=\/\ze[^ ]" end="^\@!\/\([^\k\/]\|$\)\@=" keepend contains=@Spell
syntax region orgBold matchgroup=orgBoldDelimiter start="[^ \t\k]\@<!\*\k\@=\*\@!" end="\k\@<=\*\@<!\*" keepend contains=@Spell syntax region orgBold matchgroup=orgBoldDelimiter start="\(^\|[- '"({\]]\)\@<=\*\ze[^ ]" end="^\@!\*\([^\k\*]\|$\)\@=" keepend contains=@Spell
syntax region orgUnderline matchgroup=orgUnderlineDelimiter start="[^ \t\k]\@<!_\k\@=_\@!" end="\k\@<=_\@<!_" keepend contains=@Spell syntax region orgUnderline matchgroup=orgUnderlineDelimiter start="\(^\|[- '"({\]]\)\@<=_\ze[^ ]" end="^\@!_\([^\k_]\|$\)\@=" keepend contains=@Spell
syntax region orgStrikethrough matchgroup=orgStrikethroughDelimiter start="[^ \t\k]\@<!+\k\@=+\@!" end="\k\@<=+\@<!+" keepend contains=@Spell syntax region orgStrikethrough matchgroup=orgStrikethroughDelimiter start="\(^\|[- '"({\]]\)\@<=+\ze[^ ]" end="^\@!+\([^\k+]\|$\)\@=" keepend contains=@Spell
if org#option('org_use_italics', 1) if org#option('org_use_italics', 1)
highlight def orgItalic term=italic cterm=italic gui=italic highlight def orgItalic term=italic cterm=italic gui=italic
@@ -45,8 +45,8 @@ highlight def link orgTitle Title
" Code and vervatim text " Code and vervatim text
syntax region orgCode matchgroup=orgCodeDelimiter start="[^ \t\k]\@<!\~\k\@=\~\@!" end="\k\@<=\~\@<!\~" keepend syntax region orgCode matchgroup=orgCodeDelimiter start="\(^\|[- '"({\]]\)\@<=\~\ze[^ ]" end="^\@!\~\([^\k\~]\|$\)\@=" keepend
syntax region orgVerbatim matchgroup=orgVerbatimDelimiter start="[^ \t\k]\@<!=\k\@==\@!" end="\k\@<==\@<!=" keepend syntax region orgVerbatim matchgroup=orgVerbatimDelimiter start="\(^\|[- '"({\]]\)\@<==\ze[^ ]" end="^\@!=\([^\k=]\|$\)\@=" keepend
syntax match orgVerbatim /^\s*: .*$/ keepend syntax match orgVerbatim /^\s*: .*$/ keepend
syntax region orgVerbatim matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_.*" end="\c^\s*#+END_.*" keepend syntax region orgVerbatim matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_.*" end="\c^\s*#+END_.*" keepend
syntax region orgCode matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_SRC" end="\c^\s*#+END_SRC" keepend syntax region orgCode matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_SRC" end="\c^\s*#+END_SRC" keepend