aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2019-06-28 13:34:47 +0200
committerGravatar Tim Segers <tsegers@pm.me>2019-06-28 13:34:47 +0200
commit43eb1eccb2494da9eed0e0d06c694d43c57acbdd (patch)
tree29e8c39654338f06d1dcaf43403871f80ea58c9b
parentd9699871f0638e413af5c681b0ccd23902dedaff (diff)
downloadtodo.vim-master.tar.gz
Add syntax, snippets and example fileHEADmaster
-rw-r--r--examples/example.txt91
-rw-r--r--snippets/todo.snippets18
-rw-r--r--syntax/todo.vim96
3 files changed, 205 insertions, 0 deletions
diff --git a/examples/example.txt b/examples/example.txt
new file mode 100644
index 0000000..1d09577
--- /dev/null
+++ b/examples/example.txt
@@ -0,0 +1,91 @@
+* TODO Project
+** TODO Incompleted task | REF-#123
+SCHEDULED 2018-08-20
+ Description are always indented one extra level, as are subtasks
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
+ cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
+ est laborum.
+
+ Literal text can be enclosed in triple backticks:
+
+ ```
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
+ cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
+ est laborum.
+ ```
+
+ Neither tags nor content is indented. Same holds for important notes:
+
+ !!!
+ multi-line important note
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim.
+ !!!
+
+ Both can also be written on a single line:
+
+ ```foo```
+
+ and
+
+ !!! bar !!!
+
+ Source code and commands are included as follows:
+
+ #+BEGIN_SRC c
+ int main(const int argc, const char *argv[])
+ {
+ printf("Hello, world!");
+ return 0;
+ }
+ #+END_SRC
+
+ #+RESULTS:
+ #+BEGIN_EXAMPLE
+ Hello, world!
+ #+END_EXAMPLE
+
+ These have one line of blank space both before and after. The BEGIN_SRC
+ tags themselves are not indented, the content is. The tags can be inserted
+ with the `<s<TAB>` and `<e<TAB>` macro.
+
+ [[https://links.are/formatted][Like this]]
+
+ - [ ] open subtask
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+ eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+ minim veniam,
+
+ - [ ] open sub-sub task
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+ eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
+ ad minim veniam,
+
+ - [x] closed subtask
+
+ - [-] incomplete subtask
+ - [x] foo
+ - [x] bar
+ - [ ] baz
+
+ - [w] blocked subtask
+
+ - [d] delegated subtask
+
+ - [n] cancelled subtask
+
+** DONE Completed task
+CLOSED 2018-08-08
+
+** WAIT Blocked task
+DEADLINE 2018-08-20
diff --git a/snippets/todo.snippets b/snippets/todo.snippets
new file mode 100644
index 0000000..10e3042
--- /dev/null
+++ b/snippets/todo.snippets
@@ -0,0 +1,18 @@
+snippet [
+ - [ ]
+
+snippet <s
+ #+BEGIN_SRC
+ ${1}
+ #+END_SRC
+
+snippet <e
+ #+BEGIN_EXAMPLE
+ ${1}
+ #+END_EXAMPLE
+
+snippet <r
+ #+RESULTS:
+ #+BEGIN_EXAMPLE
+ ${1}
+ #+END_EXAMPLE
diff --git a/syntax/todo.vim b/syntax/todo.vim
new file mode 100644
index 0000000..5584831
--- /dev/null
+++ b/syntax/todo.vim
@@ -0,0 +1,96 @@
+" Vim syntax file
+" Language: Org-mode TODO (ish)
+" Maintainer: Tim Segers <tsegers@pm.me>
+" Copyright: 2017 Tim Segers
+" License: MIT http://opensource.org/licenses/MIT
+" Last Change: 2018-08-20
+" Filenames: notes
+"
+if exists("b:current_syntax")
+ finish
+endif
+
+" org heading
+syn region todoHeader start="^\*\+" end="$"
+
+hi link todoHeader todoBold
+
+" todo statuses
+syn keyword todoDoing DOING containedin=todoHeader
+syn keyword todoDone DONE containedin=todoHeader
+syn keyword todoNope NOPE containedin=todoHeader
+syn keyword todoTodo TODO containedin=todoHeader
+syn keyword todoWait WAIT containedin=todoHeader
+
+hi link todoDoing Identifier
+hi link todoDone Constant
+hi link todoNope Comment
+hi link todoTodo Todo
+hi link todoWait Error
+
+" todo checkboxes
+syn match todoCbDelegated "\[d\]"
+syn match todoCbDoing "\[\-\]"
+syn match todoCbDone "\[x\]"
+syn match todoCbNope "\[n\]"
+syn match todoCbTodo "\[ \]"
+syn match todoCbWait "\[w\]"
+
+hi link todoCbDelegated Special
+hi link todoCbDoing Identifier
+hi link todoCbDone Constant
+hi link todoCbNope Comment
+hi link todoCbTodo Todo
+hi link todoCbWait Error
+
+" todo planning
+syn match todoDeadline /^DEADLINE .*/
+syn match todoScheduled /^SCHEDULED .*/
+syn match todoClosed /^CLOSED .*/
+
+hi link todoDeadline Special
+hi link todoScheduled Constant
+hi link todoClosed Underlined
+hi link todoDate Underlined
+
+" org affiliated keywords
+syn match todoAffil /#+\S\+:.*/
+
+hi link todoAffil Comment
+
+" org blocks
+syn match todoBlockDelim /#+BEGIN_.*/
+syn match todoBlockDelim /#+END_.*/
+syn region todoBlock start="#+BEGIN_.*" end="#+END_.*" keepend contains=todoBlockDelim
+
+hi link todoBlockDelim Comment
+hi link todoBlock String
+
+" custom blocks
+syn region todoAlert start="!!!" end="!!!"
+syn region todoVerb start="```" end="```"
+
+hi link todoAlert Special
+hi link todoVerb String
+
+" org lists
+syn match todoList "^\(\s*[-+]\|\s\+\*\)\(\s\|$\)" nextgroup=todoListItem
+syn match todoList "^\s*\(\a\|\d\+\)[.)]\(\s\|$\)" nextgroup=todoListItem
+
+syn match todoListItem /.*$/ contained contains=todoLink,todoCbDelegated,todoCbDoing,todoCbDone,todoCbNope,todoCbTodo,todoCbWait
+
+hi link todoList todoBold
+hi link todoListItem Normal
+hi link todoDef todoBold
+
+" urls
+syn match todoLinkOpen "\[\[" containedin=todoLink conceal
+syn match todoLinkClose "\]\]" containedin=todoLink conceal
+syn match todoLinkURL "[^][]*\]\[" containedin=todoLink conceal
+syn match todoLink "\[\[[^][]*\]\[[^][]*\]\]"
+
+hi link todoLink Underlined
+
+" extra defs
+hi def todoBold term=bold cterm=bold gui=bold
+