Vim syntax highlighting (thanks to John Florian)
This commit is contained in:
@@ -13,5 +13,8 @@ nobase_dist_bashscripts_DATA = scripts/bash/task_completion.sh
|
|||||||
zshscriptsdir = $(docdir)
|
zshscriptsdir = $(docdir)
|
||||||
nobase_dist_zshscripts_DATA = scripts/zsh/_task
|
nobase_dist_zshscripts_DATA = scripts/zsh/_task
|
||||||
|
|
||||||
|
vimscriptsdir = $(docdir)
|
||||||
|
nobase_dist_vimscripts_DATA = scripts/vim/README scripts/vim/ftdetect/task.vim scripts/vim/syntax/taskdata.vim scripts/vim/syntax/taskedit.vim
|
||||||
|
|
||||||
i18ndir = $(docdir)
|
i18ndir = $(docdir)
|
||||||
nobase_dist_i18n_DATA = i18n/strings.de-DE i18n/strings.en-US i18n/strings.es-ES i18n/strings.fr-FR i18n/strings.nl-NL i18n/strings.sv-SE
|
nobase_dist_i18n_DATA = i18n/strings.de-DE i18n/strings.en-US i18n/strings.es-ES i18n/strings.fr-FR i18n/strings.nl-NL i18n/strings.sv-SE i18n/tips.de-DE i18n/tips.en-US i18n/tips.sv-SE
|
||||||
|
|||||||
31
scripts/vim/README
Normal file
31
scripts/vim/README
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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 and issuing the following
|
||||||
|
command:
|
||||||
|
|
||||||
|
:help syntax
|
||||||
|
|
||||||
|
You may prefer to use your web browser via:
|
||||||
|
|
||||||
|
http://vimdoc.sourceforge.net/htmldoc/syntax.html#syntax
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
~/.vim/ftdetect/task.vim
|
||||||
|
~/.vim/syntax/taskdata.vim
|
||||||
|
~/.vim/syntax/taskedit.vim
|
||||||
|
|
||||||
|
|
||||||
|
You should then be ready to go.
|
||||||
|
|
||||||
|
For more information regarding task, the official site may be referecend at
|
||||||
|
|
||||||
|
http://taskwarrior.org
|
||||||
37
scripts/vim/ftdetect/task.vim
Normal file
37
scripts/vim/ftdetect/task.vim
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
" Vim support file to detect task data files and single task edits
|
||||||
|
"
|
||||||
|
" Maintainer: John Florian <jflorian@doubledog.org>
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Copyright 2009 John Florian
|
||||||
|
" All rights reserved.
|
||||||
|
"
|
||||||
|
" This file is part of the task project.
|
||||||
|
"
|
||||||
|
" This program is free software; you can redistribute it and/or modify it under
|
||||||
|
" the terms of the GNU General Public License as published by the Free Software
|
||||||
|
" Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
" version.
|
||||||
|
"
|
||||||
|
" This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
" FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
" details.
|
||||||
|
"
|
||||||
|
" You should have received a copy of the GNU General Public License along with
|
||||||
|
" this program; if not, write to the
|
||||||
|
"
|
||||||
|
" Free Software Foundation, Inc.,
|
||||||
|
" 51 Franklin Street, Fifth Floor,
|
||||||
|
" Boston, MA
|
||||||
|
" 02110-1301
|
||||||
|
" USA
|
||||||
|
"
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
" for the raw data files
|
||||||
|
au BufRead,BufNewFile {pending,completed}.data set filetype=taskdata
|
||||||
|
|
||||||
|
" for 'task 42 edit'
|
||||||
|
au BufRead,BufNewFile *.task set filetype=taskedit
|
||||||
78
scripts/vim/syntax/taskdata.vim
Normal file
78
scripts/vim/syntax/taskdata.vim
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: task data
|
||||||
|
" Maintainer: John Florian <jflorian@doubledog.org>
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Copyright 2009 John Florian
|
||||||
|
" All rights reserved.
|
||||||
|
"
|
||||||
|
" This file is part of the task project.
|
||||||
|
"
|
||||||
|
" This program is free software; you can redistribute it and/or modify it under
|
||||||
|
" the terms of the GNU General Public License as published by the Free Software
|
||||||
|
" Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
" version.
|
||||||
|
"
|
||||||
|
" This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
" FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
" details.
|
||||||
|
"
|
||||||
|
" You should have received a copy of the GNU General Public License along with
|
||||||
|
" this program; if not, write to the
|
||||||
|
"
|
||||||
|
" Free Software Foundation, Inc.,
|
||||||
|
" 51 Franklin Street, Fifth Floor,
|
||||||
|
" Boston, MA
|
||||||
|
" 02110-1301
|
||||||
|
" USA
|
||||||
|
"
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
" 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
|
||||||
|
|
||||||
|
" Key Names for values.
|
||||||
|
syn keyword taskKey description due end entry imask mask parent priority
|
||||||
|
syn keyword taskKey project recur start status tags uuid
|
||||||
|
syn match taskKey "annotation_\d\+"
|
||||||
|
|
||||||
|
" Values associated with key names.
|
||||||
|
"
|
||||||
|
" Strings
|
||||||
|
syn region taskString matchgroup=Normal start=+"+ end=+"+
|
||||||
|
\ contains=taskEncoded,taskUUID,@Spell
|
||||||
|
"
|
||||||
|
" Special Embedded Characters (e.g., ",")
|
||||||
|
syn match taskEncoded "&\a\+;" contained
|
||||||
|
" UUIDs
|
||||||
|
syn match taskUUID "\x\{8}-\(\x\{4}-\)\{3}\x\{12}" contained
|
||||||
|
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_taskdata_syntax_inits")
|
||||||
|
if version <= 508
|
||||||
|
let did_taskdata_syntax_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The default methods for highlighting. Can be overridden later.
|
||||||
|
HiLink taskEncoded Function
|
||||||
|
HiLink taskKey Statement
|
||||||
|
HiLink taskOperator Operator
|
||||||
|
HiLink taskString String
|
||||||
|
HiLink taskUUID Special
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "taskdata"
|
||||||
|
|
||||||
|
" vim:noexpandtab
|
||||||
71
scripts/vim/syntax/taskedit.vim
Normal file
71
scripts/vim/syntax/taskedit.vim
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: support for 'task 42 edit'
|
||||||
|
" Maintainer: John Florian <jflorian@doubledog.org>
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Copyright 2009 John Florian
|
||||||
|
" All rights reserved.
|
||||||
|
"
|
||||||
|
" This file is part of the task project.
|
||||||
|
"
|
||||||
|
" This program is free software; you can redistribute it and/or modify it under
|
||||||
|
" the terms of the GNU General Public License as published by the Free Software
|
||||||
|
" Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
" version.
|
||||||
|
"
|
||||||
|
" This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
" FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
" details.
|
||||||
|
"
|
||||||
|
" You should have received a copy of the GNU General Public License along with
|
||||||
|
" this program; if not, write to the
|
||||||
|
"
|
||||||
|
" Free Software Foundation, Inc.,
|
||||||
|
" 51 Franklin Street, Fifth Floor,
|
||||||
|
" Boston, MA
|
||||||
|
" 02110-1301
|
||||||
|
" USA
|
||||||
|
"
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
" 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 taskHeading "^\s*#\s*Name\s\+Editable details\s*$" contained
|
||||||
|
syn match taskHeading "^\s*#\s*-\+\s\+-\+\s*$" contained
|
||||||
|
syn match taskReadOnly "^\s*#\s*\(UU\)\?ID:.*$" contained
|
||||||
|
syn match taskReadOnly "^\s*#\s*Status:.*$" contained
|
||||||
|
syn match taskReadOnly "^\s*#\s*i\?Mask:.*$" contained
|
||||||
|
syn match taskKey "^ *.\{-}:" nextgroup=taskString
|
||||||
|
syn match taskComment "^\s*#.*$" contains=taskReadOnly,taskHeading
|
||||||
|
syn match taskString ".*$" contained contains=@Spell
|
||||||
|
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_taskedit_syntax_inits")
|
||||||
|
if version <= 508
|
||||||
|
let did_taskedit_syntax_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The default methods for highlighting. Can be overridden later.
|
||||||
|
HiLink taskComment Comment
|
||||||
|
HiLink taskHeading Function
|
||||||
|
HiLink taskKey Statement
|
||||||
|
HiLink taskReadOnly Special
|
||||||
|
HiLink taskString String
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "taskedit"
|
||||||
|
|
||||||
|
" vim:noexpandtab
|
||||||
Reference in New Issue
Block a user