From e6a43e8fda231d5aa044827225fd2ae17256cd37 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Mon, 10 Sep 2018 15:56:05 +0200 Subject: update todo.vim again. patching it. --- home/.vim/ftdetect/todo.vim | 2 +- home/.vim/sample/sample.txt | 31 +++++++++++ home/.vim/scripts.vim | 4 +- home/.vim/syntax/todo.vim | 127 +++++++++++++++++++++----------------------- home/.vim/todo/sample.todo | 23 -------- home/.vim/todo/sample.txt | 8 --- 6 files changed, 95 insertions(+), 100 deletions(-) create mode 100644 home/.vim/sample/sample.txt delete mode 100755 home/.vim/todo/sample.todo delete mode 100755 home/.vim/todo/sample.txt (limited to 'home') 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\)\@, -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. -- cgit v1.2.3