diff --git a/scripts/vim/README b/scripts/vim/README index 1814e0d03..8250ca3aa 100644 --- a/scripts/vim/README +++ b/scripts/vim/README @@ -1,28 +1,51 @@ -The task data files (pending.data and completed.data) as well as edits made -via commands like "task 1 edit" can be color-highlighted if you happen to use -VIM as your preferred text editor. For this to work, you need to first have -syntax highlighting enabled when you use VIM. This happens to be the default -for most VIM installations, but it is usually quite simple if that doesn't -happen to be so in your case. Rather than repeat the excellent VIM -documentation here, please see the appropriate VIM documentation itself. -Generally this can be made seen by starting vim/gvim and issuing the following -command: + + Configure VIM for Syntax Highlighting of Task Data + + +The task data files (pending.data, completed.data and undo.data) as well as +edits made via commands like "task 1 edit" can be color-highlighted if you +happen to use VIM as your preferred text editor. Eventually this will happen +automatically in newer versions of VIM, but for now you have to do a little +bit of file shuffling. + + + Prerequisites + +For this to work, you need to first have syntax highlighting enabled when you +use VIM. This happens to be the default for most VIM installations, but it is +usually quite simple if that doesn't happen to be so in your case. Rather than +repeat the excellent VIM documentation here, please see the appropriate VIM +documentation itself. Generally this can be made seen by starting vim/gvim and +issuing the following command: :help syntax -You may prefer to use your web browser via: - +You may prefer instead to read the help online at: http://vimdoc.sourceforge.net/htmldoc/syntax.html#syntax + Configuring VIM to Understand Task Data + Once you have VIM's syntax highlighting enabled and working with other file -types properly, configuring it for use with task is simple. Just extract -these files into your home directory so that you have: +types properly, configuring it for use with task is simple. You simply need to +copy some files that came with task into your home directory so that you have: -~/.vim/ftdetect/task.vim -~/.vim/syntax/taskdata.vim -~/.vim/syntax/taskedit.vim + ~/.vim/ftdetect/task.vim + ~/.vim/syntax/taskdata.vim + ~/.vim/syntax/taskedit.vim +The source of these files varies depending on how you installed task. If you +installed task via a regular package (rpm or deb) you can find these files in +/usr/share/doc/task-VERSION/scripts/vim/. If you built task yourself from the +tarball (using the default configure options), these will be in +/usr/local/share/doc/task-VERSION/scripts/vim/ instead. So you should be able +to do one of the following: + + cp -av /usr/share/doc/task-VERSION/scripts/vim/* ~/.vim/ + +or + + cp -av /usr/local/share/doc/task-VERSION/scripts/vim/* ~/.vim/ You should then be ready to go. --- diff --git a/scripts/vim/ftdetect/task.vim b/scripts/vim/ftdetect/task.vim index ff61d4a26..5bb843833 100644 --- a/scripts/vim/ftdetect/task.vim +++ b/scripts/vim/ftdetect/task.vim @@ -1,6 +1,7 @@ " Vim support file to detect task data files and single task edits " " Maintainer: John Florian +" Updated: Wed Jul 8 19:45:55 EDT 2009 " " Copyright 2009 John Florian " @@ -9,7 +10,9 @@ " for the raw data files -au BufRead,BufNewFile {pending,completed}.data set filetype=taskdata +au BufRead,BufNewFile {pending,completed,undo}.data set filetype=taskdata " for 'task 42 edit' -au BufRead,BufNewFile *.task set filetype=taskedit +au BufRead,BufNewFile *.task set filetype=taskedit + +" vim:noexpandtab diff --git a/scripts/vim/syntax/taskdata.vim b/scripts/vim/syntax/taskdata.vim index c3c01dca1..bddb11766 100644 --- a/scripts/vim/syntax/taskdata.vim +++ b/scripts/vim/syntax/taskdata.vim @@ -1,6 +1,7 @@ " Vim syntax file " Language: task data " Maintainer: John Florian +" Updated: Wed Jul 8 19:46:20 EDT 2009 " " Copyright 2009 John Florian " @@ -18,26 +19,29 @@ endif " Key Names for values. syn keyword taskdataKey description due end entry imask mask parent -syn keyword taskdataKey priority project recur start status tags uuid +syn keyword taskdataKey priority project recur start status tags uuid syn match taskdataKey "annotation_\d\+" +syn match taskdataUndo "^time.*$" +syn match taskdataUndo "^\(old \|new \|---\)" " Values associated with key names. " " Strings syn region taskdataString matchgroup=Normal start=+"+ end=+"+ - \ contains=taskdataEncoded,taskdataUUID,@Spell + \ contains=taskdataEncoded,taskdataUUID,@Spell " " Special Embedded Characters (e.g., ",") syn match taskdataEncoded "&\a\+;" contained " UUIDs -syn match taskdataUUID "\x\{8}-\(\x\{4}-\)\{3}\x\{12}" contained +syn match taskdataUUID "\x\{8}-\(\x\{4}-\)\{3}\x\{12}" contained " The default methods for highlighting. Can be overridden later. hi def link taskdataEncoded Function hi def link taskdataKey Statement hi def link taskdataString String -hi def link taskdataUUID Special +hi def link taskdataUUID Special +hi def link taskdataUndo Type let b:current_syntax = "taskdata" diff --git a/scripts/vim/syntax/taskedit.vim b/scripts/vim/syntax/taskedit.vim index 68bd90cfa..3f46fe58d 100644 --- a/scripts/vim/syntax/taskedit.vim +++ b/scripts/vim/syntax/taskedit.vim @@ -1,6 +1,7 @@ " Vim syntax file " Language: support for 'task 42 edit' " Maintainer: John Florian +" Updated: Wed Jul 8 19:46:32 EDT 2009 " " Copyright 2009 John Florian " @@ -16,11 +17,11 @@ elseif exists("b:current_syntax") finish endif -syn match taskeditHeading "^\s*#\s*Name\s\+Editable details\s*$" contained -syn match taskeditHeading "^\s*#\s*-\+\s\+-\+\s*$" contained -syn match taskeditReadOnly "^\s*#\s*\(UU\)\?ID:.*$" contained -syn match taskeditReadOnly "^\s*#\s*Status:.*$" contained -syn match taskeditReadOnly "^\s*#\s*i\?Mask:.*$" contained +syn match taskeditHeading "^\s*#\s*Name\s\+Editable details\s*$" contained +syn match taskeditHeading "^\s*#\s*-\+\s\+-\+\s*$" contained +syn match taskeditReadOnly "^\s*#\s*\(UU\)\?ID:.*$" contained +syn match taskeditReadOnly "^\s*#\s*Status:.*$" contained +syn match taskeditReadOnly "^\s*#\s*i\?Mask:.*$" contained syn match taskeditKey "^ *.\{-}:" nextgroup=taskeditString syn match taskeditComment "^\s*#.*$" \ contains=taskeditReadOnly,taskeditHeading @@ -31,7 +32,7 @@ syn match taskeditString ".*$" contained contains=@Spell hi def link taskeditComment Comment hi def link taskeditHeading Function hi def link taskeditKey Statement -hi def link taskeditReadOnly Special +hi def link taskeditReadOnly Special hi def link taskeditString String let b:current_syntax = "taskedit"