Cancel tasks with <localleader>c
This commit is contained in:
@@ -164,6 +164,8 @@ like this behavior, you can set the default done.txt name:
|
||||
|
||||
`<LocalLeader>x` is a toggle which allow you to unmark a task as done.
|
||||
|
||||
`<LocalLeader>c` Mark a task cancelled
|
||||
|
||||
Syntax highlighting for couples key:value
|
||||
|
||||
If the current buffer is a done.txt file, the basic sort sorts on completion
|
||||
|
||||
@@ -58,19 +58,27 @@ function! todo#PrependDate()
|
||||
normal! 0"=strftime("%Y-%m-%d ")
|
||||
P
|
||||
endfunction
|
||||
|
||||
|
||||
function! todo#ToggleMarkAsDone(status)
|
||||
if (getline(".") =~ 'x\s*\d\{4\}')
|
||||
if (getline(".") =~ 'x\s*\d\{4\}')
|
||||
:call todo#UnMarkAsDone(a:status)
|
||||
else
|
||||
else
|
||||
:call todo#MarkAsDone(a:status)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! todo#UnMarkAsDone()
|
||||
|
||||
function! todo#UnMarkAsDone(status)
|
||||
if a:status==''
|
||||
let pat=''
|
||||
else
|
||||
let pat=' '.a:status
|
||||
endif
|
||||
exec ':s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}'.pat.'\s*//g'
|
||||
endfunction
|
||||
|
||||
|
||||
function! todo#MarkAsDone(status)
|
||||
if a:status!=''
|
||||
exec 'normal! I'.a:status.' '
|
||||
endif
|
||||
call todo#PrependDate()
|
||||
normal! Ix
|
||||
|
||||
@@ -122,16 +122,27 @@ endif
|
||||
|
||||
" Mark done {{{2
|
||||
if !hasmapto("<localleader>x",'n')
|
||||
nnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<localleader>x",'v')
|
||||
vnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR>
|
||||
endif
|
||||
|
||||
" Mark done {{{2
|
||||
if !hasmapto("<localleader>c",'n')
|
||||
nnoremap <script> <silent> <buffer> <localleader>c :call todo#ToggleMarkAsDone('Cancelled')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<localleader>c",'v')
|
||||
vnoremap <script> <silent> <buffer> <localleader>c :call todo#ToggleMarkAsDone('Cancelled')<CR>
|
||||
endif
|
||||
|
||||
|
||||
|
||||
" Mark all done {{{2
|
||||
if !hasmapto("<localleader>X",'n')
|
||||
nnoremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone('')<CR>
|
||||
endif
|
||||
|
||||
" Remove completed {{{2
|
||||
|
||||
Reference in New Issue
Block a user