Skip to content

Instantly share code, notes, and snippets.

@vreon
Last active August 29, 2022 18:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vreon/1260002 to your computer and use it in GitHub Desktop.
Save vreon/1260002 to your computer and use it in GitHub Desktop.
TODO syntax highlighting for vim
todo () {
if [ "$1" = "-g" ]; then
path=$HOME
else
path=$(pwd)
while [[ "$path" != "" && ! -e "$path/TODO" ]]; do
path=${path%/*}
done
[ -z "$path" ] && path=$HOME
fi
$EDITOR "$path/TODO"
}
au BufRead,BufNewFile TODO,*.TODO,*.todo set filetype=todo
Types of items
- Task
x Completed
> In progress
- Something I should investigate?
- Something important!
. Something to keep in mind
Example list of things to do
x Have some coffee
x Call Mom
- Go grocery shopping
- Milk
- Which brand?
- Don't get skim milk! Ew.
- Eggs (dozen)
- Bread
. The potato bread I got last time was really good
x Post TODO syntax file as gist
" Vim syntax file
" Language: TODO
" Last Change: 2012-07-25
" Author: Jesse Dubay <jesse@thefortytwo.net>
" Version: 0.3.0
if exists("b:current_syntax")
finish
endif
syn match todoTopLevel /^[^x\- ].*$/
syn match todoHeaderDelim /^[\-\=]*$/
syn match todoLineItem /^\s*[\-\*] .*$/
syn match todoDoneItem /^\s*x .*$/
syn match todoImportantItem /^\s*! .*$/
syn match todoImportantItem /^\s*[\-\*] .*!.*$/
syn match todoQuestionItem /^\s*[\-\*] .*?.*$/
syn match todoQuestionItem /^\s*? .*$/
syn match todoNoteItem /^\s*\. .*$/
syn match todoInProgressItem /^\s*> .*$/
hi link todoTopLevel Function
hi link todoHeaderDelim Comment
hi link todoLineItem Normal
hi link todoDoneItem Comment
hi link todoImportantItem Title
hi link todoQuestionItem Special
hi link todoNoteItem SpecialComment
hi link todoInProgressItem String
let b:current_syntax = "todo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment