├── .gitignore ├── Makefile ├── README.md ├── doc └── todotxt.txt ├── ftdetect └── todotxt.vim ├── ftplugin └── todotxt.vim ├── plugin ├── IndentSort.vim └── RecursiveIndentSort.vim ├── syntax └── todotxt.vim └── tests ├── IndentSort_tests.txt ├── symbols.todo.txt └── test.todo.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | *.tar.gz 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DIRS=doc ftdetect ftplugin plugin syntax 2 | todotxt.tar.gz: 3 | tar -zcvf todotxt.tar.gz --exclude '*.swp' $(DIRS) 4 | 5 | deploy: 6 | rsync -av --exclude '*.swp' $(DIRS) $(HOME)/.vim 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | todo.txt-vim 2 | ============= 3 | 4 | Some files to make editing todo.txt files in Vim more enjoyable. 5 | 6 | Author 7 | ------- 8 | 9 | Original author Graham Davies, 2009. 10 | 11 | New syntax, plugin packaging and upload to github by David O'Callaghan, 2010. 12 | 13 | Install 14 | -------- 15 | 16 | If you have the `make` and `rsync` commands available, run: 17 | 18 | make deploy 19 | 20 | Otherwise, copy the directories to your .vim directory. 21 | 22 | To access this help file from within Vim you must first update your help 23 | tags: 24 | 25 | :helptags ~/.vim/doc 26 | 27 | The path may need to be modified depending on where you install to. Once 28 | you have done this you can access the help with this command: 29 | 30 | :help todotxt 31 | -------------------------------------------------------------------------------- /doc/todotxt.txt: -------------------------------------------------------------------------------- 1 | *todotxt* todo.txt file-type plugin and syntax file 2 | 3 | 4 | Some files to make editing todo.txt files in vim more enjoyable. 5 | 6 | To use IndentSort.vim copy to your .vim/plugins directory. 7 | 8 | In vim use spaces to indent your child tasks. Then either highlight a range or 9 | use :%Indent. 10 | 11 | To use todo.vim copy the file to your .vim/syntax directory. 12 | 13 | Also copy filetype.vim to you .vim/ftdetect directory. 14 | 15 | You might also want to set the following in your .vimrc file: 16 | 17 | set shiftwidth=4 18 | set expandtab 19 | set foldlevel=0 20 | set foldminlines=3 21 | 22 | if has("autocmd") 23 | filetype plugin on 24 | autocmd FileType todo set syntax=todo foldmethod=indent 25 | endif 26 | 27 | -------------------------------------------------------------------------------- /ftdetect/todotxt.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype detection file 2 | " Language: todo.txt (http://todotxt.com/) 3 | " Maintainer: David O'Callaghan 4 | " URL: 5 | " Version: 2 6 | " Last Change: 2010 Aug 23 7 | " 8 | au! BufRead,BufNewFile *.never.txt,todo.txt,*.done.txt,*.todo.txt,recur.txt,done.txt,done_*.txt,tasks.txt set filetype=todotxt 9 | -------------------------------------------------------------------------------- /ftplugin/todotxt.vim: -------------------------------------------------------------------------------- 1 | " CopyTag: Searches for tags in todo.txt files 2 | " Author: Graham Davies 3 | " 4 | " Tags are defined as +noSpace and can be several +tag1 +tag2 +tag3 5 | " Function should extract tag from surrounding text 6 | " (10/01) +tag description 7 | " should find +tag from above line 8 | function! s:CopyTag() 9 | let regex = '\(+\S\+\s\?\)\{1,}' 10 | let lineNum = line('.') 11 | let line = getline('.') 12 | let tagline = search(regex, 'cbn') 13 | if lineNum == tagline 14 | echo "Error: Line already has tag" 15 | return 16 | endif 17 | let tagLineTxt = getline(tagline) 18 | let tag = matchstr(tagLineTxt,regex) 19 | let tag = substitute(tag,'\s\+$','','') 20 | execute "normal I" . tag . " " 21 | endfunction 22 | 23 | command! -nargs=0 -bar CopyTag :call CopyTag() 24 | 25 | " Copy Date 26 | function! s:CopyDate() 27 | let regex = '(\d\+\/\d\+)' 28 | let lineNum = line('.') 29 | let line = getline('.') 30 | let tagline = search(regex, 'cbn') 31 | if lineNum == tagline 32 | echo "Error: Line already has tag" 33 | return 34 | endif 35 | let tagLineTxt = getline(tagline) 36 | let tag = matchstr(tagLineTxt,regex) 37 | let tag = substitute(tag,'\s\+$','','') 38 | execute "normal I" . tag . " " 39 | endfunction 40 | 41 | command! -nargs=0 -bar CopyDate :call CopyDate() 42 | 43 | " DueDate: Searches for tags in todo.txt files 44 | " Author: Graham Davies 45 | " 46 | " Allows you to enter :DueDate 47 | " Where is the number of days before task is due 48 | " 49 | function! s:DueDate(days) 50 | let when = 3600 * 24 * a:days 51 | let yearDue = strftime("%Y", localtime() + when) 52 | if yearDue != strftime("%Y", localtime()) 53 | let format = "(%Y/%m/%d)" 54 | else 55 | let format = "(%m/%d)" 56 | endif 57 | let due = strftime(format, localtime() + when) 58 | 59 | execute "normal I" . due . " " 60 | endfunction 61 | 62 | command! -nargs=1 DueDate :call DueDate() 63 | 64 | " DueNow: Searches for tasks that are due 65 | " 66 | 67 | function! s:MarkDue() 68 | let pattern = '(\([01][0-9]\)\/\([0123][0-9]\))' 69 | let line = search(pattern, 'wc') 70 | let dueDate = matchlist(getline(line),pattern) 71 | let dueMonth = dueDate[1] 72 | let dueDay = dueDate[2] 73 | let nowMonth = strftime("%m", localtime()) 74 | let nowDay = strftime("%d", localtime()) 75 | let nowYear = strftime("%Y", localtime()) 76 | echo getline(line) 77 | let due = '' 78 | if dueMonth < nowMonth 79 | let due = 'yes' 80 | echo "omg" 81 | endif 82 | if dueMonth == nowMonth 83 | if dueDay <= nowDay 84 | echo "due" 85 | let due = 'yes' 86 | endif 87 | endif 88 | if due == 'yes' 89 | let priority = "!A " 90 | " Check for existing priority 91 | let status = match(getline(line),priority) 92 | if status == -1 93 | execute "normal I" . priority 94 | echo "added" 95 | else 96 | echo "Already priority " . status 97 | endif 98 | endif 99 | endfunction 100 | 101 | command! -nargs=0 MarkDue :call MarkDue() 102 | 103 | " TodoDone: Completes a task according to todo.txt syntax 104 | " 105 | " Adds "x 2009-10-13 17:18 " to the start of a task to show completion 106 | " Adding an argument gives number of days in the past when done 107 | " 108 | function! s:TodoDone(...) 109 | let when = 3600 * 24 * a:0 110 | let format = "%Y-%m-%d %H:%M " 111 | let doneDate = strftime(format, localtime() - when) 112 | execute "normal I" . "x " . doneDate 113 | endfunction 114 | 115 | command! -nargs=? TodoDone :call TodoDone() 116 | 117 | " TodoCancelled: Cancel a task according to todo.txt syntax 118 | " 119 | " Adds "x @cancelled " to the start of a task to show completion 120 | " Adding an argument gives number of days in the past when done 121 | " 122 | function! s:TodoCancelled(...) 123 | execute "normal I" . "x @cancelled " 124 | endfunction 125 | 126 | command! -nargs=? TodoCancelled :call TodoCancelled() 127 | 128 | " Add a tag 129 | map [t $:CopyTag 130 | vmap [t $:CopyTag 131 | 132 | " Mark a task as done 133 | map [d :TodoDone 134 | vmap [d :TodoDone 135 | 136 | map [x :TodoCancelled 137 | vmap [x :TodoCancelled 138 | 139 | map [j $:CopyTag:CopyDate:TodoDone 140 | vmap [j $:CopyTag:CopyDate::TodoDone 141 | 142 | " Clear away indented done lines 143 | map [c :set lazyredrawkmrj/^\s\+x ddGp:s/^\s\+//'r:nohlsearch 144 | 145 | " Other macros 146 | map [w :DueDate 7 147 | vmap [w :DueDate 7 148 | map [m :DueDate 30 149 | vmap [m :DueDate 30 150 | map [s :%IndentSort 151 | vmap [s :%IndentSort 152 | map [r zRmr:%RecursiveIndentSort'r 153 | vmap [r zRmr:%RecursiveIndentSort'r 154 | 155 | " abbreviations 156 | " can put these in .vimrc if useful for other file types 157 | iab ddate =strftime("%Y-%m-%d") 158 | iab xdate =strftime("%Y-%m-%d %H:%M") 159 | iab tdate =strftime("(%m/%d)") 160 | "iab 7date =strftime("(%m/%d)", localtime() + 3600*24*7) 161 | "iab 1date =strftime("(%m/%d)", localtime() + 3600*24*1) 162 | "iab 2date =strftime("(%m/%d)", localtime() + 3600*24*2) 163 | 164 | iab 1days =substitute(system('date --date="+ 1 days" +\(%m/%d\)'),"\\n","","") 165 | iab 2days =substitute(system('date --date="+ 2 days" +\(%m/%d\)'),"\\n","","") 166 | iab 3days =substitute(system('date --date="+ 3 days" +\(%m/%d\)'),"\\n","","") 167 | iab 4days =substitute(system('date --date="+ 4 days" +\(%m/%d\)'),"\\n","","") 168 | iab 5days =substitute(system('date --date="+ 5 days" +\(%m/%d\)'),"\\n","","") 169 | iab 6days =substitute(system('date --date="+ 6 days" +\(%m/%d\)'),"\\n","","") 170 | iab 7days =substitute(system('date --date="+ 7 days" +\(%m/%d\)'),"\\n","","") 171 | iab nmon =substitute(system('date --date="next monday" +\(%m/%d\)'),"\\n","","") 172 | iab ntue =substitute(system('date --date="week tuesday" +\(%m/%d\)'),"\\n","","") 173 | iab nwed =substitute(system('date --date="week wednesday" +\(%m/%d\)'),"\\n","","") 174 | iab eotw =substitute(system('date --date="next friday" +\(%m/%d\)'),"\\n","","") 175 | iab eonw =substitute(system('date --date="week friday" +\(%m/%d\)'),"\\n","","") 176 | iab 2weeks =substitute(system('date --date="+ 14 days" +\(%m/%d\)'),"\\n","","") 177 | iab 3weeks =substitute(system('date --date="+ 21 days" +\(%m/%d\)'),"\\n","","") 178 | iab 2months =substitute(system('date --date="+ 60 days" +\(%m/%d\)'),"\\n","","") 179 | iab 3months =substitute(system('date --date="+ 90 days" +\(%m/%d\)'),"\\n","","") 180 | iab eotm =substitute(system('date --date="next month - 1 day" +\(%m/%d\)'),"\\n","","") 181 | iab eoty =substitute(system('date --date="next year" +\(%Y/%m/%d\)'),"\\n","","") 182 | 183 | -------------------------------------------------------------------------------- /plugin/IndentSort.vim: -------------------------------------------------------------------------------- 1 | " IndentSort: Allows for sorting a visual selection on indent level. 2 | " Author: Matthew Wozniski (mjw@drexel.edu) 3 | " Usage: Provides one new command, :IndentSort, which operates on a 4 | " range. It finds all items with the smallest indent level, and 5 | " sorts them, carrying along the lines below with larger indents 6 | 7 | " Copyright (c) 2007, Matthew J. Wozniski 8 | " All rights reserved. 9 | " 10 | " Redistribution and use in source and binary forms, with or without 11 | " modification, are permitted provided that the following conditions are met: 12 | " * Redistributions of source code must retain the above copyright 13 | " notice, this list of conditions and the following disclaimer. 14 | " * Redistributions in binary form must reproduce the above copyright 15 | " notice, this list of conditions and the following disclaimer in the 16 | " documentation and/or other materials provided with the distribution. 17 | " * The names of the contributors may not be used to endorse or promote 18 | " products derived from this software without specific prior written 19 | " permission. 20 | " 21 | " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY 22 | " EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | " DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 25 | " DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | " (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | " LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | " ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | " SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | function! s:CompareLines(l1, l2) 33 | return a:l1[0] == a:l2[0] ? 0 : a:l1[0] > a:l2[0] ? 1 : -1 34 | endfunction 35 | 36 | " Replace tabs with spaces in a string, preserving alignment. 37 | function! s:Retab(string) 38 | let rv = '' 39 | let i = 0 40 | 41 | for char in split(a:string, '\zs') 42 | if char == "\t" 43 | let rv .= repeat(' ', &ts - i) 44 | let i = 0 45 | else 46 | let rv .= char 47 | let i = (i + 1) % &ts 48 | endif 49 | endfor 50 | 51 | return rv 52 | endfunction 53 | 54 | function! s:IndentSort() range 55 | let savelz = &lz 56 | let &lz = 1 57 | 58 | try 59 | let beg = a:firstline 60 | let end = a:lastline 61 | 62 | let lines = [ [ "", [] ] ] 63 | 64 | for i in range(beg, end) 65 | let num=matchend(getline(i), '\s*') 66 | if !exists("smallest") || num < smallest 67 | let smallest = num 68 | endif 69 | endfor 70 | 71 | for i in range(beg, end) 72 | if strlen(s:Retab(matchstr(getline(i), '\s*'))) == smallest 73 | let lines = lines + [ [ getline(i), [] ] ] 74 | if len(lines) == 2 75 | let beg = i 76 | endif 77 | else 78 | call add(lines[-1][1], getline(i)) 79 | endif 80 | endfor 81 | 82 | let lines = lines[1:] 83 | call sort(lines, "s:CompareLines") 84 | " echoerr string(lines) 85 | 86 | let i = beg 87 | for line in lines 88 | call setline(i, line[0]) 89 | let i = i + 1 90 | for more in line[1] 91 | call setline(i, more) 92 | let i = i + 1 93 | endfor 94 | endfor 95 | 96 | finally 97 | let &lz = savelz 98 | endtry 99 | endfunction 100 | 101 | command! -nargs=0 -range -bar IndentSort :,call IndentSort() 102 | -------------------------------------------------------------------------------- /plugin/RecursiveIndentSort.vim: -------------------------------------------------------------------------------- 1 | " RecursiveIndentSort: Allows for sorting a visual selection on indent level. 2 | " Author: Matthew Wozniski (mjw@drexel.edu) 3 | " Usage: Provides one new command, :RecursiveIndentSort, which operates on a 4 | " range. It finds all items with the smallest indent level, and 5 | " sorts them, carrying along the lines below with larger indents 6 | 7 | " Copyright (c) 2007, Matthew J. Wozniski 8 | " All rights reserved. 9 | " 10 | " Redistribution and use in source and binary forms, with or without 11 | " modification, are permitted provided that the following conditions are met: 12 | " * Redistributions of source code must retain the above copyright 13 | " notice, this list of conditions and the following disclaimer. 14 | " * Redistributions in binary form must reproduce the above copyright 15 | " notice, this list of conditions and the following disclaimer in the 16 | " documentation and/or other materials provided with the distribution. 17 | " * The names of the contributors may not be used to endorse or promote 18 | " products derived from this software without specific prior written 19 | " permission. 20 | " 21 | " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY 22 | " EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | " DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 25 | " DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | " (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | " LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28 | " ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | " SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | function! s:CompareLines(l1, l2) 33 | return a:l1[0] == a:l2[0] ? 0 : a:l1[0] > a:l2[0] ? 1 : -1 34 | endfunction 35 | 36 | " Replace tabs with spaces in a string, preserving alignment. 37 | function! s:Retab(string) 38 | let rv = '' 39 | let i = 0 40 | 41 | for char in split(a:string, '\zs') 42 | if char == "\t" 43 | let rv .= repeat(' ', &ts - i) 44 | let i = 0 45 | else 46 | let rv .= char 47 | let i = (i + 1) % &ts 48 | endif 49 | endfor 50 | 51 | return rv 52 | endfunction 53 | 54 | function! s:RecursiveIndentSort() range 55 | let savelz = &lz 56 | let &lz = 1 57 | 58 | try 59 | let beg = a:firstline 60 | let end = a:lastline 61 | 62 | let lines = [ [ "", [] ] ] 63 | 64 | for i in range(beg, end) 65 | let num=strlen(s:Retab(matchstr(getline(i), '\s*'))) 66 | if !exists("smallest") || num < smallest 67 | let smallest = num 68 | endif 69 | endfor 70 | 71 | for i in range(beg, end) 72 | if strlen(s:Retab(matchstr(getline(i), '\s*'))) == smallest 73 | let lines = lines + [ [ getline(i), [] ] ] 74 | if len(lines) == 2 75 | let beg = i 76 | endif 77 | else 78 | call add(lines[-1][1], getline(i)) 79 | endif 80 | endfor 81 | 82 | let lines = lines[1:] 83 | call sort(lines, "s:CompareLines") 84 | " echoerr string(lines) 85 | 86 | let i = beg 87 | for line in lines 88 | call setline(i, line[0]) 89 | let i = i + 1 90 | let recstart = i 91 | for more in line[1] 92 | call setline(i, more) 93 | let i = i + 1 94 | endfor 95 | let recend = i - 1 96 | if recend > recstart 97 | exe recstart . ',' . recend . 'call s:RecursiveIndentSort()' 98 | endif 99 | endfor 100 | 101 | finally 102 | let &lz = savelz 103 | endtry 104 | endfunction 105 | 106 | command! -nargs=0 -range -bar RecursiveIndentSort :,call RecursiveIndentSort() 107 | -------------------------------------------------------------------------------- /syntax/todotxt.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: todo.txt 3 | " Maintainer: Graham Davies 4 | " Filenames: todo.txt *.todo 5 | " Last Change: 2010-08-23 6 | 7 | " Install this file in ~/.vim/syntax/todotxt.vim 8 | " Add the following line to ~/.vim/ftdetect/todotxt.vim 9 | " au BufRead,BufNewFile todo.txt,*.todo.txt,recur.txt,*.todo setfiletype 10 | " todotxt 11 | 12 | " For version 5.x: Clear all syntax items 13 | " For version 6.x: Quit when a syntax file was already loaded 14 | if version < 600 15 | syntax clear 16 | elseif exists("b:current_syntax") 17 | finish 18 | endif 19 | 20 | " todotxt.com todo.txt compatible 21 | "syn match todoDate /([^]]\+)/ 22 | "syn match todoDone /^x .*/ contains=todoProject,todoContext,todoDate,todoAssignee,todoPriority 23 | "syn match todoFoldProject /-\S\+/ 24 | syn match todoAssignee "\[[^]]\+\]" 25 | syn match todoContext /\s\?@\S\+/ 26 | syn match todoDate /([0-9]\+)/ 27 | syn match todoDate /(\d\+\/\d\+ \d\+:\d\+)/ 28 | syn match todoDate /(\d\+\/\d\+)/ 29 | syn match todoDate /(\d\+\/\d\+\/\d\+ \d\+:\d\+)/ 30 | syn match todoDate /(\d\+\/\d\+\/\d\+)/ 31 | syn match todoDefer /_\w\+/ 32 | syn match todoDone /^\s*x .*/ 33 | syn match todoLabel /%\S\+%/ 34 | syn match todoNever /^\s*o .*/ 35 | syn match todoPriority /([A-Z])/ 36 | syn match todoPriority /[*!][A-Z0-9]/ 37 | syn match todoProject /+\S\+/ 38 | syn match todoProject /\s[p][:]\w\{2,}/ 39 | syn match todoRACI /\s[RACI][:]\S\{2,}/ 40 | syn match todoRecur "{[^}]\+}" 41 | 42 | " Regular text file stuff 43 | syn match todoBold /\*[^*]\+\*/ 44 | syn match todoComment "\s#.*" 45 | syn match todoComment "^#.*" 46 | syn match todoEmail "\S\+@\S\+\.\S\+" 47 | syn match todoURI "\w\+://\S\+" 48 | syn match todoUline /_[^_]\{2,}_/ 49 | syn region todoString start=/"/ skip=/\\"/ end=/"/ 50 | 51 | " Generic English action words that might be useful 52 | 53 | " Own thinking / actions 54 | syn keyword todoVerb learn 55 | syn keyword todoVerb buy 56 | syn keyword todoVerb get 57 | syn keyword todoVerb try 58 | syn keyword todoVerb send 59 | syn keyword todoVerb watch 60 | syn keyword todoVerb setup 61 | syn keyword todoVerb download 62 | 63 | " Interact / Consult with someone else 64 | syn keyword todoVerb ask 65 | syn keyword todoVerb confirm 66 | syn keyword todoVerb chase 67 | syn keyword todoVerb decide 68 | syn keyword todoVerb organise 69 | syn keyword todoVerb book 70 | syn keyword todoVerb meet 71 | syn keyword todoVerb arrange 72 | 73 | " Research existing thing 74 | syn keyword todoVerb check 75 | syn keyword todoVerb read 76 | syn keyword todoVerb review 77 | syn keyword todoVerb research 78 | syn keyword todoVerb find 79 | syn keyword todoVerb search 80 | syn keyword todoVerb identify 81 | syn keyword todoVerb investigate 82 | 83 | " Create new thing 84 | syn keyword todoVerb create 85 | syn keyword todoVerb design 86 | syn keyword todoVerb prepare 87 | syn keyword todoVerb implement 88 | syn keyword todoVerb make 89 | syn keyword todoVerb report 90 | syn keyword todoVerb draft 91 | syn keyword todoVerb write 92 | 93 | " Modify existing 94 | syn keyword todoVerb wash 95 | syn keyword todoVerb fix 96 | syn keyword todoVerb clean 97 | syn keyword todoVerb change 98 | syn keyword todoVerb add 99 | syn keyword todoVerb convert 100 | 101 | " Modifiers / defer - should be _mabye 102 | syn keyword todoQuery maybe 103 | syn keyword todoQuery never 104 | syn keyword todoQuery someday 105 | 106 | " Questions 107 | syn keyword todoQuery wrt 108 | syn keyword todoQuery for 109 | syn keyword todoQuery could 110 | syn keyword todoQuery why 111 | syn keyword todoQuery what 112 | syn keyword todoQuery does 113 | syn keyword todoQuery how 114 | syn keyword todoQuery if 115 | syn keyword todoQuery shall 116 | syn keyword todoQuery should 117 | syn keyword todoQuery when 118 | syn keyword todoQuery where 119 | syn keyword todoQuery which 120 | syn keyword todoQuery who 121 | syn keyword todoQuery will 122 | syn keyword todoQuery would 123 | 124 | " Define the default highlighting. 125 | " For version 5.7 and earlier: only when not done already 126 | " For version 5.8 and later: only when an item doesn't have highlighting yet 127 | " 128 | " :source /usr/share/vim/vim71/syntax/hitest.vim 129 | " 130 | if version >= 508 || !exists("did_conf_syntax_inits") 131 | if version < 508 132 | let did_todo_syntax_inits = 1 133 | command -nargs=+ HiLink hi link 134 | else 135 | command -nargs=+ HiLink hi def link 136 | endif 137 | 138 | " MatchParen White on Cyan 139 | " Constant Red 140 | " Special Purple 141 | " Identifier Cyan 142 | " Statement Yellow 143 | " PreProc Purple 144 | " Type Green 145 | " Underlined Purple underlined 146 | " CursorLine White underlined 147 | " Ignore White bold 148 | " Error White on Red 149 | " Todo Black on Yellow 150 | " Normal 151 | 152 | HiLink todoAssignee Number 153 | hi todoBold term=bold cterm=bold gui=bold 154 | HiLink todoCommand Special 155 | HiLink todoComment Comment 156 | HiLink todoContext Statement 157 | HiLink todoDate PreProc 158 | HiLink todoDefer Type 159 | HiLink todoDone NonText 160 | HiLink todoEmail Underlined 161 | HiLink todoFoldProject PreProc 162 | HiLink todoLabel Todo 163 | HiLink todoNever Comment 164 | hi todoPriority term=bold cterm=bold gui=bold 165 | HiLink todoProject Identifier 166 | HiLink todoQuery Constant 167 | HiLink todoRACI PreProc 168 | HiLink todoRecur Constant 169 | HiLink todoString Question 170 | HiLink todoURI Underlined 171 | HiLink todoUline CursorLine 172 | HiLink todoVerb Type 173 | 174 | syn region todotxtPriA matchgroup=todotxtPriA start=/^\s*\((A)\)\|[*!]\+A/ end=/ / contains=ALL 175 | syn region todotxtPriB matchgroup=todotxtPriB start=/^\s*\((B)\)\|[*!]\+B/ end=/ / contains=ALL 176 | syn region todotxtPriC matchgroup=todotxtPriC start=/^\s*\((C)\)\|[*!]\+C/ end=/ / contains=ALL 177 | syn region todotxtPriD matchgroup=todotxtPriD start=/^\s*\((D)\)\|[*!]\+D/ end=/ / contains=ALL 178 | hi todotxtPriA ctermfg=DarkYellow guifg=DarkYellow 179 | hi todotxtPriB ctermfg=Green guifg=Green 180 | hi todotxtPriC ctermfg=Blue guifg=Blue 181 | hi todotxtPriD ctermfg=grey guifg=grey 182 | 183 | delcommand HiLink 184 | endif 185 | 186 | let b:current_syntax = "todotxt" 187 | 188 | " vim: ts=8 sw=2 189 | -------------------------------------------------------------------------------- /tests/IndentSort_tests.txt: -------------------------------------------------------------------------------- 1 | Start with: 2 | 1 Top level 3 | 3 4 | 1 5 | 3 6 | 3 7 | 4 8 | 1 9 | 2 10 | 2 11 | 2 12 | 4 13 | 14 | Highlight range then do :'<,'>IndentSort or [s 15 | 16 | Will become: 17 | 18 | 1 Top level 19 | 2 20 | 3 21 | 1 22 | 3 23 | 3 24 | 4 25 | 1 26 | 2 27 | 2 28 | 4 29 | 30 | Highlight range then do :'<,'>RecursiveIndentSort or [r 31 | 32 | Will become: 33 | 34 | 1 Top level 35 | 2 36 | 3 37 | 1 38 | 2 39 | 3 40 | 1 41 | 2 42 | 3 43 | 4 44 | 4 45 | -------------------------------------------------------------------------------- /tests/symbols.todo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidoc/todo.txt-vim/568919f608c59bc11e8d5676efad7215c6773531/tests/symbols.todo.txt -------------------------------------------------------------------------------- /tests/test.todo.txt: -------------------------------------------------------------------------------- 1 | !A +todovim +keys 2 | learn [d make done 3 | learn [j add tag, add date, make done 4 | learn [r recursive indent sort 5 | learn [s indent sort 6 | learn [t add tag from parent (some bugs) 7 | learn abbreviations e.g. 2days -> (08/25) 8 | !B high priority tasks 9 | # Comment 10 | (01/01) +a title 11 | !A +b title 12 | +3 title 13 | +c title 14 | +d title 15 | @email foo@bar.com http://foo.com 16 | put cursor on this line and run script _underlined_ text 17 | R:bob @email not this 18 | should collect hierarchy of tags and insert *bold* test 19 | should ignore titles, dates, priorities 20 | +1 recuring task all red {04} 21 | +2 title %bar% 22 | [bob] 23 | buy something 24 | research foo 25 | (01/01) +a title 26 | !A +b title 27 | +3 title 28 | +c title 29 | +d title 30 | +a +b +c +d put cursor on this line and run script 31 | collect +\S\+ tags only 32 | not this 33 | should collect hierarchy of tags and insert 34 | should ignore prior lines with no tags 35 | should ignore titles, dates, priorities 36 | +1 title 37 | +2 title 38 | (08/23) %Above_Due_Today% 39 | (10/15) +project # comment or description of project 40 | (10/17) +project +tag2 # description 2 41 | @office write job 42 | @phone bob 43 | read job 44 | (10/20) +project +subproject description 1 45 | @email task1 if needed 46 | task2 47 | {1} aar subtask1 48 | {2} foo subtask2 49 | {3} doo subtask3 50 | task3 51 | task4 52 | (10/20) [12/10] +project summary 53 | next thing 54 | (10/14) latest action 55 | other thing 56 | random stuff 57 | some job 58 | subtask 59 | (2011/02/13) +next year's task! 60 | ********************************************************************** 61 | +task +unloved 62 | assign this a due date 63 | o 2009-10-14 08:02 test syntax for 'not done' task 64 | x 2010-08-23 09:56 (10/17) +project +tag2 chase job 65 | --------------------------------------------------------------------------------