Small improvements on due dates + key:value

ADD: syntax highlight for couples key:value
ADD: Handle DUE:date
CHG: No space between due: and date
CHG: Doc updated
This commit is contained in:
David Beniamine
2015-07-05 15:00:07 +02:00
parent cf10a3b0b8
commit 73ba0effca
6 changed files with 91 additions and 52 deletions

View File

@@ -1,9 +1,9 @@
" File: todo.txt.vim
" Description: Todo.txt filetype detection
" Author: Leandro Freitas <freitass@gmail.com>, David Beniamine <David@Beniamine.net>
" Author: David Beniamine <David@Beniamine.net>, Leandro Freitas <freitass@gmail.com>
" License: Vim license
" Website: http://github.com/dbeniamine/todo.txt-vim
" Version: 0.6
" Version: 0.7
" Save context {{{1
let s:save_cpo = &cpo
@@ -85,12 +85,12 @@ function! TodoTxtSort()
sort /\v\([A-Z]\)/ r
endfunction
function! TodoTxtSortDue()
function! TodoTxtSortDue()
silent! %s/\([dD][uU][eE]:\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g
" Sort adding entries with due dates add the beginning
" Sort adding entries with due dates add the beginning
sort n /[dD][uU][eE]:/
" Count the number of lines
silent normal gg
silent normal gg
execute "/[dD][uU][eE]:"
let l:first=getpos(".")[1]
silent normal N
@@ -100,7 +100,7 @@ function! TodoTxtSortDue()
execute ':'.l:first
execute ':d'.l:diff
silent normal gg
silent normal P
silent normal P
silent! %s/\([dD][uU][eE]:\d\{4}\)\(\d\{2}\)/\1-\2-/g
" TODO: add time sorting (YYYY-MM-DD HH:MM)
endfunction
@@ -202,7 +202,11 @@ if !hasmapto("date<Tab>",'i')
inoremap <script> <silent> <buffer> date<Tab> <C-R>=strftime("%Y-%m-%d")<CR>
endif
if !hasmapto("due:",'i')
if !hasmapto("due:",'i')
inoremap <script> <silent> <buffer> due: due:<C-R>=strftime("%Y-%m-%d")<CR>
endif
if !hasmapto("DUE:",'i')
inoremap <script> <silent> <buffer> DUE: DUE:<C-R>=strftime("%Y-%m-%d")<CR>
endif

View File

@@ -3,7 +3,7 @@
" Author: David Beniamine <david@beniamine.net>
" Licence: Vim licence
" Website: http://github.com/dbeniamine/todo.txt.vim
" Version: 0.6
" Version: 0.7
" vim: ts=4 sw=4 :help tw=78 cc=80
" These two variables are parameters for the successive calls the vim sort