5 Commits
v1.1 ... v1.2

Author SHA1 Message Date
Alex Vear
b0b0a13e06 Add v1.2 entry to change log + minor README content updates 2020-02-15 20:25:43 +00:00
Alex Vear
a65f2b1d98 Allow lower case in option keys and dynamic block markers
For example previously only `#+TITLE: Foo` would have syntax highlighted
`Foo` correctly. Now all case variants will work (e.g. `#+title: Foo`
and `#+tItLE: Foo`).

The same has been done to dynamic block markers so now this will also
work:

    #+begin_src lisp
    (if (< 1 2)
      (print "True!")
      (print "False!))
    #+end_src
2020-02-15 20:01:31 +00:00
Alex Vear
6a29a2e961 Better Org mode hyperlink syntax highlighting and disabled link conceal
Org mode hyperlinks are now fully syntax highlighted (similar to
Markdown links).

The `org_conceal_links` option has been removed in favour of using
built-in Vim options to enable concealing (with a short section in the
`doc/org.txt` file on how to do this).  This was done because concealed
text makes navigating "hard-wrapped" documents difficult (especially
when the concealed text is as long as most URLs).
2020-02-15 03:17:49 +00:00
Alex Vear
d671e862e4 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
2020-02-15 02:19:15 +00:00
Alex Vear
b24dfe0762 Remove unnecessary folding rules and update .gitattributes 2020-01-05 12:07:34 +00:00
7 changed files with 60 additions and 58 deletions

4
.gitattributes vendored
View File

@@ -1,5 +1,5 @@
# See: https://axvr.io/projects/ascribe/
* text=auto eol=lf final-newline trim-trailing-whitespace
* text=auto eol=lf final-newline
*.vim line-length=78 expand-tab tab-stop=4
doc/* line-length=78 expand-tab tab-stop=4
*.md line-length=80 expand-tab tab-stop=4
*.org line-length=80 expand-tab tab-stop=4

View File

@@ -1,7 +1,9 @@
#+TITLE: Org mode and Outline mode syntax highlighting for Vim
Org.vim is a very minimal [[https://orgmode.org][Org mode]] and [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html][Outline mode]] plugin for
[[https://www.vim.org][Vim]] providing only syntax highlighting and folding.
Org.vim is a very minimal [[https://orgmode.org][Org mode]] and
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html][Outline mode]]
plugin for [[https://www.vim.org][Vim]] providing only syntax highlighting and
folding.
This plugin aims to replicate Vim's [[https://github.com/tpope/vim-markdown/][existing Markdown]]
editing experience on Org mode (and Outline mode) files, rather than trying to
@@ -12,9 +14,8 @@ files in Vim without any of /the bells and whistles/ of the original Emacs
implementation. It also allowed me use [[https://github.com/orgzly/orgzly-android/][Orgzly]]
(highly recommended) without worrying about Emacs lock-in.
*Notice*: this project is considered complete by the author. You can still
report bugs and request additional features, however it is unlikely that new
features will be added.
*Note*: this project is considered /feature complete/ by the author, so the
addition of new features will be unlikely.
** Licence

10
TODO
View File

@@ -1,11 +1,7 @@
MAYBE:
- Better link syntax highlighting (more similar to links in vim-markdown)
- Syntax highlight bullets and checkboxes
- Different syntax group for heading delimiters
- Syntax highlight checkboxes and checkbox cookies
- Separate syntax group for heading delimiters
- Syntax highlight and indent properties
UNLIKELY:
- Add working links
- Maybe utilise Vim-Waikiki and override default Vim mappings
- Open man pages (use ':h :Man')
- Add 'org-store-link' and 'org-insert-link' implementations
- Implement Emacs's abbreviations (e.g. '\<s<TAB>')

View File

@@ -123,6 +123,23 @@ Or if you want folding enabled and all folds opened by default, use
<
For more information on folding in Vim, refer to |fold.txt|.
------------------------------------------------------------------------------
*org-conceal-links*
You can tell Vim to conceal links by using the built-in 'conceallevel' and
'concealcursor' options.
For example, you can make Vim collapse an Org mode link to look like it would
within Emacs or a Web browser (i.e. only showing the link title).
>
[[https://www.vim.org][Vim website]] --> Vim website
<
This is achieved with this |autocmd|:
>
autocmd FileType org setlocal conceallevel=2 concealcursor=nc
<
Note: long concealed text can act weird when "hard-wraping" text in Vim.
------------------------------------------------------------------------------
*'b:org_state_keywords'* *'g:org_state_keywords'*
Value: list of strings~
@@ -138,35 +155,6 @@ Note: state keywords are case sensitive.
State keywords can be set on specific buffers by using |'b:org_state_keywords'|
rather than |'g:org_state_keywords'|.
------------------------------------------------------------------------------
*'b:org_conceal_links'* *'g:org_conceal_links'*
Value: numeric~
Default: 1~
This option changes how Org mode links are rendered. If this option is
enabled, most of the link syntax will be collapsed to look as it would within
Emacs or a web browser; only showing the (underlined) link text.
>
[[https://www.vim.org][Vim website]] --> Vim website
<
When in insert mode with the cursor on that line, Vim will show the full link
syntax. This feature is enabled by default, however the way Vim treats
concealed text can be annoying, so it can be disabled.
To disable for all Org mode files, place the following line in your vimrc:
>
let g:org_conceal_links = 0
<
To disable for a specific file use this instead:
>
let b:org_conceal_links = 0
<
If you would like to modify how links are concealed, you can disable this
option, and manually set the |conceallevel| and |concealcursor| options from
an |autocmd| like so.
>
autocmd FileType org setlocal conceallevel=2 concealcursor=nc
<
------------------------------------------------------------------------------
*'b:org_clean_folds'* *'g:org_clean_folds'*
Value: numeric~
@@ -209,10 +197,20 @@ To disable italics only in a single buffer, use this instead:
==============================================================================
5. CHANGE LOG *org-changelog*
v1.2 [2020-02-15]~
* Improved syntax highlighting of links and turned off link concealing.
* Added |org_conceal_links| doc section on how turn on link concealing.
* Syntax highlight list item bullets and numbers.
* Make Vim correctly format lists without messing up indentation.
* Allow lower case in option keys and dynamic block markers.
* Remove a couple of unnecessary 'fillchars' rules.
* Minor README content update.
v1.1 [2020-01-05]~
* Added documentation on folding configuration (|org-folding|).
* Added |'g:org_clean_folds'| option.
* Added 'g:org_clean_folds' option.
* Improved accuracy of in-line delimiter matching.
* Various minor documentation fixes.
* Rewrote README in Org mode.

View File

@@ -11,6 +11,9 @@
" Web: <https://orgmode.org/manual/index.html>
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 foldmethod=expr
@@ -18,11 +21,4 @@ setlocal foldmethod=expr
if org#option('org_clean_folds', 0)
setlocal foldtext=org#fold_text()
setlocal fillchars-=fold:-
setlocal fillchars-=fold:\
endif
" Conceal Org mode link syntax
if org#option('org_conceal_links', 1)
setlocal conceallevel=2
setlocal concealcursor=nc
endif

View File

@@ -16,5 +16,4 @@ setlocal foldmethod=expr
if org#option('org_clean_folds', 0)
setlocal foldtext=org#fold_text()
setlocal fillchars-=fold:-
setlocal fillchars-=fold:\
endif

View File

@@ -37,7 +37,7 @@ highlight def link orgUnderlineDelimiter orgUnderline
" Options
syntax match orgOption /^\s*#+\w\+.*$/ keepend
syntax region orgTitle matchgroup=orgOption start="^\s*#+TITLE:\s*" end="$" keepend oneline
syntax region orgTitle matchgroup=orgOption start="\c^\s*#+TITLE:\s*" end="$" keepend oneline
highlight def link orgBlockDelimiter SpecialComment
highlight def link orgOption SpecialComment
@@ -48,9 +48,9 @@ highlight def link orgTitle Title
syntax region orgCode matchgroup=orgCodeDelimiter start="[^ \t\k]\@<!\~\k\@=\~\@!" end="\k\@<=\~\@<!\~" keepend
syntax region orgVerbatim matchgroup=orgVerbatimDelimiter start="[^ \t\k]\@<!=\k\@==\@!" end="\k\@<==\@<!=" keepend
syntax match orgVerbatim /^\s*: .*$/ keepend
syntax region orgVerbatim matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_.*" end="^\s*#+END_.*" keepend
syntax region orgCode matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_SRC" end="^\s*#+END_SRC" keepend
syntax region orgCode matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_EXAMPLE" end="^\s*#+END_EXAMPLE" 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_EXAMPLE" end="\c^\s*#+END_EXAMPLE" keepend
highlight def link orgVerbatim Identifier
highlight def link orgVerbatimDelimiter orgVerbatim
@@ -60,7 +60,7 @@ highlight def link orgCodeDelimiter orgCode
" Comments
syntax match orgComment /^\s*#\s\+.*$/ keepend
syntax region orgComment matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_COMMENT" end="^\s*#+END_COMMENT" keepend
syntax region orgComment matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_COMMENT" end="\c^\s*#+END_COMMENT" keepend
highlight def link orgComment Comment
@@ -85,6 +85,13 @@ highlight def link orgTodo Todo
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
syntax match orgTimestampActive /<\d\{4}-\d\{2}-\d\{2}.\{-}>/ keepend
syntax match orgTimestampInactive /\[\d\{4}-\d\{2}-\d\{2}.\{-}\]/ keepend
@@ -96,8 +103,13 @@ highlight def link orgTimestampInactive Comment
syntax match orgHyperlink /\[\{2}\([^][]\{-1,}\]\[\)\?[^][]\{-1,}\]\{2}/ containedin=ALL contains=orgHyperLeft,orgHyperRight,orgHyperURL
syntax match orgHyperLeft /\[\{2}/ contained conceal
syntax match orgHyperRight /\]\{2}/ contained conceal
syntax match orgHyperURL /[^][]\{-1,}\]\[/ contained conceal
syntax match orgHyperURL /[^][]\{-1,}\]\[/ contains=orgHyperCentre contained conceal
syntax match orgHyperCentre /\]\[/ contained conceal
highlight def link orgHyperlink Underlined
highlight def link orgHyperURL String
highlight def link orgHyperCentre Comment
highlight def link orgHyperLeft Comment
highlight def link orgHyperRight Comment
let b:current_syntax = 'org'