| version 1.2, 2002/04/03 12:02:48 |
version 1.3, 2002/08/11 17:14:45 |
|
|
| "============================================================================= |
"============================================================================= |
| " File: calendar.vim |
" File: calendar.vim |
| " Author: Yasuhiro Matsumoto <mattn_jp@hotmail.com> |
" Author: Yasuhiro Matsumoto <mattn_jp@hotmail.com> |
| " Last Change: Mon, 29 Apr 2002 |
" Last Change: Mon, 8 Apr 2002 |
| " Version: 1.3g |
" Version: 1.3h |
| " Thanks: |
" Thanks: |
| |
" Bill McCarthy : bug fix and gave a hint |
| " Srinath Avadhanula : bug fix |
" Srinath Avadhanula : bug fix |
| " Ronald Hoellwarth : few advices |
" Ronald Hoellwarth : few advices |
| " Juan Orlandini : added higlighting of days with data |
" Juan Orlandini : added higlighting of days with data |
|
|
| " <Leader>ch |
" <Leader>ch |
| " show horizontal calendar ... |
" show horizontal calendar ... |
| " ChangeLog: |
" ChangeLog: |
| |
" 1.3h : add option for position of displaying '*' or '+'. |
| |
" see Additional: |
| " 1.3g : centering header |
" 1.3g : centering header |
| " add option for show name of era. |
" add option for show name of era. |
| " see Additional: |
" see Additional: |
|
|
| " it"s about strftime("%w") |
" it"s about strftime("%w") |
| " 1.0 : first release. |
" 1.0 : first release. |
| " Additional: |
" Additional: |
| |
" *if you want to place the mark('*' or '+') after the day, |
| |
" add the following to your .vimrc: |
| |
" |
| |
" let g:calendar_rmark = '' |
| |
" |
| " *if you want to replace calendar header, |
" *if you want to replace calendar header, |
| " add the following in your favorite language to your .vimrc: |
" add the following in your favorite language to your .vimrc: |
| " |
" |
|
|
| " |
" |
| " :echo calendar_version |
" :echo calendar_version |
| |
|
| let g:calendar_version = "1.3g" |
let g:calendar_version = "1.3h" |
| if !exists("g:calendar_action") |
if !exists("g:calendar_action") |
| let g:calendar_action = "<SID>CalendarDiary" |
let g:calendar_action = "<SID>CalendarDiary" |
| endif |
endif |
| Line 259 function! s:CalendarDoAction() |
|
| Line 267 function! s:CalendarDoAction() |
|
| return |
return |
| endif |
endif |
| " extracr year and month |
" extracr year and month |
| let year = matchstr(substitute(sline, '/.*', '', ''), '[^0].*') |
if exists('g:calendar_erafmt') && g:calendar_erafmt !~ "^\s*$" |
| let month = matchstr(substitute(sline, '\d*/\(\d\d\=\).*', '\1', ""), '[^0].*') |
let year = matchstr(substitute(sline, '/.*', '', ''), '\d\+') |
| |
let month = matchstr(substitute(sline, '.*/\(\d\d\=\).*', '\1', ""), '[^0].*') |
| |
if g:calendar_erafmt =~ '.*,[+-]*\d\+' |
| |
let veranum=substitute(g:calendar_erafmt,'.*,\([+-]*\d\+\)','\1','') |
| |
if year-veranum > 0 |
| |
let year=year-veranum |
| |
endif |
| |
endif |
| |
else |
| |
let year = matchstr(substitute(sline, '/.*', '', ''), '[^0].*') |
| |
let month = matchstr(substitute(sline, '\d*/\(\d\d\=\).*', '\1', ""), '[^0].*') |
| |
endif |
| " call the action function |
" call the action function |
| exe "call " . g:calendar_action . "(day, month, year, week, dir)" |
exe "call " . g:calendar_action . "(day, month, year, week, dir)" |
| endfunc |
endfunc |
| Line 473 function! Calendar(...) |
|
| Line 492 function! Calendar(...) |
|
| let vwruler = strpart(vwruler,3).' '.strpart(vwruler,0,2) |
let vwruler = strpart(vwruler,3).' '.strpart(vwruler,0,2) |
| endif |
endif |
| let vdisplay2 = vdisplay2.' '.vwruler."\n" |
let vdisplay2 = vdisplay2.' '.vwruler."\n" |
| |
if exists("g:calendar_rmark") |
| |
let vdisplay2 = vdisplay2.' ' |
| |
endif |
| |
|
| " build calendar |
" build calendar |
| let vinpcur = 0 |
let vinpcur = 0 |
| Line 488 function! Calendar(...) |
|
| Line 510 function! Calendar(...) |
|
| else |
else |
| let vsign = '' |
let vsign = '' |
| endif |
endif |
| if vtarget == vtoday |
if !exists("g:calendar_rmark") |
| let vdisplay2=vdisplay2.'*' |
if vtarget == vtoday |
| elseif vsign != '' |
let vdisplay2=vdisplay2.'*' |
| let vdisplay2=vdisplay2.'+' |
elseif vsign != '' |
| |
let vdisplay2=vdisplay2.'+' |
| |
else |
| |
let vdisplay2=vdisplay2.' ' |
| |
endif |
| |
if vdaycur < 10 |
| |
let vdisplay2=vdisplay2.' ' |
| |
endif |
| |
let vdisplay2=vdisplay2.vdaycur |
| else |
else |
| let vdisplay2=vdisplay2.' ' |
if vdaycur < 10 |
| endif |
let vdisplay2=vdisplay2.' ' |
| if vdaycur < 10 |
endif |
| let vdisplay2=vdisplay2.' ' |
let vdisplay2=vdisplay2.vdaycur |
| |
if vtarget == vtoday |
| |
let vdisplay2=vdisplay2.'*' |
| |
elseif vsign != '' |
| |
let vdisplay2=vdisplay2.'+' |
| |
else |
| |
let vdisplay2=vdisplay2.' ' |
| |
endif |
| endif |
endif |
| let vdisplay2=vdisplay2.vdaycur |
|
| let vdaycur = vdaycur + 1 |
let vdaycur = vdaycur + 1 |
| let vinpcur = vinpcur + 1 |
let vinpcur = vinpcur + 1 |
| if vinpcur % 7 == 0 |
if vinpcur % 7 == 0 |
| if !exists('g:calendar_monday') && exists('g:calendar_weeknm') |
if !exists('g:calendar_monday') && exists('g:calendar_weeknm') |
| |
if !exists("g:calendar_rmark") |
| |
let vdisplay2=vdisplay2.' ' |
| |
endif |
| " if given g:calendar_weeknm, show week number |
" if given g:calendar_weeknm, show week number |
| if viweek < 10 |
if viweek < 10 |
| if g:calendar_weeknm == 1 |
if g:calendar_weeknm == 1 |
| let vdisplay2=vdisplay2.' WK0'.viweek |
let vdisplay2=vdisplay2.'WK0'.viweek |
| elseif g:calendar_weeknm == 2 |
elseif g:calendar_weeknm == 2 |
| let vdisplay2=vdisplay2.' WK '.viweek |
let vdisplay2=vdisplay2.'WK '.viweek |
| elseif g:calendar_weeknm == 3 |
elseif g:calendar_weeknm == 3 |
| let vdisplay2=vdisplay2.' KW0'.viweek |
let vdisplay2=vdisplay2.'KW0'.viweek |
| elseif g:calendar_weeknm == 4 |
elseif g:calendar_weeknm == 4 |
| let vdisplay2=vdisplay2.' KW '.viweek |
let vdisplay2=vdisplay2.'KW '.viweek |
| endif |
endif |
| else |
else |
| if g:calendar_weeknm <= 2 |
if g:calendar_weeknm <= 2 |
| let vdisplay2=vdisplay2.' WK'.viweek |
let vdisplay2=vdisplay2.'WK'.viweek |
| else |
else |
| let vdisplay2=vdisplay2.' KW'.viweek |
let vdisplay2=vdisplay2.'KW'.viweek |
| endif |
endif |
| endif |
endif |
| let viweek = viweek + 1 |
let viweek = viweek + 1 |
| endif |
endif |
| let vdisplay2=vdisplay2."\n" |
let vdisplay2=vdisplay2."\n" |
| |
if exists("g:calendar_rmark") |
| |
let vdisplay2 = vdisplay2.' ' |
| |
endif |
| endif |
endif |
| endwhile |
endwhile |
| |
|
| Line 534 function! Calendar(...) |
|
| Line 576 function! Calendar(...) |
|
| let vinpcur = vinpcur + 1 |
let vinpcur = vinpcur + 1 |
| endwhile |
endwhile |
| if !exists('g:calendar_monday') && exists('g:calendar_weeknm') |
if !exists('g:calendar_monday') && exists('g:calendar_weeknm') |
| |
if !exists("g:calendar_rmark") |
| |
let vdisplay2=vdisplay2.' ' |
| |
endif |
| if viweek < 10 |
if viweek < 10 |
| if g:calendar_weeknm == 1 |
if g:calendar_weeknm == 1 |
| let vdisplay2=vdisplay2.' WK0'.viweek |
let vdisplay2=vdisplay2.'WK0'.viweek |
| elseif g:calendar_weeknm == 2 |
elseif g:calendar_weeknm == 2 |
| let vdisplay2=vdisplay2.' WK '.viweek |
let vdisplay2=vdisplay2.'WK '.viweek |
| elseif g:calendar_weeknm == 3 |
elseif g:calendar_weeknm == 3 |
| let vdisplay2=vdisplay2.' KW0'.viweek |
let vdisplay2=vdisplay2.'KW0'.viweek |
| elseif g:calendar_weeknm == 4 |
elseif g:calendar_weeknm == 4 |
| let vdisplay2=vdisplay2.' KW '.viweek |
let vdisplay2=vdisplay2.'KW '.viweek |
| endif |
endif |
| else |
else |
| if g:calendar_weeknm <= 2 |
if g:calendar_weeknm <= 2 |
| let vdisplay2=vdisplay2.' WK'.viweek |
let vdisplay2=vdisplay2.'WK'.viweek |
| else |
else |
| let vdisplay2=vdisplay2.' KW'.viweek |
let vdisplay2=vdisplay2.'KW'.viweek |
| endif |
endif |
| endif |
endif |
| endif |
endif |
| Line 711 function! Calendar(...) |
|
| Line 756 function! Calendar(...) |
|
| "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| " today |
" today |
| syn clear |
syn clear |
| syn match Directory display "\*\s*\d*" |
if !exists("g:calendar_rmark") |
| syn match Identifier display "+\s*\d*" |
syn match Directory display "\*\s*\d*" |
| |
syn match Identifier display "+\s*\d*" |
| |
else |
| |
syn match Directory display "\d*\*\s*" |
| |
syn match Identifier display "\d*+\s*" |
| |
endif |
| " header |
" header |
| syn match Special display "[^ ]*\d\+\/\d\+([^)]*)" |
syn match Special display "[^ ]*\d\+\/\d\+([^)]*)" |
| |
|