Fixes #14. Also changes some shortcuts

This commit is contained in:
Leandro Freitas
2014-04-27 21:26:58 -03:00
parent d1aaeff366
commit 45aa73bf5e
3 changed files with 28 additions and 15 deletions

View File

@@ -12,11 +12,13 @@ mappings, to help with edition of these files:
`<leader>-d` : Insert the current date
`<leader>-D` : Mark task as done (inserts current date as completion date)
`DD` : Mark all tasks as completed
`date<tab>` : (Insert mode) Insert the current date
`<leader>-x` : Mark task as done (inserts current date as completion date)
`<leader>-X` : Mark all tasks as completed
`<leader>-D` : Remove completed tasks
If you want the help installed run ":helptags ~/.vim/doc" inside vim after having copied the files.
Then you will be able to get the commands help with: :h todo.txt

View File

@@ -7,10 +7,12 @@ COMMANDS *todo-commands*
`<leader>-d` : Insert the current date
`<leader>-D` : Mark task as done (inserts current date as completion date)
`DD` : Mark all tasks as completed
`date<tab>` : (Insert mode) Insert the current date
`<leader>-x` : Mark task as done (inserts current date as completion date)
`<leader>-X` : Mark all tasks as completed
`<leader>-D` : Remove completed tasks
<leader> is \ by default, so <leader>-s means you type \s

View File

@@ -32,7 +32,11 @@ function! TodoTxtMarkAsDone()
normal! Ix
endfunction
function! TodoTxtMarkAllAsDone()
function! TodoTxtMarkAllAsDone()
:g!/^x /:call TodoTxtMarkAsDone()
endfunction
function! TodoTxtRemoveCompleted()
:g/^x /d
endfunction
@@ -55,17 +59,22 @@ if !hasmapto("<leader>d",'v')
vnoremap <script> <silent> <buffer> <leader>d :call TodoTxtPrependDate()<CR>
endif
" Mark done {{{2
if !hasmapto("<leader>D",'n')
" Mark done {{{2
if !hasmapto("<leader>x",'n')
nnoremap <script> <silent> <buffer> <leader>x :call TodoTxtMarkAsDone()<CR>
endif
if !hasmapto("<leader>D",'v')
if !hasmapto("<leader>x",'v')
vnoremap <script> <silent> <buffer> <leader>x :call TodoTxtMarkAsDone()<CR>
endif
" Mark all done {{{2
if !hasmapto("DD",'n')
" Mark all done {{{2
if !hasmapto("<leader>X",'n')
nnoremap <script> <silent> <buffer> <leader>X :call TodoTxtMarkAllAsDone()<CR>
endif
" Remove completed {{{2
if !hasmapto("<leader>D",'n')
nnoremap <script> <silent> <buffer> <leader>D :call TodoTxtRemoveCompleted()<CR>
endif