Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0b0a13e06 | ||
|
|
a65f2b1d98 | ||
|
|
6a29a2e961 | ||
|
|
d671e862e4 | ||
|
|
b24dfe0762 |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,5 +1,5 @@
|
|||||||
# See: https://axvr.io/projects/ascribe/
|
# 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
|
*.vim line-length=78 expand-tab tab-stop=4
|
||||||
doc/* 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
|
||||||
|
|||||||
11
README.org
11
README.org
@@ -1,7 +1,9 @@
|
|||||||
#+TITLE: Org mode and Outline mode syntax highlighting for Vim
|
#+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
|
Org.vim is a very minimal [[https://orgmode.org][Org mode]] and
|
||||||
[[https://www.vim.org][Vim]] providing only syntax highlighting and folding.
|
[[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]]
|
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
|
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]]
|
implementation. It also allowed me use [[https://github.com/orgzly/orgzly-android/][Orgzly]]
|
||||||
(highly recommended) without worrying about Emacs lock-in.
|
(highly recommended) without worrying about Emacs lock-in.
|
||||||
|
|
||||||
*Notice*: this project is considered complete by the author. You can still
|
*Note*: this project is considered /feature complete/ by the author, so the
|
||||||
report bugs and request additional features, however it is unlikely that new
|
addition of new features will be unlikely.
|
||||||
features will be added.
|
|
||||||
|
|
||||||
** Licence
|
** Licence
|
||||||
|
|
||||||
|
|||||||
10
TODO
10
TODO
@@ -1,11 +1,7 @@
|
|||||||
MAYBE:
|
MAYBE:
|
||||||
- Better link syntax highlighting (more similar to links in vim-markdown)
|
- Syntax highlight checkboxes and checkbox cookies
|
||||||
- Syntax highlight bullets and checkboxes
|
- Separate syntax group for heading delimiters
|
||||||
- Different syntax group for heading delimiters
|
- Syntax highlight and indent properties
|
||||||
|
|
||||||
UNLIKELY:
|
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>')
|
- Implement Emacs's abbreviations (e.g. '\<s<TAB>')
|
||||||
|
|||||||
58
doc/org.txt
58
doc/org.txt
@@ -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|.
|
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'*
|
*'b:org_state_keywords'* *'g:org_state_keywords'*
|
||||||
Value: list of strings~
|
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'|
|
State keywords can be set on specific buffers by using |'b:org_state_keywords'|
|
||||||
rather than |'g: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'*
|
*'b:org_clean_folds'* *'g:org_clean_folds'*
|
||||||
Value: numeric~
|
Value: numeric~
|
||||||
@@ -209,10 +197,20 @@ To disable italics only in a single buffer, use this instead:
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
5. CHANGE LOG *org-changelog*
|
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]~
|
v1.1 [2020-01-05]~
|
||||||
|
|
||||||
* Added documentation on folding configuration (|org-folding|).
|
* 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.
|
* Improved accuracy of in-line delimiter matching.
|
||||||
* Various minor documentation fixes.
|
* Various minor documentation fixes.
|
||||||
* Rewrote README in Org mode.
|
* Rewrote README in Org mode.
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -18,11 +21,4 @@ setlocal foldmethod=expr
|
|||||||
if org#option('org_clean_folds', 0)
|
if org#option('org_clean_folds', 0)
|
||||||
setlocal foldtext=org#fold_text()
|
setlocal foldtext=org#fold_text()
|
||||||
setlocal fillchars-=fold:-
|
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
|
endif
|
||||||
|
|||||||
@@ -16,5 +16,4 @@ setlocal foldmethod=expr
|
|||||||
if org#option('org_clean_folds', 0)
|
if org#option('org_clean_folds', 0)
|
||||||
setlocal foldtext=org#fold_text()
|
setlocal foldtext=org#fold_text()
|
||||||
setlocal fillchars-=fold:-
|
setlocal fillchars-=fold:-
|
||||||
setlocal fillchars-=fold:\
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ highlight def link orgUnderlineDelimiter orgUnderline
|
|||||||
|
|
||||||
" Options
|
" Options
|
||||||
syntax match orgOption /^\s*#+\w\+.*$/ keepend
|
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 orgBlockDelimiter SpecialComment
|
||||||
highlight def link orgOption 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 orgCode matchgroup=orgCodeDelimiter start="[^ \t\k]\@<!\~\k\@=\~\@!" end="\k\@<=\~\@<!\~" keepend
|
||||||
syntax region orgVerbatim matchgroup=orgVerbatimDelimiter 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 match orgVerbatim /^\s*: .*$/ keepend
|
||||||
syntax region orgVerbatim matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_.*" end="^\s*#+END_.*" keepend
|
syntax region orgVerbatim matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_.*" end="\c^\s*#+END_.*" keepend
|
||||||
syntax region orgCode matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_SRC" end="^\s*#+END_SRC" keepend
|
syntax region orgCode matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_SRC" end="\c^\s*#+END_SRC" keepend
|
||||||
syntax region orgCode matchgroup=orgBlockDelimiter start="^\s*#+BEGIN_EXAMPLE" end="^\s*#+END_EXAMPLE" 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 orgVerbatim Identifier
|
||||||
highlight def link orgVerbatimDelimiter orgVerbatim
|
highlight def link orgVerbatimDelimiter orgVerbatim
|
||||||
@@ -60,7 +60,7 @@ highlight def link orgCodeDelimiter orgCode
|
|||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
syntax match orgComment /^\s*#\s\+.*$/ keepend
|
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
|
highlight def link orgComment Comment
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -96,8 +103,13 @@ highlight def link orgTimestampInactive Comment
|
|||||||
syntax match orgHyperlink /\[\{2}\([^][]\{-1,}\]\[\)\?[^][]\{-1,}\]\{2}/ containedin=ALL contains=orgHyperLeft,orgHyperRight,orgHyperURL
|
syntax match orgHyperlink /\[\{2}\([^][]\{-1,}\]\[\)\?[^][]\{-1,}\]\{2}/ containedin=ALL contains=orgHyperLeft,orgHyperRight,orgHyperURL
|
||||||
syntax match orgHyperLeft /\[\{2}/ contained conceal
|
syntax match orgHyperLeft /\[\{2}/ contained conceal
|
||||||
syntax match orgHyperRight /\]\{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 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'
|
let b:current_syntax = 'org'
|
||||||
|
|||||||
Reference in New Issue
Block a user