Feature - #307 vim support for taskrc
- Added support for syntax highlighting of taskrc within vim.
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
||||||
+ Fixed bug #347 which used only a lowercase "all" to confirm multiple changes
|
+ Fixed bug #347 which used only a lowercase "all" to confirm multiple changes
|
||||||
instead of an uppercase "All" like the "Yes" answer.
|
instead of an uppercase "All" like the "Yes" answer.
|
||||||
|
+ Added feature #307 that provides vim with syntax highlighting for taskrc.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
Configure VIM for Syntax Highlighting of Task Data
|
Configure VIM for Syntax Highlighting of Task Data
|
||||||
|
|
||||||
|
|
||||||
The task data files (pending.data, completed.data and undo.data) as well as
|
The task data files (pending.data, completed.data and undo.data),
|
||||||
edits made via commands like "task 1 edit" can be color-highlighted if you
|
configuration file (.taskrc) as well as edits made via commands like "task 1
|
||||||
happen to use VIM as your preferred text editor. Eventually this will happen
|
edit" can be color-highlighted if you happen to use VIM as your preferred text
|
||||||
automatically in newer versions of VIM, but for now you have to do a little
|
editor. Eventually this will happen automatically in newer versions of VIM,
|
||||||
bit of file shuffling.
|
but for now you have to do a little bit of file shuffling.
|
||||||
|
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
|
|
||||||
For this to work, you need to first have syntax highlighting enabled when you
|
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
|
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
|
usually quite simple if that doesn't happen to be so in your case. Rather
|
||||||
repeat the excellent VIM documentation here, please see the appropriate VIM
|
than repeat the excellent VIM documentation here, please see the appropriate
|
||||||
documentation itself. Generally this can be made seen by starting vim/gvim and
|
VIM documentation itself. Generally this can be made seen by starting
|
||||||
issuing the following command:
|
vim/gvim and issuing the following command:
|
||||||
|
|
||||||
:help syntax
|
:help syntax
|
||||||
|
|
||||||
@@ -27,18 +27,20 @@ You may prefer instead to read the help online at:
|
|||||||
Configuring VIM to Understand Task Data
|
Configuring VIM to Understand Task Data
|
||||||
|
|
||||||
Once you have VIM's syntax highlighting enabled and working with other file
|
Once you have VIM's syntax highlighting enabled and working with other file
|
||||||
types properly, configuring it for use with task is simple. You simply need to
|
types properly, configuring it for use with task is simple. You simply need
|
||||||
copy some files that came with task into your home directory so that you have:
|
to copy some files that came with task into your home directory so that you
|
||||||
|
have:
|
||||||
|
|
||||||
~/.vim/ftdetect/task.vim
|
~/.vim/ftdetect/task.vim
|
||||||
~/.vim/syntax/taskdata.vim
|
~/.vim/syntax/taskdata.vim
|
||||||
~/.vim/syntax/taskedit.vim
|
~/.vim/syntax/taskedit.vim
|
||||||
|
~/.vim/syntax/taskrc.vim
|
||||||
|
|
||||||
The source of these files varies depending on how you installed task. If you
|
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
|
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
|
/usr/share/doc/task-VERSION/scripts/vim/. If you built task yourself from the
|
||||||
tarball (using the default configure options), these will be in
|
tarball (using the default configure options), these will be in
|
||||||
/usr/local/share/doc/task-VERSION/scripts/vim/ instead. So you should be able
|
/usr/local/share/doc/task-VERSION/scripts/vim/ instead. So you should be able
|
||||||
to do one of the following:
|
to do one of the following:
|
||||||
|
|
||||||
cp -av /usr/share/doc/task-VERSION/scripts/vim/* ~/.vim/
|
cp -av /usr/share/doc/task-VERSION/scripts/vim/* ~/.vim/
|
||||||
@@ -49,7 +51,7 @@ or
|
|||||||
|
|
||||||
You should then be ready to go.
|
You should then be ready to go.
|
||||||
---
|
---
|
||||||
All three above mentioned files are
|
All four above mentioned files are
|
||||||
|
|
||||||
Copyright 2009 John Florian
|
Copyright 2009 John Florian
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
" Vim support file to detect task data files and single task edits
|
" Vim support file to detect Task Warrior data and configuration files and
|
||||||
|
" single task edits
|
||||||
"
|
"
|
||||||
" Maintainer: John Florian <jflorian@doubledog.org>
|
" Maintainer: John Florian <jflorian@doubledog.org>
|
||||||
" Updated: Wed Jul 8 19:45:55 EDT 2009
|
" Updated: Thu Dec 10 18:28:26 EST 2009
|
||||||
"
|
"
|
||||||
" Copyright 2009 John Florian
|
" Copyright 2009 John Florian
|
||||||
"
|
"
|
||||||
@@ -9,10 +10,13 @@
|
|||||||
" For the full text of this license, see COPYING.
|
" For the full text of this license, see COPYING.
|
||||||
|
|
||||||
|
|
||||||
" for the raw data files
|
" Task Warrior data files
|
||||||
au BufRead,BufNewFile {pending,completed,undo}.data set filetype=taskdata
|
au BufRead,BufNewFile {pending,completed,undo}.data set filetype=taskdata
|
||||||
|
|
||||||
" for 'task 42 edit'
|
" Task Warrior configuration file
|
||||||
|
au BufRead,BufNewFile .taskrc set filetype=taskrc
|
||||||
|
|
||||||
|
" Task Warrior handling of 'task 42 edit'
|
||||||
au BufRead,BufNewFile *.task set filetype=taskedit
|
au BufRead,BufNewFile *.task set filetype=taskedit
|
||||||
|
|
||||||
" vim:noexpandtab
|
" vim:noexpandtab
|
||||||
|
|||||||
43
scripts/vim/syntax/taskrc.vim
Normal file
43
scripts/vim/syntax/taskrc.vim
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: support for editing task configuration file
|
||||||
|
" Maintainer: John Florian <jflorian@doubledog.org>
|
||||||
|
" Updated: Wed Nov 25 12:19:43 EST 2009
|
||||||
|
"
|
||||||
|
" Copyright 2009 John Florian
|
||||||
|
"
|
||||||
|
" This file is available under the GNU Public License version 2 or later.
|
||||||
|
" For the full text of this license, see COPYING.
|
||||||
|
|
||||||
|
|
||||||
|
" For version 5.x: Clear all syntax items.
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded.
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match taskrcVal ".\{-}$" contains=taskrcComment
|
||||||
|
syn match taskrcEqual "="
|
||||||
|
syn match taskrcKey "^\s*.\{-}="he=e-1 contains=taskrcEqual
|
||||||
|
|
||||||
|
syn keyword taskrcGoodKey locking curses confirmation next bulk nag dateformat weekstart displayweeknumber due defaultwidth editor monthsperline
|
||||||
|
|
||||||
|
syn match taskrcGoodKey "color\(\.\(overdue\|due\|pri\.\([HML]\|none\)\|active\|tagged\|recurring\|header\|footnote\|\(\(tag\|project\|keyword\)\.\S\{-}\)\)\)\?="he=e-1
|
||||||
|
syn match taskrcGoodKey "data\.location"
|
||||||
|
syn match taskrcGoodKey "default\.\(command\|project\|priority\)"
|
||||||
|
syn match taskrcGoodKey "echo\.command"
|
||||||
|
syn match taskrcGoodKey "report\.\S\{-}\.\(description\|columns\|labels\|sort\|filter\)="he=e-1
|
||||||
|
syn match taskrcGoodKey "shadow\.\(file\|command\|notify\)"
|
||||||
|
|
||||||
|
syn match taskrcComment "#.*$"
|
||||||
|
|
||||||
|
" The default methods for highlighting. Can be overridden later.
|
||||||
|
hi def link taskrcComment Comment
|
||||||
|
hi def link taskrcKey Statement
|
||||||
|
hi def link taskrcVal String
|
||||||
|
hi def link taskrcGoodKey Function
|
||||||
|
|
||||||
|
let b:current_syntax = "taskrc"
|
||||||
|
|
||||||
|
" vim:noexpandtab
|
||||||
Reference in New Issue
Block a user