Syntax highlight and correctly format/manipulate lists

Adds support for syntax highlighting and formatting both ordered and
unordered lists (excluding unordered lists delimited with `*`, as they
conflict with headings and are generally not recommended).

e.g.

    1. Foo
    2. Bar
       1) Biz
       2) Baz

    - Foo
      - Bar
    + Biz
      + Baz
This commit is contained in:
Alex Vear
2020-02-15 02:12:12 +00:00
parent b24dfe0762
commit d671e862e4
3 changed files with 11 additions and 1 deletions

2
TODO
View File

@@ -1,6 +1,6 @@
MAYBE: MAYBE:
- Better link syntax highlighting (more similar to links in vim-markdown) - Better link syntax highlighting (more similar to links in vim-markdown)
- Syntax highlight bullets and checkboxes - Syntax highlight checkboxes and checkbox cookies
- Different syntax group for heading delimiters - Different syntax group for heading delimiters
UNLIKELY: UNLIKELY:

View File

@@ -11,6 +11,9 @@
" Web: <https://orgmode.org/manual/index.html> " Web: <https://orgmode.org/manual/index.html>
setlocal commentstring=#%s setlocal commentstring=#%s
setlocal comments=fb:*,fb:-,fb:+,b:#,b:\:
setlocal formatoptions+=ncqlt
let &l:formatlistpat = '^\s*\(\d\+[.)]\|[+-]\)\s\+'
setlocal foldexpr=org#fold_expr() setlocal foldexpr=org#fold_expr()
setlocal foldmethod=expr setlocal foldmethod=expr

View File

@@ -85,6 +85,13 @@ highlight def link orgTodo Todo
highlight def link orgTag Type highlight def link orgTag Type
" Lists
syntax match orgUnorderedListMarker "^\s*[-+]\s\+" keepend contains=@Spell
syntax match orgOrderedListMarker "^\s*\d\+[.)]\s\+" keepend contains=@Spell
highlight def link orgUnorderedListMarker Statement
highlight def link orgOrderedListMarker orgUnorderedListMarker
" Timestamps " Timestamps
syntax match orgTimestampActive /<\d\{4}-\d\{2}-\d\{2}.\{-}>/ keepend syntax match orgTimestampActive /<\d\{4}-\d\{2}-\d\{2}.\{-}>/ keepend
syntax match orgTimestampInactive /\[\d\{4}-\d\{2}-\d\{2}.\{-}\]/ keepend syntax match orgTimestampInactive /\[\d\{4}-\d\{2}-\d\{2}.\{-}\]/ keepend