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` : 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 `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. 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 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` : 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 `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 <leader> is \ by default, so <leader>-s means you type \s

View File

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