9 Commits

Author SHA1 Message Date
David Beniamine
5287e928fc Integrating sietse's work, version 0.7.6 2017-09-10 11:52:41 +02:00
Sietse Brouwer
57d45200c8 Enable vim-repeat for Done and Cancel 2017-08-08 11:09:22 +02:00
Rene Vergara
484c12771e Improve todo#PrependDate to follow format
Add logic to place the completion date after the priority, if it exists,
when completing a task.
2017-04-05 11:15:59 -05:00
David Beniamine
f77215ca80 Fix issue #11
Complete function assumed that a line started with x <date> or a
priority which is not necessarily true, thus some lines where ignored
from completion.
2017-03-30 18:57:18 +02:00
David Beniamine
849a7d5f61 Better way to put done at the end
+ Limit side effects
+ Sort done entries at the end
+ Work fine also without done entries
2016-11-25 11:26:44 +01:00
David Beniamine
0e2b110903 Merge remote-tracking branch 'dkarwowski/master' 2016-11-25 10:33:30 +01:00
David Beniamine
aad48b0231 Merge pull request #10 from victal/master
Fix overduedate regex breaking in November
2016-11-04 14:02:50 +01:00
Guilherme Victal
81e64682d0 Fix overduedate regex breaking in November 2016-11-04 09:46:42 -02:00
David Karwowski
303ab65237 priorities at top, x at bottom 2016-09-28 12:31:37 -04:00
5 changed files with 48 additions and 21 deletions

View File

@@ -28,19 +28,19 @@
## Release notes ## Release notes
v0.7.5 Incorporates [Fievel's work](https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de) to make overduedates work on python3. I have no version of vim with python3 thus it is only tested on his side, do not hesitate to report issues. + v0.7.6 Incorporates [Sietse's work](https://github.com/sietse/todo.txt-vim/commit/57d45200c8b033d31c9191ee0eb0711c801cdb1d) to make cancel and mark as done mapping repeatable using [vim-repeat](https://github.com/tpope/vim-repeat).
+ v0.7.5 Incorporates [Fievel's work](https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de) to make overduedates work on python3.
+ v0.7.4 includes the overduedate support from Guilherme Victal (see pull
v0.7.4 includes the overduedate support from Guilherme Victal (see pull [request #45 on freitass version](https://github.com/freitass/todo.txt-vim/pull/45)),
[request #45 on freitass version](https://github.com/freitass/todo.txt-vim/pull/45)), it highlight dates in overdue tasks as an Error. It depends on a
it highlight dates in overdue tasks as an Error. It depends on a Python library, however, and as such will only be able to work if your version
Python library, however, and as such will only be able to work if your version of Vim was compiled with the `+python` option (as most common versions do).
of Vim was compiled with the `+python` option (as most common versions do).
If your Vim installation does **not** have Python support, this plugin **will work just fine** but this feature will be disabled.
If your Vim installation does **not** have Python support, this plugin **will work just fine** but this feature will be disabled.
Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to + Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to update your vimrc (see [completion](#completion)).
update your vimrc (see [completion](#completion)).
## Introduction ## Introduction

View File

@@ -62,7 +62,11 @@ function! todo#RemovePriority()
endfunction endfunction
function! todo#PrependDate() function! todo#PrependDate()
normal! 0"=strftime("%Y-%m-%d ") if (getline(".") =~ '\v^\(')
execute "normal! 0f)a\<space>\<esc>l\"=strftime(\"%Y-%m-%d\")\<esc>P"
else
normal! 0"=strftime("%Y-%m-%d ")
P
endif endif
endfunction endfunction
@@ -137,9 +141,28 @@ function! todo#Sort()
silent! %s/\(x\s*\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g silent! %s/\(x\s*\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g
sort n /^x\s*/ sort n /^x\s*/
silent! %s/\(x\s*\d\{4}\)\(\d\{2}\)/\1-\2-/g silent! %s/\(x\s*\d\{4}\)\(\d\{2}\)/\1-\2-/g
else
let oldcursor=getpos(".")
silent normal gg
let l:first=search('^\s*x')
if l:first != 0
sort /^./r
" at this point done tasks are at the end
let l:first=search('^\s*x')
let l:last=search('^\s*x','b')
let l:diff=l:last-l:first+1
" Cut the done lines
execute ':'.l:first.'d a '.l:diff
endif endif
sort /@[a-zA-Z]*/ r sort /@[a-zA-Z]*/ r
sort /+[a-zA-Z]*/ r sort /+[a-zA-Z]*/ r
sort /\v([A-Z])/ r
if l:first != 0
silent normal G"ap
execute ':'.l:first.','.l:last.'sort /@[a-zA-Z]*/ r'
execute ':'.l:first.','.l:last.'sort /+[a-zA-Z]*/ r'
execute ':'.l:first.','.l:last.'sort /\v([A-Z])/ r'
endif
call cursor(oldcursor) call cursor(oldcursor)
endif endif
endfunction endfunction
@@ -331,7 +354,7 @@ fun! todo#Complete(findstart, base)
let res = [] let res = []
for bufnr in range(1,bufnr('$')) for bufnr in range(1,bufnr('$'))
let lines=getbufline(bufnr,1,"$") let lines=getbufline(bufnr,1,"$")
for line in lines for line in lines
if line =~ " ".a:base if line =~ " ".a:base
" init temporary item " init temporary item
let item={} let item={}

View File

@@ -31,10 +31,11 @@ Table of Contents *TodoTxt-Contents* ~
=============================================================================== ===============================================================================
1. Release notes *TodoTxt-ReleaseNotes* ~ 1. Release notes *TodoTxt-ReleaseNotes* ~
v0.7.6 Incorporates [Sietse's work](https://github.com/sietse/todo.txt-vim/commit/57d45200c8b033d31c9191ee0eb0711c801cdb1d) to make cancel and mark as done mapping repeatable using [vim-repeat](https://github.com/tpope/vim-repeat).
v0.7.5 Incorporates Fievel's work v0.7.5 Incorporates Fievel's work
(https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de) (https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de)
to make overduedates work on python3. I have no version of vim with python3 to make overduedates work on python3.
thus it is only tested on his side, do not hesitate to report issues.
v0.7.4 includes the overduedate support from Guilherme Victal (see pull v0.7.4 includes the overduedate support from Guilherme Victal (see pull
request #45 on freitass version (https://github.com/freitass/todo.txt-vim/pull/45)), request #45 on freitass version (https://github.com/freitass/todo.txt-vim/pull/45)),

View File

@@ -12,7 +12,7 @@ set cpo&vim
if exists("g:Todo_txt_loaded") if exists("g:Todo_txt_loaded")
finish finish
else else
let g:Todo_txt_loaded=0.7.5 let g:Todo_txt_loaded=0.7.6
endif endif
" General options {{{1 " General options {{{1
@@ -54,12 +54,15 @@ if !exists("g:Todo_txt_do_not_map")
noremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR> noremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR>
" Mark done {{{2 " Mark done {{{2
noremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR> noremap <script> <silent> <buffer> <Plug>DoToggleMarkAsDone :call todo#ToggleMarkAsDone('')<CR>
\:call repeat#set("\<Plug>DoToggleMarkAsDone")<CR>
nmap <localleader>x <Plug>DoToggleMarkAsDone
" noremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR>
" Mark done {{{2 " Mark done {{{2
noremap <script> <silent> <buffer> <localleader>C :call todo#ToggleMarkAsDone('Cancelled')<CR> noremap <script> <silent> <buffer> <Plug>DoCancel :call todo#ToggleMarkAsDone('Cancelled')<CR>
\:call repeat#set("\<Plug>DoCancel")<CR>
nmap <localleader>C <Plug>DoCancel
" Mark all done {{{2 " Mark all done {{{2
noremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR> noremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR>

View File

@@ -44,7 +44,7 @@ def _month_regex_before(year, month):
def _day_regex_before(year, month, day): def _day_regex_before(year, month, day):
if day == '01': if day == '01':
return None return None
last_month_day = str((date(int(year), (int(month) + 1) % 12, 1) + - date.resolution).day) last_month_day = str((date(int(year), int(month) % 12 + 1, 1) + - date.resolution).day)
last_digit1, last_digit2 = last_month_day last_digit1, last_digit2 = last_month_day
digit1, digit2 = day digit1, digit2 = day