11 Commits
v1.2 ... v1.4

Author SHA1 Message Date
Alex Vear
92bab89063 Change log entry for v1.4 and removed some old TODOs 2020-08-24 22:11:56 +01:00
Alex Vear
b5877e40fb Syntax cluster groups and clean up 2020-08-24 21:56:51 +01:00
Alex Vear
263d073f41 Minor wording update to README 2020-08-24 20:54:03 +01:00
Alex Vear
bb7fce3045 Small project maintenance updates (no code changes) 2020-07-18 20:42:46 +01:00
Alex Vear
605b0d0248 Render "strike through" markup as struck through 2020-05-03 14:28:09 +01:00
Alex Vear
510b749e45 Write change log for version 1.3 of org.vim 2020-05-02 21:14:47 +01:00
Alex Vear
211e1b40ba Grey out "strike through" text 2020-05-02 21:04:50 +01:00
Alex Vear
315733a7ed Attempt to make syntax matches closer to Emacs' Org mode 2020-05-02 20:59:51 +01:00
Gavinok
be53a9cb85 Syntax highlight "LaTeX math fragments" and provide conceal options (#1)
"LaTeX math fragments" will now be syntax highlighted in Org mode files.
If `conceallevel=2` is set, the LaTeX symbols will be displayed as their
Unicode equivalents.  E.g.

    $\alpha$ --> α
    \( x^2 \)  --> x²

For more info, see: <https://orgmode.org/manual/LaTeX-fragments.html#LaTeX-fragments>
2020-04-02 22:40:56 +01:00
Alex Vear
66fdf66321 Update README content
Added:
  - installation instructions,
  - screenshots.
2020-03-19 18:45:45 +00:00
Alex Vear
9b329f456b Remove "basic syntax" (Org mode syntax intro) section from docs 2020-03-09 00:39:13 +00:00
6 changed files with 117 additions and 114 deletions

8
.gitattributes vendored
View File

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

View File

@@ -7,19 +7,43 @@ 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
be a full featured Org mode plugin—that is what Emacs is for.
Originally created so I would be able to quickly edit and easily read Org mode
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.
be a full featured Org mode plugin—that is what Emacs is for. Originally
created so I could use [[https://github.com/orgzly/orgzly-android/][Orgzly]]
without worrying Emacs lock-in.
*Note*: this project is considered /feature complete/ by the author, so the
addition of new features will be unlikely.
** Installation
Installation of Org.vim can be performed by using your preferred plugin/package
management tool(s). If you don't have a Vim package manager I recommend using
Vim 8 packages.
Just run these 2 commands from your shell.
#+BEGIN_SRC sh
git clone https://github.com/axvr/org.vim ~/.vim/pack/plugins/start/org
vim +'helptags ~/.vim/pack/plugins/start/org/doc/' +q
#+END_SRC
Once installed check out the Org.vim manual (run ~:help org.txt~ to open it) for
usage information and configuration options.
** Screenshots
Different Vim colour schemes will result in different appearances.
| [[https://github.com/romainl/Apprentice][Apprentice]] | [[https://github.com/axvr/photon.vim][Photon]] |
|--------+------------|
| [[https://raw.githubusercontent.com/axvr/org.vim/images/apprentice.png]] | [[https://raw.githubusercontent.com/axvr/org.vim/images/photon.png]] |
** Licence
Copyright (c) 20182020, Alex Vear.
Copyright © 20182020, Alex Vear.
Org.vim is distributed under the same terms as Vim itself.

11
TODO
View File

@@ -1,7 +1,12 @@
MAYBE:
- Syntax highlight checkboxes and checkbox cookies
- Separate syntax group for heading delimiters
- Syntax highlight and indent properties
- Highlight groups:
- Syntax highlight checkboxes and checkbox cookies
- Separate syntax group for heading delimiters
- Syntax highlight and indent "properties"
- Inline blocks
- Try to get text attributes to stack (e.g. underlined text in bold text)
- Close inline block using same number of starting delimiters.
- Set a max number of lines to search for end delimiter for bold/italic/etc. to 3 (might not be possible)
UNLIKELY:
- Implement Emacs's abbreviations (e.g. '\<s<TAB>')

View File

@@ -7,12 +7,11 @@
Welcome to the org.vim user manual. *org* *org.vim* *vim-org* *outline*
1. Introduction ............................... |org-intro|
2. Installation ............................... |org-install|
3. Basic syntax ............................... |org-syntax|
4. Configuration .............................. |org-configuration|
5. Change log ................................. |org-changelog|
6. Legal ...................................... |org-legal|
7. References ................................. |org-references|
2. Usage ...................................... |org-usage|
3. Configuration .............................. |org-configuration|
4. Change log ................................. |org-changelog|
5. Legal ...................................... |org-legal|
6. References ................................. |org-references|
==============================================================================
1. INTRODUCTION *org-intro*
@@ -25,87 +24,21 @@ Org mode (and Outline mode) files, rather than trying to be a full featured
Org mode plugin -- that is what Emacs is for.
==============================================================================
2. INSTALLATION *org-install*
Installation of Org.vim can be performed by using your favourite Vim
plugin/package management tool(s).
==============================================================================
3. BASIC SYNTAX *org-syntax*
Outline mode isn't used much anymore, one place it is still used is for GNU
Emacs release notes. It contains only a single piece of syntax: heading
levels denoted by asterisks.
>
* This is a heading
The first heading is equivalent to <h1> tags in HTML files.
** This is a sub-heading
This heading uses 2 asterisks to denote that it is a below the previous
heading.
*** This is a sub-sub-heading
* This is another top level heading
Org.vim supports as many heading levels as you want, and each of these
headings can use Vim's folding keys and fold navigation.
<
Org mode is a huge superset of Outline mode. It uses the same heading syntax
mentioned above, but supports many, many more features. Org.vim supports the
core subset of Org mode syntax, which should be suitable for most use cases.
The following is a short overview of essential Org mode syntax.
>
Org mode supports *bold*, /italic/, _underline_ and +strikethrough+ text
which is delimited by asterisks, forward-slashes, underscores, and pluses
respectively.
Paragraphs are separated by empty lines.
~monospaced~ and =verbatim= text are delimited by equals signs and tilde
respectively.
: Entire lines can be marked as verbatim by prepending with a colon.
# Comments are lines prepended with a hash.
This is a link to the Org.vim repository [[https://github.com/axvr/org.vim]]
This is also a link to the [[https://github.com/axvr/org.vim][Org.vim repository]]
where the text "Org.vim repository" is the title of the link (link text).
- This is an item in a list.
- This is another item in the same list.
- This is a sub-item for the above list item.
- This is a sub-item for the previous list item.
+ List items can also be denoted by using a plus sign
1. Or by numbering each item.
2. Like so.
- [ ] List items can also have checkboxes by using open and closing
square brackets.
- [X] By placing an uppercase X in between the square brackets you can
mark the item as "done".
<
Org.vim supports a lot more of Org mode's vast syntax than was mentioned here.
You can learn much more of Org mode's syntax online.
2. USAGE *org-usage*
When Org.vim is installed, files ending with the extension `.org` will
automatically have syntax highlighting and folding support enabled. It can
also be manually enabled with the following command.
automatically have syntax highlighting and folding support enabled. You can
also manually enable it by setting the 'filetype' option.
>
:set filetype=org
<
Outline mode doesn't have a file extension like Org mode so you will have to
enable it manually. This is simply done by opening the file and runing the
following command.
enable it manually.
>
:set filetype=outline
<
==============================================================================
4. CONFIGURATION *org-configuration*
3. CONFIGURATION *org-configuration*
*org-folding*
@@ -195,7 +128,23 @@ To disable italics only in a single buffer, use this instead:
let b:org_use_italics = 0
<
==============================================================================
5. CHANGE LOG *org-changelog*
4. CHANGE LOG *org-changelog*
v1.4 [2020-08-24]~
* Render "strikethrough" text as "struck through".
* Added syntax cluster groups for headings and hyperlinks.
* Made spacing consistent throughout syntax files.
* Minor wording tweaks to README.
v1.3 [2020-05-02]~
* Added syntax highlighting of LaTeX math fragments. (Thanks Gavinok!)
* Improved detection of inline bold, italic, underline, strike through,
verbatim and code syntax.
* Grey out "strike through" text by default.
* Updated README content and added screenshots.
* Removed the "basic Org mode syntax" section from this document.
v1.2 [2020-02-15]~
@@ -221,14 +170,7 @@ v1.0 [2019-09-28]~
* Initial stable release.
==============================================================================
6. LEGAL *org-legal*
Org.vim is based on the work of many other people (far too many to list here),
without them org.vim would not have been possible. The most notable of thse
works are:
* GNU Emacs' Outline mode [1].
* Carsten Dominik's Org mode [2].
5. LEGAL *org-legal*
Org.vim is distributed under the same terms as Vim itself.
@@ -238,6 +180,13 @@ A copy of the full licence text should have been provided with this extension
in the `LICENCE` file. The license can also be viewed on the web [3] or by
viewing the |license| section of the |uganda.txt| help doc from within Vim.
Org.vim is based on the work of many other people (far too many to list here),
without them org.vim would not have been possible. The most notable of thse
works are:
* GNU Emacs' Outline mode [1].
* Carsten Dominik's Org mode [2].
==============================================================================
7. REFERENCES *org-references*

View File

@@ -17,11 +17,12 @@ endif
" Enable spell check for non syntax highlighted text
syntax spell toplevel
" Bold, underine, italic, etc.
syntax region orgItalic matchgroup=orgItalicDelimiter start="[^ \t\k]\@<!\/\k\@=\/\@!" end="\k\@<=\/\@<!\/" keepend contains=@Spell
syntax region orgBold matchgroup=orgBoldDelimiter start="[^ \t\k]\@<!\*\k\@=\*\@!" end="\k\@<=\*\@<!\*" keepend contains=@Spell
syntax region orgUnderline matchgroup=orgUnderlineDelimiter start="[^ \t\k]\@<!_\k\@=_\@!" end="\k\@<=_\@<!_" keepend contains=@Spell
syntax region orgStrikethrough matchgroup=orgStrikethroughDelimiter 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="\(^\|[- '"({\]]\)\@<=\*\ze[^ ]" end="^\@!\*\([^\k\*]\|$\)\@=" keepend contains=@Spell
syntax region orgUnderline matchgroup=orgUnderlineDelimiter start="\(^\|[- '"({\]]\)\@<=_\ze[^ ]" end="^\@!_\([^\k_]\|$\)\@=" keepend contains=@Spell
syntax region orgStrikethrough matchgroup=orgStrikethroughDelimiter start="\(^\|[ '"({\]]\)\@<=+\ze[^ ]" end="^\@!+\([^\k+]\|$\)\@=" keepend contains=@Spell
if org#option('org_use_italics', 1)
highlight def orgItalic term=italic cterm=italic gui=italic
@@ -31,22 +32,23 @@ endif
highlight def orgBold term=bold cterm=bold gui=bold
highlight def orgUnderline term=underline cterm=underline gui=underline
highlight def link orgBoldDelimiter orgBold
highlight def orgStrikethrough term=strikethrough cterm=strikethrough gui=strikethrough
highlight def link orgBoldDelimiter orgBold
highlight def link orgUnderlineDelimiter orgUnderline
highlight def link orgStrikethroughDelimiter orgStrikethrough
" Options
syntax match orgOption /^\s*#+\w\+.*$/ keepend
syntax region orgTitle matchgroup=orgOption start="\c^\s*#+TITLE:\s*" end="$" keepend oneline
highlight def link orgBlockDelimiter SpecialComment
highlight def link orgOption SpecialComment
highlight def link orgTitle Title
" Code and vervatim text
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 orgCode matchgroup=orgCodeDelimiter start="\(^\|[- '"({\]]\)\@<=\~\ze[^ ]" end="^\@!\~\([^\k\~]\|$\)\@=" keepend
syntax region orgVerbatim matchgroup=orgVerbatimDelimiter start="\(^\|[- '"({\]]\)\@<==\ze[^ ]" end="^\@!=\([^\k=]\|$\)\@=" keepend
syntax match orgVerbatim /^\s*: .*$/ 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
@@ -65,12 +67,14 @@ highlight def link orgComment Comment
" Headings
syntax match orgHeading1 /^\s*\*\{1}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading2 /^\s*\*\{2}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading3 /^\s*\*\{3}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading4 /^\s*\*\{4}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading5 /^\s*\*\{5}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading6 /^\s*\*\{6,}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo
syntax match orgHeading1 /^\s*\*\{1}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax match orgHeading2 /^\s*\*\{2}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax match orgHeading3 /^\s*\*\{3}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax match orgHeading4 /^\s*\*\{4}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax match orgHeading5 /^\s*\*\{5}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax match orgHeading6 /^\s*\*\{6,}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
syntax cluster orgHeadingGroup contains=orgHeading1,orgHeading2,orgHeading3,orgHeading4,orgHeading5,orgHeading6
syntax match orgTag /:\w\{-}:/ contained contains=orgTag
exec 'syntax keyword orgTodo contained ' . join(org#option('org_state_keywords', ['TODO', 'NEXT', 'DONE']), ' ')
@@ -105,6 +109,10 @@ syntax match orgHyperLeft /\[\{2}/ contained conceal
syntax match orgHyperRight /\]\{2}/ contained conceal
syntax match orgHyperURL /[^][]\{-1,}\]\[/ contains=orgHyperCentre contained conceal
syntax match orgHyperCentre /\]\[/ contained conceal
syntax cluster orgHyperlinkBracketsGroup contains=orgHyperLeft,orgHyperRight,orgHyperCentre
syntax cluster orgHyperlinkGroup contains=orgHyperlink,orgHyperURL,orgHyperlinkBracketsGroup
highlight def link orgHyperlink Underlined
highlight def link orgHyperURL String
highlight def link orgHyperCentre Comment
@@ -112,4 +120,17 @@ highlight def link orgHyperLeft Comment
highlight def link orgHyperRight Comment
" TeX
" Ref: https://orgmode.org/manual/LaTeX-fragments.html
syntax include @LATEX syntax/tex.vim
syntax region orgMath start="\\begin\[.*\]{.*}" end="\\end{.*}" keepend contains=@LATEX
syntax region orgMath start="\\begin{.*}" end="\\end{.*}" keepend contains=@LATEX
syntax region orgMath start="\\\[" end="\\\]" keepend contains=@LATEX
syntax region orgMath start="\\(" end="\\)" keepend contains=@LATEX
syntax region orgMath start="\S\@<=\$\|\$\S\@=" end="\S\@<=\$\|\$\S\@=" keepend oneline contains=@LATEX
syntax region orgMath start=/\$\$/ end=/\$\$/ keepend contains=@LATEX
syntax match orgMath /\\\$/ conceal cchar=$
highlight def link orgMath String
let b:current_syntax = 'org'

View File

@@ -17,6 +17,7 @@ endif
" Enable spell check for non syntax highlighted text
syntax spell toplevel
" Headings
syntax match outlineHeading1 /^\s*\*\{1}\s\+.*$/ keepend contains=@Spell
syntax match outlineHeading2 /^\s*\*\{2}\s\+.*$/ keepend contains=@Spell
@@ -25,6 +26,8 @@ syntax match outlineHeading4 /^\s*\*\{4}\s\+.*$/ keepend contains=@Spell
syntax match outlineHeading5 /^\s*\*\{5}\s\+.*$/ keepend contains=@Spell
syntax match outlineHeading6 /^\s*\*\{6,}\s\+.*$/ keepend contains=@Spell
syntax cluster outlineHeadingGroup contains=outlineHeading1,outlineHeading2,outlineHeading3,outlineHeading4,outlineHeading5,outlineHeading6
hi def link outlineHeading1 Title
hi def link outlineHeading2 outlineHeading1
hi def link outlineHeading3 outlineHeading2
@@ -32,4 +35,5 @@ hi def link outlineHeading4 outlineHeading3
hi def link outlineHeading5 outlineHeading4
hi def link outlineHeading6 outlineHeading5
let b:current_syntax = 'outline'