J’ai codé un bout de syntaxe vim dédiée aux todolist trouvée sur le net (zut lien disparu). J’ai brodé autour en rajoutant 2-3 bonnes idées :
– gestion des folds pour éviter les
– syntaxe fini/encours/important
– extension de la reconnaissance des données date/perso/n°
– notation à base de + et - en vue d’un classement
…bref un truc qui colle à ma façon de penser. Pour utiliser la syntaxe : utiliser vim et avoir cette ligne en en-tête de fichier “vim: ft=todolist”. Et voilà une capture d’écran de ce que ça donne dans mon terminal :
Pour installer, créer ce fichier : ~/.vim/syntax/todolist.vim (attention syntaxe de fold en BÉPO mappée sur la touche à gauche de 1)
[code]" Vim syntax file
" Author: Germain Bossu
" Latest Revision: 04/10/2012
" Tuned from :
" Language: mytodo
" Maintainer: Jean-Baptiste Hetier
" Latest Revision: 04/08/2011
" Website: http://www.think-underground.com/post/2012/02/16/Gérer-sa-liste-de-todos-dans-Vim
" Used symbols :
" - # Unfolded Title
" - = SubTitle
" - ! Important line
" - > Current line
" - x Closed line
" - * Item
" - +|- Rates
" - ? Unknown
" - => Notes
" - @ People
if exists(“b:current_syntax”)
finish
endif
"================= Data ===================
syn match todoDate '<\d{2}/\d{2}/\d+>'
syn match todoHour '<\d{2}:\d{2}>'
syn match todoPeople '\S*@\S+'
syn match todoPeople '@\S+\s\u\S*'
syn match todoPeople '@\S+.*\S@'
syn match todoNumber ‘n°\S+’
hi todoDate ctermfg=Green guifg=Green
hi todoHour ctermfg=Green guifg=Green
hi todoPeople ctermfg=Green guifg=Green
hi todoNumber ctermfg=Green guifg=Green
syn cluster todoData contains=todoDate,todoHour,todoPeople,todoNumber
"================= Rates ===================
syn match todoRateP ‘+(+|-)\t’
syn match todoRateM '-(+|-)\t’
hi todoRateP ctermfg=Cyan guifg=Cyan
hi todoRateM ctermfg=DarkCyan guifg=DarkCyan
syn cluster todoRates contains=todoRateP,todoRateM
"=============== Bullets ==================
syn match todoItem '^\s+*'
syn match todoSubItem '^\s+~'
syn match todoUnknown ‘^\s+?’
hi todoItem ctermfg=Magenta guifg=Magenta
hi todoSubItem ctermfg=Magenta guifg=Magenta
hi todoUnknown ctermfg=Green guifg=Green
syn cluster todoBullets contains=todoItem,todoSubItem,todoUnknown
“============= Colorlines =================
” important :
syn match todoImportant ‘!\s.$’ contains=@todoData,@todoRates,todoNotes
syn match todoImportant '!+$'
syn match todoImportant '^!.$’ contains=@todoData,@todoRates,todoNotes
" others :
syn match todoCurrentList ‘>\s.$’ contains=@todoData,@todoRates,todoNotes
syn match todoClosedList '<x\s.$’ contains=@todoData,@todoRates
syn match todoNotes ‘=>.*’ contains=@todoData,@todoRates
hi todoImportant ctermfg=Red guifg=Red term=bold gui=bold
hi todoCurrentList ctermfg=Yellow guifg=Yellow
hi todoClosedList ctermfg=DarkGreen guifg=DarkGreen
hi todoNotes ctermfg=DarkRed guifg=DarkRed
"============= Vim commands ================
syn match todoVim '^vim:.*$'
hi todoVim ctermfg=Blue guifg=Blue
"=============== Titles ====================
syn match todoTitle ‘^\S+.$’ contains=todoImportant,todoNotes,todoVim
syn match todoSubTitle '^( |+|-|?|\t)=.*$’ contains=todoImportant,todoNotes,@todoBullets,@todoData,@todoRates
hi todoTitle ctermfg=Magenta guifg=Magenta term=bold gui=bold
hi todoSubTitle ctermfg=DarkYellow guifg=DarkYellow term=bold gui=bold
“=========== General Settings ==============
” Fold policy
set foldmethod=syntax
syn region todoSection fold start="^\S.:$" end="^\s\n" contains=ALL
syn sync fromstart
" Settings
set nowrap
set tabstop=4
set shiftwidth=1
“” Fold Shortcuts (BEPO)
"nmap _ zc
"nmap $ zM
"nmap # zR
" Fold Shortcuts (AZERTY)
nmap zc
nmap ² zM
nmap ³ zR
let b:current_syntax = “mytodo”
[/code]
Sources du fichier de la capture d’écran :
[code]vim: ft=todolist
_____________ CATÉGORIE A _________________
À faire :!
= courses
- acheter ceci
- acheter cela
= Administratif
x aller à la mairie
x renouveler passeport
assurance santé => contacter @Bob
x toto
~ titi => RDV 03/10/2012
! tutu
- faire un virement à @Pédo Bear
- rappeler @Machin
- prendre un billet d’avion
! résilier téléphone mobile
Rendez-vous :
! 03/10/2102 anniversaire Valentin => finir todolist
- 15/11/2012 concert Puhdys
- 24/12/2012 Noël
_____________ CATÉGORIE B _________________
Dev :
= Suivi
x intégrer telle fonction
x puis telle autre
celle-ci
- et encore celle là
~ penser à ceci
~ et celà
- nettoyage
- release
= Next steps => rating pour les priorité
+++ idée 1
++ idée 2
± idée 3
-+ idée 4
— idée 5
ouvrir un fold : espace
fermer un fold : Control + espace
fermer tous les folds : ² (clavier français)
ouvrir tous les folds : shift+² (clavier français)[/code]