summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kaufmann <astra@ionic.at>2018-09-10 15:56:05 +0200
committerDavid Kaufmann <astra@ionic.at>2018-09-10 15:56:05 +0200
commite6a43e8fda231d5aa044827225fd2ae17256cd37 (patch)
treec4a9e52423b27270f37d6a7b8b8eec9c090710d5
parent60c4c9361f599d22395b25155327afad2a4dac06 (diff)
downloadconfig-e6a43e8fda231d5aa044827225fd2ae17256cd37.tar.gz
update todo.vim again. patching it.
-rw-r--r--home/.vim/ftdetect/todo.vim2
-rw-r--r--home/.vim/sample/sample.txt31
-rwxr-xr-xhome/.vim/scripts.vim4
-rw-r--r--home/.vim/syntax/todo.vim127
-rwxr-xr-xhome/.vim/todo/sample.todo23
-rwxr-xr-xhome/.vim/todo/sample.txt8
6 files changed, 95 insertions, 100 deletions
diff --git a/home/.vim/ftdetect/todo.vim b/home/.vim/ftdetect/todo.vim
index 15fc390..0171463 100644
--- a/home/.vim/ftdetect/todo.vim
+++ b/home/.vim/ftdetect/todo.vim
@@ -1,3 +1,3 @@
augroup filetypedetect
- au BufRead,BufNewFile *.todo set filetype=todo
+ au BufRead,BufNewFile *.todo,*_todo.txt setfiletype todo
augroup END
diff --git a/home/.vim/sample/sample.txt b/home/.vim/sample/sample.txt
new file mode 100644
index 0000000..48f5891
--- /dev/null
+++ b/home/.vim/sample/sample.txt
@@ -0,0 +1,31 @@
+#todo
+
+Any text file whose name ends with '.todo' or with '_todo.txt,
+or whose first 100 lines contains '#todo' is a 'todo' file.
+
+A Header starts in column 1 with an upper-case letter and ends with a colon:
+
+ A sub-header is any indented header line:
+
+ + This is a high pri item, indicated by a '+' at the start.
+ o This is a medium priority item, indicated by 'o'.
+ - Low pri items start with a '-'.
+
+ + A completed item:done
+ D Another way to mark an item completed is to replace the
+ prefix character (+/o/-) with D.
+ d A partially completed item has the prefix character 'd'.
+
+ o An ignored item:ignore
+ x Another way to ignore an item is to use the 'x' prefix
+ character.
+
+ ? An item that is in question, needs more info, etc.
+
+ o Entries can also contain dates like so:
+ <2007/12/11>
+ <2007-12-11>
+ <12/31>
+ <8/1>
+
+ o Comments can be embedded [this is a comment] inside an item.
diff --git a/home/.vim/scripts.vim b/home/.vim/scripts.vim
index 5dea2ec..29fdae9 100755
--- a/home/.vim/scripts.vim
+++ b/home/.vim/scripts.vim
@@ -1,3 +1,3 @@
-if getline(1) =~? '^#\?TODO\>'
- setfiletype todo
+if getline(1) =~? '\<#\?TODO\>'
+ setfiletype todo
endif
diff --git a/home/.vim/syntax/todo.vim b/home/.vim/syntax/todo.vim
index 1fd11bd..b73cbd7 100644
--- a/home/.vim/syntax/todo.vim
+++ b/home/.vim/syntax/todo.vim
@@ -1,86 +1,81 @@
-" Vim script to set syntax highlighting for a todo list.
-
-" A todo list is recognized by file names of the form *.todo,
-" OR files that contain #todo as the first line of a file,
-" OR files with modelines that contain ft=todo
-
-" Header lines - Lines starting at column 0.
-" Normal priority items - Non-header lines that start with a 'o'.
-" High priority items - .... with a '+'.
-" Low priority items - .... with a '-'.
-" Items completed - ... with a 'd' or 'D'.
-" Items ignored - ... with a 'x' or 'X'.
-" Dates - Digits (and / and -) enclosed by < and >.
-" Comments - Stuff enclosed in '[' and ']' or any line
-" that is none of the above.
-
-" See the file test.todo for sample entries.
-
-" Author: Suresh S.
-" Version: 0.2
-
-
if exists("b:current_syntax")
finish
endif
-syn case ignore
+" Vim script to set syntax highlighting for a todo list.
+" See README.txt and sample.txt for description and examples.
+" Version: 0.4
+"
+" Author: Suresh S.
-" Dates can also be embedded.
-" N/N/N or N-N-N or N/N or N-N.
-syn match todoDate "<\(\(\d\{1,4\}[-/]\)\?\d\{1,2\}[-/]\d\{1,4\}\)>" contained
+syn match todoDate "<\?\d\{1,4}\([-/:]\d\{1,4\}\)\{1,3\}>\?"
-" Comments embedded in todo items.
-syn region todoComment start="\["hs=s+1 end="\]"he=e-1 contained contains=todoDate
+" Comments embedded in todo items, inside [].
+syn region todoComment start="\[" end="\]" contained
" Header lines to start sections.
-syn match todoHeader1 "^\(\(\<[odxi\?]\s\)\@<!.\)*:$" contains=todoDate
-syn match todoHeader2 "^\s\s*\(\([odxi\?]\s\)\@<!.\)*:$" contains=todoDate
+syn match todoHeader1 "^\([0-9].*\s\s*\)\?[A-Z].*:$" contains=todoDate
+syn match todoHeader2 "^\_\s\+\zs\([0-9].*\s\s*\)\?[A-Z].*:$" contains=todoDate
+
+syn case ignore
" Normal priority items.
-syn region todoNormalPri start="\(^\s*\)\@<=o\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
+syn region todoNormalPri start="\(^\s*\)\@<=o\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
" High priority items.
-syn region todoHiPri start="\(^\s*\)\@<=+\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
-" Low pri
-syn region todoLowPri start="\(^\s*\)\@<=-\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
+syn region todoHiPri start="\(^\s*\)\@<=+\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
+" Low priority items.
+syn region todoLowPri start="\(^\s*\)\@<=-\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
" Unprioritized items.
-syn region todoQuestion start="\(^\s*\)\@<=?\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
+syn region todoNoPri start="\(^\s*\)\@<=\*\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
+" Questions.
+"syn match todoQuestion "\(^\s*\)\@<=?\s" contains=todoComment
+syn region todoQuestion start="\(^\s*\)\@<=?\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoComment keepend
+"syn case match
+
" Items completed.
-syn region todoDone start="\(^\s*\)\@<=d\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
+syn region todoHalfDone start="\(^\s*\)\@<=d\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
+syn region todoDone start="\(^\s*\)\@<=D\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
+
+syn case ignore
" Items ignored/won't do.
-syn region todoIgnore start="\(^\s*\)\@<=[xi]\s" end="\(^\s*[o\-+?dxi]\s\|\n\n\+\)"he=s-1,me=s-1 contains=CONTAINED keepend
+syn region todoIgnore start="\(^\s*\)\@<=[xiXI]\s" end="\(^\s*[o\-+?dxiDXI]\s\|\n\n\+\)"he=s-1,me=s-1 contains=todoDate,todoComment keepend
-" Fix this to handle multi-line items.
-syn match todoIgnore "\(^\s*\)\@<=[o+\-?].*:ignore$" contains=CONTAINED
-syn match todoDone "\(^\s*\)\@<=[o+\-?].*:done$" contains=CONTAINED
+" TODO: Fix this to handle multi-line items.
+syn match todoIgnore "\(^\s*\)\@<=[o+\-?].*:\(ignore\|ign\)$" contains=todoDate,todoComment
+syn match todoDone "\(^\s*\)\@<=[o+\-?].*:\(done\|don\)$" contains=todoDate,todoComment
+syn match todoHalfDone "\(^\s*\)\@<=[o+\-?].*:\(incomplete\|inc\)$" contains=todoDate,todoComment
syn case match
-"--------------------------------------------------------------------------
+"--------------------------------------------------------------------
" Colors and effects.
-"--------------------------------------------------------------------------
-
-hi todoHeader1 cterm=bold
-
-" Uncomment the following line if sub-headers should appear in bold:
-" hi todoHeader2 gui=bold
-
-hi link todoQuestion Todo
-hi todoHiPri ctermfg=Red
-hi todoNormalPri ctermfg=Yellow
-hi todoDone ctermfg=Green
-hi todoComment cterm=Italic
-
-if &background == "dark"
- hi todoLowPri ctermfg=LightCyan
- hi todoIgnore ctermfg=Gray
- hi todoDate ctermfg=LightCyan cterm=bold
-else
- hi todoLowPri ctermfg=Blue
- hi todoIgnore ctermfg=Gray
- hi todoDate ctermfg=Blue cterm=bold
-endif
-
+"--------------------------------------------------------------------
+function! SetToDoColors()
+ hi todoHeader1 cterm=bold,underline
+ hi todoHeader2 cterm=undercurl
+ if &background == "dark"
+ hi def todoHiPri ctermfg=Red
+ hi def todoNormalPri ctermfg=Yellow cterm=bold
+ hi def todoLowPri ctermfg=Yellow
+ hi def todoDate ctermfg=LightCyan cterm=bold
+ hi def todoDone ctermfg=Green
+ hi def todoHalfDone ctermfg=LightGreen
+ hi def todoComment cterm=italic
+ hi def todoIgnore ctermfg=Gray
+ else
+ hi def todoHiPri ctermfg=Red cterm=bold
+ hi def todoNormalPri ctermfg=DarkOrange cterm=bold
+ hi def todoLowPri ctermfg=Brown cterm=bold
+ hi def todoDate ctermfg=Blue cterm=bold
+ hi def todoDone ctermfg=Green cterm=bold
+ hi def todoHalfDone ctermfg=LightGreen cterm=bold
+ hi def todoComment cterm=italic
+ hi def todoIgnore ctermfg=Gray cterm=bold
+ endif
+ hi link todoQuestion TODO
+endfunction
+augroup TodoHLGroup
+ autocmd! ColorScheme * call SetToDoColors()
+augroup END
+call SetToDoColors()
let b:current_syntax = "todo"
-
-" vim: ts=18
diff --git a/home/.vim/todo/sample.todo b/home/.vim/todo/sample.todo
deleted file mode 100755
index 5b2c38a..0000000
--- a/home/.vim/todo/sample.todo
+++ /dev/null
@@ -1,23 +0,0 @@
-
-A Header line ends with a colon:
-
- A sub-header is like a header, but is indented:
-
-+ This is a high pri item, indicated by a '+' at the start.
-o This is a medium priority item, indicated by 'o'.
-- Low pri items start with a '-'.
-
-+ A high pri completed item is suffixed by ':done', like so:done
-d Changing the prefix to 'd' does the same, if we don't care about preserving the priority info.
-o An item that ends with ':ignore' is an ignored item :ignore
-x Another way to say the same thing.
-
-? An item that is in question, needs more info, etc.
-
-o Entries can also contain a date like so: <2007/12/11>,
-or even multiple dates: do this by <2007-12-11>, or at the latest b<12/31>.
- o Or so: <8/1>
-
- o Comments can be embedded [this is a comment] inside an item.
- [Comments can also contain a date <99/99/99>].
-
diff --git a/home/.vim/todo/sample.txt b/home/.vim/todo/sample.txt
deleted file mode 100755
index cbd41cf..0000000
--- a/home/.vim/todo/sample.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-#todo
-
-Any file whose first line starts with #todo is a 'todo' file:
-
-o This is a normal todo.
-D This is done
-X Ignored
-? Question.