Added shortcut to mark all tasks as done

This commit is contained in:
Leandro Freitas
2014-04-27 10:54:27 -03:00
parent a3307cb57e
commit d1aaeff366
4 changed files with 28 additions and 15 deletions

View File

@@ -12,9 +12,11 @@ mappings, to help with edition of these files:
`<leader>-d` : Insert the current date `<leader>-d` : Insert the current date
`<leader>-D` : Insert the current date with leading `x` (completed) `<leader>-D` : Mark task as done (inserts current date as completion date)
`date<tab>` : (Insert mode) Insert the current date `DD` : Mark all tasks as completed
`date<tab>` : (Insert mode) Insert the current date
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

@@ -3,11 +3,11 @@
(B) 2011-05-31 Start documentation @doc (B) 2011-05-31 Start documentation @doc
(C) 2011-06-01 Improve syntax file @syntax (C) 2011-06-01 Improve syntax file @syntax
x 2014-04-27 2011-05-30 Contact main project for reference x 2014-04-27 2011-05-30 Contact main project for reference
X 2011-05-30 Create README.markdown to be published in github @doc x 2011-05-30 Create README.markdown to be published in github @doc
X 2011-05-30 Implement colorized priorities @syntax x 2011-05-30 Implement colorized priorities @syntax
X 2011-05-30 Implement filetype detection @ftdetect x 2011-05-30 Implement filetype detection @ftdetect
X 2011-05-30 Sort lines per priority @ftplugin x 2011-05-30 Sort lines per priority @ftplugin
X 2011-05-31 Highlight date, project and context of tasks with no priority @syntax x 2011-05-31 Highlight date, project and context of tasks with no priority @syntax
X 2011-05-31 Stop breaking lines automatically @ftplugin x 2011-05-31 Stop breaking lines automatically @ftplugin
X 2011-06-06 Easier date input @ftplugin x 2011-06-06 Easier date input @ftplugin
X 2011-06-06 Implement foldings @ftplugin x 2011-06-06 Implement foldings @ftplugin

View File

@@ -3,12 +3,14 @@
============================================================================== ==============================================================================
COMMANDS *todo-commands* COMMANDS *todo-commands*
`<Leader>-s` : Sort the file `<leader>-s` : Sort the file
`<Leader>-d` : Insert the current date `<leader>-d` : Insert the current date
`<Leader>-D` : Insert the current date with leading `x` (completed) `<leader>-D` : Mark task as done (inserts current date as completion date)
`date<tab>` : (Insert mode) Insert the current date `DD` : Mark all tasks as completed
<Leader> is \ by default, so <Leader>-s means you type \s `date<tab>` : (Insert mode) Insert the current date
<leader> is \ by default, so <leader>-s means you type \s

View File

@@ -31,6 +31,10 @@ function! TodoTxtMarkAsDone()
call TodoTxtPrependDate() call TodoTxtPrependDate()
normal! Ix normal! Ix
endfunction endfunction
function! TodoTxtMarkAllAsDone()
:g!/^x /TodoTxtMarkAsDone()
endfunction
" Mappings {{{1 " Mappings {{{1
" Sort tasks {{{2 " Sort tasks {{{2
@@ -59,6 +63,11 @@ if !hasmapto("<leader>D",'v')
if !hasmapto("<leader>D",'v') if !hasmapto("<leader>D",'v')
vnoremap <script> <silent> <buffer> <leader>D :call TodoTxtMarkAsDone()<CR> vnoremap <script> <silent> <buffer> <leader>D :call TodoTxtMarkAsDone()<CR>
endif endif
" Mark all done {{{2
if !hasmapto("DD",'n')
nnoremap <script> <silent> <buffer> DD :call TodoTxtMarkAllAsDone()<CR>
endif
" Folding {{{1 " Folding {{{1
" Options {{{2 " Options {{{2