Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jean/vikitasks_vim
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtom committed Dec 29, 2014
2 parents f631bcf + df5f8a6 commit feacacb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
32 changes: 17 additions & 15 deletions autoload/vikitasks.vim
Expand Up @@ -6,12 +6,14 @@
scriptencoding utf-8



" A list of glob patterns (or files) that will be searched for task
" lists.
" Can be buffer-local.
" If you add ! to 'viminfo', this variable will be automatically saved
" between editing sessions.
" Alternatively, add new items in ~/vimfiles/after/plugin/vikitasks.vim
" Alternatively, add new items in the *after-directory* in 'runtimepath'
" (e.g. ~/vimfiles/after/plugin/vikitasks.vim)
TLet g:vikitasks#files = []

" A list of |regexp| patterns for filenames that should not be
Expand Down Expand Up @@ -153,13 +155,13 @@ TLet g:vikitasks#done_add_date = 1
" archived tasks should be moved to.
TLet g:vikitasks#archive_filename_fmt = '"%s_archived". g:vikiNameSuffix'

" A list of strings. The header for newly created tasks archives.
" A list of strings. The header for newly created task archives.
TLet g:vikitasks#archive_header = ['* Archived tasks']

" The date format string (see |strftime()|).
TLet g:vikitasks#date_fmt = "%Y-%m-%d"

" The date format string (see |strftime()|) for archived entries.
" The archive header format string (see |strftime()|) for archived entries.
TLet g:vikitasks#archive_header_fmt = "** " . g:vikitasks#date_fmt

" Letters of final categories, i.e. tasks that should not be altered
Expand Down Expand Up @@ -734,8 +736,8 @@ function! vikitasks#FormatQFLE(qfe, world) "{{{3
endf


" The |regexp| PATTERN is prepended with |\<| if it seems to be a word.
" The PATTERN is made case sensitive if it contains an upper-case letter
" If the |regexp| PATTERN seems to be a word, |\<| is prepended.
" The PATTERN is case-sensitive if it contains an upper-case letter
" and if 'smartcase' is true.
function! s:MakePattern(pattern) "{{{3
let pattern = a:pattern
Expand Down Expand Up @@ -1288,7 +1290,7 @@ function! vikitasks#ScanCurrentBuffer(...) "{{{3
endf


" Mark a N tasks as done, i.e. assign them to category X -- see also
" Mark N tasks as done, i.e. assign them to category X -- see also
" |g:vikitasks#final_categories|.
function! vikitasks#ItemMarkDone(count) "{{{3
let ftdef = s:GetBufferTasksDef()
Expand All @@ -1312,7 +1314,7 @@ function! vikitasks#ItemMarkDone(count) "{{{3
endf


" Archive final (see |g:vikitasks#final_categories|) tasks.
" Archive finalized (see |g:vikitasks#final_categories|) tasks.
function! vikitasks#ItemArchiveFinal() "{{{3
let ftdef = s:GetBufferTasksDef()
let archive_filename = ftdef.GetArchiveName(expand("%:p:r"))
Expand Down Expand Up @@ -1355,12 +1357,12 @@ function! vikitasks#ListTaskFiles() "{{{3
endf


" Mark a tasks as due in N days.
function! vikitasks#ItemMarkDueInDays(count, days) "{{{3
" Mark task(s) as due in N days.
function! vikitasks#ItemsMarkDueInDays(count, days) "{{{3
" TLogVAR a:count, a:days
let duedate = strftime(g:vikitasks#date_fmt, localtime() + a:days * g:tlib#date#dayshift)
for lnum in range(line('.'), line('.') + a:count)
call vikitasks#MarkItemDueInDays(lnum, duedate)
call vikitasks#ItemMarkDueInDays(lnum, duedate)
endfor
endf

Expand Down Expand Up @@ -1391,7 +1393,7 @@ endf


" :nodoc:
function! vikitasks#MarkItemDueInDays(lnum, duedate) "{{{3
function! vikitasks#ItemMarkDueInDays(lnum, duedate) "{{{3
" TLogVAR bufname('%'), a:lnum, a:duedate
let ftdef = s:GetBufferTasksDef()
" TLogVAR ftdef
Expand All @@ -1411,10 +1413,10 @@ function! vikitasks#MarkItemDueInDays(lnum, duedate) "{{{3
endf


" Mark a tasks as due in N weeks.
function! vikitasks#ItemMarkDueInWeeks(count, weeks) "{{{3
" Mark task(s) as due in N weeks.
function! vikitasks#ItemsMarkDueInWeeks(count, weeks) "{{{3
" TLogVAR a:count, a:weeks
call vikitasks#ItemMarkDueInDays(a:count, a:weeks * 7)
call vikitasks#ItemsMarkDueInDays(a:count, a:weeks * 7)
endf


Expand Down Expand Up @@ -1545,7 +1547,7 @@ function! vikitasks#CalendarCallback(day, month, year, week, dir) "{{{3
let duedate = printf('%4d-%02d-%02d', a:year, a:month, a:day)
" TLogVAR duedate
let world = trag#RunCmdOnSelected(s:calendar_callback_world, s:calendar_callback_selected,
\ printf('call vikitasks#MarkItemDueInDays(line("."), %s)', string(duedate)), 0)
\ printf('call vikitasks#ItemMarkDueInDays(line("."), %s)', string(duedate)), 0)
" TLogVAR world.state
call setbufvar(s:calendar_callback_buffer, 'tlib_world', world)
exec s:calendar_callback_window 'wincmd w'
Expand Down
10 changes: 5 additions & 5 deletions doc/vikitasks.txt
Expand Up @@ -36,7 +36,7 @@ bar.txt: >
#C 2009-12-24 Wish @Bernie good luck
#D 2009-11-01 Do that
Let's assume you have added both files to |g:vikitasks_files|. Switch to
Let's assume you have added both files to |g:vikitasks#files|. Switch to
the buffer foo.txt and call >
:VikiTasks
Expand All @@ -60,7 +60,7 @@ If you had called >
only the first two items would be listed.

This week's tasks (i.e. the tasks that should be accomplished today or
within the following six days) could be listed with >
within the following six days) can be listed with >
:VikiTasks 6
Expand All @@ -73,8 +73,8 @@ Edit the vba file and type: >
:so %
See :help vimball for details. If you have difficulties or use vim 7.0,
please make sure, you have the current version of vimball
(vimscript #1502) installed or update your runtime.
please make sure that you have the current version of vimball
(vimscript #1502) installed, or update your runtime.

This script requires tlib (vimscript #1863), trag (vimscript #2033), and
viki (vimscript #861) to be installed.
Expand Down Expand Up @@ -304,7 +304,7 @@ g:vikitasks#date_fmt (default: "%Y-%m-%d")

*g:vikitasks#archive_header_fmt*
g:vikitasks#archive_header_fmt (default: "** " . g:vikitasks#date_fmt)
The date format string (see |strftime()|) for archived entries.
The archive header format string (see |strftime()|) for archived entries.

*g:vikitasks#final_categories*
g:vikitasks#final_categories (default: 'XYZ')
Expand Down
4 changes: 2 additions & 2 deletions ftplugin/viki/vikitasks.vim
Expand Up @@ -6,7 +6,7 @@
exec 'noremap <buffer>' g:vikitasks#mapleader.'x' ':<C-U>call vikitasks#ItemMarkDone(v:count)<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'a' ':call vikitasks#ItemArchiveFinal()<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'l' ':call vikitasks#ListTaskFiles()<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'d' ':<C-U>call vikitasks#ItemMarkDueInDays(0, v:count)<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'w' ':<C-U>call vikitasks#ItemMarkDueInWeeks(0, v:count1)<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'d' ':<C-U>call vikitasks#ItemsMarkDueInDays(0, v:count)<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'w' ':<C-U>call vikitasks#ItemsMarkDueInWeeks(0, v:count1)<cr>'
exec 'noremap <buffer>' g:vikitasks#mapleader.'c' ':<C-U>call vikitasks#ItemChangeCategory(v:count)<cr>'

25 changes: 12 additions & 13 deletions plugin/vikitasks.vim
Expand Up @@ -55,11 +55,11 @@ TLet g:vikitasks_scan_events = 'BufWritePost,BufWinEnter'
TLet g:vikitasks_scan_patterns = ['*.txt', '*.viki']

" :display: :VikiTasks[!] [CONSTRAINT] [PATTERN] [FILE_PATTERNS]
" CONSTRAINT defined which tasks should be displayed. Possible values
" for CONSTRAINT are:
" CONSTRAINT constrains which tasks should be displayed. Possible values
" are:
"
" today ... Show tasks that are due today
" current ... Show pending and today's tasks
" current ... Show today's tasks and pending tasks
" NUMBER (of days) ... Show tasks that are due within N days
" Nd ... Tasks for the next N days
" Nw ... Tasks for the next N weeks (i.e. 7 days)
Expand All @@ -72,12 +72,11 @@ TLet g:vikitasks_scan_patterns = ['*.txt', '*.viki']
"
" The default value for CONSTRAINT is ".".
"
" If N is prepended with + (e.g. "+2w"), tasks with a deadline in the
" past are hidden.
" Prepend + to N (e.g. "+2w") to hide tasks with a deadline in the past.
"
" If N is prepended with - (e.g. "-2w"), only tasks with a deadline in
" the past (in this example in the last two weeks) are shown. This
" implies showing all tasks as with "*".
" Prepend - to N (e.g. "-2w") to show only tasks with a deadline in
" the past (in this example in the last two weeks). This implies showing
" all tasks, as with "*".
"
" If CONSTRAINT doesn't match one of the constraints described above, it
" is assumed to be a PATTERN -- see also |viki-tasks|.
Expand Down Expand Up @@ -111,14 +110,14 @@ command! -bang -nargs=* -bar VikiTasksStatic call vikitasks#Tasks(vikitasks#GetA
" cabbr vikitasks VikiTasks

" :display: :VikiTasksPaste[!] [ARGUMENTS...]
" Paste the results of a VIKITASKSCOMMAND (default: VikiTasks) in a
" Paste the results of a VIKITASKSCOMMAND (default: |:VikiTasks|) in a
" buffer. When called with a |bang| [!], create a new buffer. See
" |:VikiTasks| for the allowed ARGUMENTS.
command! -bang -nargs=* -bar VikiTasksPaste call vikitasks#Paste(empty("<bang>") ? '' : 'VikiTasksPaste', vikitasks#GetArgs(0, [<f-args>]))

" :display: :[count]VikiTasksAlarms
" Display a list of alarms. Shows alarms due within N days.
" If N is -1, uses |g:vikitasks#alarms| if any.
" If N is -1, uses |g:vikitasks#alarms|, if any.
command! -count -bang -bar VikiTasksAlarms call vikitasks#Alarm(<count>, empty('<bang>'))

" :display: :VikiTasksAdd
Expand All @@ -130,7 +129,7 @@ command! VikiTasksAdd call vikitasks#AddBuffer(expand('%:p'))
command! -count=0 -bar VikiTasksDone call vikitasks#ItemMarkDone(<count>)


" Archive final (see |g:vikitasks#final_categories|) tasks.
" Archive finalized tasks (see |g:vikitasks#final_categories|).
command! -bar VikiTasksArchive call vikitasks#ItemArchiveFinal()


Expand All @@ -147,10 +146,10 @@ command! -bar VikiTasksFiles call vikitasks#ListTaskFiles()

" :display: :[count]VikiTasksDueInDays [DAYS=0]
" Mark [count] task(s) as due in N days.
command! -bar -range -nargs=? VikiTasksDueInDays <line1>,<line2>call vikitasks#ItemMarkDueInDays(0, 0 + <q-args>)
command! -bar -range -nargs=? VikiTasksDueInDays <line1>,<line2>call vikitasks#ItemsMarkDueInDays(0, 0 + <q-args>)


" :display: :[count]VikiTasksDueInDays [WEEKS=1]
" :display: :[count]VikiTasksDueInWeeks [WEEKS=1]
" Mark [count] task(s) as due in N weeks.
command! -bar -range -nargs=? VikiTasksDueInWeeks <line1>,<line2>call vikitasks#ItemMarkDueInWeeks(0, empty(<q-args>) ? 1 : 0 + <q-args>)

Expand Down

0 comments on commit feacacb

Please sign in to comment.