Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action and mapping to unmark as done + fix #64 #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ Date:
`<localleader>d` Set current task's creation date to the current date
`date<tab>` (Insert mode) Insert the current date

Mark as done:
Mark / unmark as done:
`<localleader>x` Mark current task as done
`<localleader>X` Mark all tasks as done
`<localleader>u` Mark current task as undone
`<localleader>U` Mark all tasks as undone
`<localleader>D` Move completed tasks to done.txt

This plugin detects any text file with the name todo.txt or done.txt with an optional prefix that ends in a period (e.g. second.todo.txt, example.done.txt).
Expand Down
10 changes: 9 additions & 1 deletion autoload/todo/txt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function! todo#txt#replace_date()
endfunction

function! todo#txt#mark_as_done()
call s:remove_priority()
" call s:remove_priority()
call todo#txt#prepend_date()
execute 'normal! Ix '
endfunction
Expand All @@ -48,6 +48,14 @@ function! todo#txt#mark_all_as_done()
:g!/^x /:call todo#txt#mark_as_done()
endfunction

function! todo#txt#unmark_as_done()
:s/^x \(\d\{2,4\}-\d\{2\}-\d\{2\} \)\?//ge
endfunction

function! todo#txt#unmark_all_as_done()
:g/^x /:call todo#txt#unmark_as_done()
endfunction

function! s:append_to_file(file, lines)
let l:lines = []

Expand Down
7 changes: 7 additions & 0 deletions ftplugin/todo.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ vnoremap <script> <silent> <buffer> <localleader>x :call todo#txt#mark_as_done()
" Mark all done {{{2
nnoremap <script> <silent> <buffer> <localleader>X :call todo#txt#mark_all_as_done()<CR>

" Unmark done {{{2
nnoremap <script> <silent> <buffer> <localleader>u :call todo#txt#unmark_as_done()<CR>
vnoremap <script> <silent> <buffer> <localleader>u :call todo#txt#unmark_as_done()<CR>

" Unmark all done {{{2
nnoremap <script> <silent> <buffer> <localleader>U :call todo#txt#unmark_all_as_done()<CR>

" Remove completed {{{2
nnoremap <script> <silent> <buffer> <localleader>D :call todo#txt#remove_completed()<CR>

Expand Down