Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 25. október 2026

Rozdiely pre vimconfig/vim/plugin/calendar.vim medzi verziami 1.5 a 1.6

verzia 1.5, 2003/11/03 16:04:07 verzia 1.6, 2005/03/09 19:59:26
Riadok 2 
Riadok 2 
 " What Is This: Calendar  " What Is This: Calendar
 " File: calendar.vim  " File: calendar.vim
 " Author: Yasuhiro Matsumoto <mattn_jp@hotmail.com>  " Author: Yasuhiro Matsumoto <mattn_jp@hotmail.com>
 " Last Change: Thu, 19 Jun 2003  " Last Change: Thu, 04 Nov 2004
 " Version: 1.3u  " Version: 1.4
 " Thanks:  " Thanks:
   "     Peter Findeisen     : bug fix
   "     Chip Campbell       : gave a hint for 1.3z
   "     PAN Shizhu          : gave a hint for 1.3y
   "     Eric Wald           : bug fix
   "     Sascha Wuestemann   : advise
   "     Linas Vasiliauskas  : bug report
   "     Per Winkvist        : bug report
 "     Ronald Hoelwarth    : gave a hint for 1.3s  "     Ronald Hoelwarth    : gave a hint for 1.3s
 "     Vikas Agnihotri     : bug report  "     Vikas Agnihotri     : bug report
 "     Steve Hall          : gave a hint for 1.3q  "     Steve Hall          : gave a hint for 1.3q
Riadok 40 
Riadok 47 
 "     <Leader>ch  "     <Leader>ch
 "       show horizontal calendar ...  "       show horizontal calendar ...
 " ChangeLog:  " ChangeLog:
   "     1.4  : bug fix, and one improvement.
   "            bug 1:
   "              when marking the current date, there is not distinguished e.g. between
   "              20041103 and 20040113, both dates are marked as today
   "            bug 2:
   "              the navigation mark "today" doesn't work
   "            improvement:
   "              the mapping t worked only when today was displayed, now it works always
   "              and redisplays the cuurent month and today
   "     1.3z : few changes
   "            asign <Left>, <Right> for navigation.
   "            set ws for search navigation.
   "            add tag for GetLatestVimScripts(AutoInstall)
   "     1.3y : bug fix, few changes
   "            changed color syntax name. (ex. CalNavi, see bottom of this)
   "            changed a map CalendarV for <Leader>cal
   "            changed a map CalendarH for <Leader>caL
   "            (competitive map for cvscommand.vim)
   "            the date on the right-hand side didn't work correctoly.
   "            make a map to rebuild Calendar window(r).
   "     1.3x : bug fix
   "            viweek can't refer when not set calendar_weeknm.
   "     1.3w : bug fix
   "            on leap year, week number decreases.
   "     1.3v : bug fix
   "            add nowrapscan
   "            use s:bufautocommandsset for making title
   "            don't focus to navi when doubleclick bottom next>.
 "     1.3u : bug fix  "     1.3u : bug fix
 "             when enter diary first time,  "             when enter diary first time,
 "              it don't warn that you don't have diary directory.  "              it don't warn that you don't have diary directory.
Riadok 232 
Riadok 267 
 "       type below.  "       type below.
 "  "
 "       :echo calendar_version  "       :echo calendar_version
   " GetLatestVimScripts: 52 1 :AutoInstall: calendar.vim
   
   let g:calendar_version = "1.4"
   if &compatible
     finish
   endif
   
 let g:calendar_version = "1.3u"  
 if !exists("g:calendar_action")  if !exists("g:calendar_action")
   let g:calendar_action = "<SID>CalendarDiary"    let g:calendar_action = "<SID>CalendarDiary"
 endif  endif
Riadok 270  endif
Riadok 310  endif
 :command! -nargs=* CalendarH call Calendar(1,<f-args>)  :command! -nargs=* CalendarH call Calendar(1,<f-args>)
   
 if !hasmapto("<Plug>CalendarV")  if !hasmapto("<Plug>CalendarV")
   nmap <unique> <Leader>ca <Plug>CalendarV    nmap <unique> <Leader>cal <Plug>CalendarV
 endif  endif
 if !hasmapto("<Plug>CalendarH")  if !hasmapto("<Plug>CalendarH")
   nmap <unique> <Leader>ch <Plug>CalendarH    nmap <unique> <Leader>caL <Plug>CalendarH
 endif  endif
 nmap <silent> <Plug>CalendarV :cal Calendar(0)<CR>  nmap <silent> <Plug>CalendarV :cal Calendar(0)<CR>
 nmap <silent> <Plug>CalendarH :cal Calendar(1)<CR>  nmap <silent> <Plug>CalendarH :cal Calendar(1)<CR>
Riadok 311  endfunction
Riadok 351  endfunction
 "* CalendarDoAction : call the action handler function  "* CalendarDoAction : call the action handler function
 "*----------------------------------------------------------------  "*----------------------------------------------------------------
 "*****************************************************************  "*****************************************************************
 function! s:CalendarDoAction()  function! s:CalendarDoAction(...)
   " if no action defined return    " if no action defined return
   if !exists("g:calendar_action")    if !exists("g:calendar_action")
     return      return
Riadok 319  function! s:CalendarDoAction()
Riadok 359  function! s:CalendarDoAction()
   
   " for navi    " for navi
   if exists('g:calendar_navi')    if exists('g:calendar_navi')
     let navi = expand("<cword>")      let navi = (a:0 > 0)? a:1 : expand("<cWORD>")
     let curl = line(".")      let curl = line(".")
     if navi == s:GetToken(g:calendar_navi_label, ',', 1)      if navi == '<' . s:GetToken(g:calendar_navi_label, ',', 1)
       exec substitute(maparg('<s-left>', 'n'), '<CR>', '', '')        exec substitute(maparg('<s-left>', 'n'), '<CR>', '', '')
     elseif navi == s:GetToken(g:calendar_navi_label, ',', 3)      elseif navi == s:GetToken(g:calendar_navi_label, ',', 3) . '>'
       exec substitute(maparg('<s-right>', 'n'), '<CR>', '', '')        exec substitute(maparg('<s-right>', 'n'), '<CR>', '', '')
     elseif navi == s:GetToken(g:calendar_navi_label, ',', 2)      elseif navi == s:GetToken(g:calendar_navi_label, ',', 2)
       call Calendar(b:CalendarDir)        call Calendar(b:CalendarDir)
Riadok 335  function! s:CalendarDoAction()
Riadok 375  function! s:CalendarDoAction()
         silent execute "normal! gg/\*\<cr>"          silent execute "normal! gg/\*\<cr>"
         return          return
       else        else
               setlocal ws
         if curl < line('$')/2          if curl < line('$')/2
           silent execute "normal! gg/".navi."\<cr>"            silent execute "normal! gg0/".navi."\<cr>"
         elseif curl < line('$')/2          else
           silent execute "normal! gg?".navi."\<cr>"            silent execute "normal! G0/".navi."\<cr>"
         endif          endif
               setlocal nows
         return          return
       endif        endif
     endif      endif
Riadok 380  function! s:CalendarDoAction()
Riadok 422  function! s:CalendarDoAction()
     return      return
   endif    endif
   let sline = substitute(strpart(getline(hdr),cnr,21),'\s*\(.*\)\s*','\1','')    let sline = substitute(strpart(getline(hdr),cnr,21),'\s*\(.*\)\s*','\1','')
   if (col(".")-cnr) > 20    if (col(".")-cnr) > 21
     return      return
   endif    endif
   
   " extracr day    " extract day
   let day = matchstr(expand("<cword>"), '[^0].*')    if g:calendar_mark == 'right' && col('.') > 1
       normal! h
       let day = matchstr(expand("<cword>"), '[^0].*')
       normal! l
     else
       let day = matchstr(expand("<cword>"), '[^0].*')
     endif
   if day == 0    if day == 0
     return      return
   endif    endif
   " extracr year and month    " extract year and month
   if exists('g:calendar_erafmt') && g:calendar_erafmt !~ "^\s*$"    if exists('g:calendar_erafmt') && g:calendar_erafmt !~ "^\s*$"
     let year = matchstr(substitute(sline, '/.*', '', ''), '\d\+')      let year = matchstr(substitute(sline, '/.*', '', ''), '\d\+')
     let month = matchstr(substitute(sline, '.*/\(\d\d\=\).*', '\1', ""), '[^0].*')      let month = matchstr(substitute(sline, '.*/\(\d\d\=\).*', '\1', ""), '[^0].*')
Riadok 400  function! s:CalendarDoAction()
Riadok 448  function! s:CalendarDoAction()
       endif        endif
     endif      endif
   else    else
     let year = matchstr(substitute(sline, '/.*', '', ''), '[^0].*')      let year  = matchstr(substitute(sline, '/.*', '', ''), '[^0].*')
     let month = matchstr(substitute(sline, '\d*/\(\d\d\=\).*', '\1', ""), '[^0].*')      let month = matchstr(substitute(sline, '\d*/\(\d\d\=\).*', '\1', ""), '[^0].*')
   endif    endif
   " call the action function    " call the action function
Riadok 421  function! Calendar(...)
Riadok 469  function! Calendar(...)
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   " remember today    " remember today
   " divide strftime('%d') by 1 so as to get "1, 2,3 .. 9" instead of "01, 02, 03 .. 09"    " divide strftime('%d') by 1 so as to get "1, 2,3 .. 9" instead of "01, 02, 03 .. 09"
   let vtoday = strftime('%Y').    let vtoday = strftime('%Y').strftime('%m').strftime('%d')
     \matchstr(strftime('%m'), '[^0].*').matchstr(strftime('%d'), '[^0].*')  
   
   " get arguments    " get arguments
   if a:0 == 0    if a:0 == 0
Riadok 584  function! Calendar(...)
Riadok 631  function! Calendar(...)
         endif          endif
       endif        endif
       let vcolumn = vcolumn + 5        let vcolumn = vcolumn + 5
         if vyear % 4 == 0 && vmnth >= 3
           let viweek = viweek + 1
         endif
     endif      endif
   
     "--------------------------------------------------------------      "--------------------------------------------------------------
Riadok 634  function! Calendar(...)
Riadok 684  function! Calendar(...)
     endwhile      endwhile
     let vdaycur = 1      let vdaycur = 1
     while (vdaycur <= vmdays)      while (vdaycur <= vmdays)
       let vtarget = vyear.vmnth.vdaycur        if vmnth < 10
            let vtarget =vyear."0".vmnth
         else
            let vtarget =vyear.vmnth
         endif
         if vdaycur < 10
            let vtarget = vtarget."0".vdaycur
         else
            let vtarget = vtarget.vdaycur
         endif
       if exists("g:calendar_sign")        if exists("g:calendar_sign")
         exe "let vsign = " . g:calendar_sign . "(vdaycur, vmnth, vyear)"          exe "let vsign = " . g:calendar_sign . "(vdaycur, vmnth, vyear)"
         if vsign != ""          if vsign != ""
Riadok 653  function! Calendar(...)
Riadok 712  function! Calendar(...)
           let vdisplay2=vdisplay2.' '            let vdisplay2=vdisplay2.' '
         endif          endif
         let vdisplay2=vdisplay2.vdaycur          let vdisplay2=vdisplay2.vdaycur
       endif        elseif g:calendar_mark == 'left-fit'
       if g:calendar_mark == 'left-fit'  
         if vdaycur < 10          if vdaycur < 10
           let vdisplay2=vdisplay2.' '            let vdisplay2=vdisplay2.' '
         endif          endif
Riadok 844  function! Calendar(...)
Riadok 902  function! Calendar(...)
     silent %d _      silent %d _
   else    else
     " make title      " make title
     auto BufEnter *Calendar let &titlestring = strftime('%c')      if (!exists('s:bufautocommandsset'))
     auto BufLeave *Calendar let &titlestring = ''        auto BufEnter *Calendar let b:sav_titlestring = &titlestring | let &titlestring = '%{strftime("%c")}'
         auto BufLeave *Calendar let &titlestring = b:sav_titlestring
         let s:bufautocommandsset=1
       endif
   
     if exists('g:calendar_navi') && dir      if exists('g:calendar_navi') && dir
       if g:calendar_navi == 'both'        if g:calendar_navi == 'both'
Riadok 866  function! Calendar(...)
Riadok 927  function! Calendar(...)
     setlocal bufhidden=delete      setlocal bufhidden=delete
     setlocal nonumber      setlocal nonumber
     setlocal nowrap      setlocal nowrap
       setlocal nowrapscan
     setlocal norightleft      setlocal norightleft
     setlocal foldcolumn=0      setlocal foldcolumn=0
     setlocal modifiable      setlocal modifiable
Riadok 873  function! Calendar(...)
Riadok 935  function! Calendar(...)
     " is this a vertical (0) or a horizontal (1) split?      " is this a vertical (0) or a horizontal (1) split?
   endif    endif
   let b:CalendarDir=dir    let b:CalendarDir=dir
     let b:CalendarYear = vyear_org
     let b:CalendarMonth = vmnth_org
   
   " navi    " navi
   if exists('g:calendar_navi')    if exists('g:calendar_navi')
Riadok 885  function! Calendar(...)
Riadok 949  function! Calendar(...)
     else      else
       let navcol = (vcolumn-strlen(navi_label)+2)/2        let navcol = (vcolumn-strlen(navi_label)+2)/2
     endif      endif
           if navcol < 3
             let navcol = 3
           endif
   
     if g:calendar_navi == 'top'      if g:calendar_navi == 'top'
       execute "normal gg".navcol."i "        execute "normal gg".navcol."i "
Riadok 936  function! Calendar(...)
Riadok 1003  function! Calendar(...)
   
   execute 'nnoremap <silent> <buffer> <cr> :call <SID>CalendarDoAction()<cr>'    execute 'nnoremap <silent> <buffer> <cr> :call <SID>CalendarDoAction()<cr>'
   execute 'nnoremap <silent> <buffer> <2-LeftMouse> :call <SID>CalendarDoAction()<cr>'    execute 'nnoremap <silent> <buffer> <2-LeftMouse> :call <SID>CalendarDoAction()<cr>'
   execute 'nnoremap <silent> <buffer> t gg/\*<cr>'    execute 'nnoremap <silent> <buffer> t :call Calendar(b:CalendarDir)<cr>'
   execute 'nnoremap <silent> <buffer> ? :call <SID>CalendarHelp()<cr>'    execute 'nnoremap <silent> <buffer> ? :call <SID>CalendarHelp()<cr>'
     execute 'nnoremap <silent> <buffer> r :call Calendar(' . dir . ',' . vyear . ',' . vmnth . ')<cr>'
     let pnav = s:GetToken(g:calendar_navi_label, ',', 1)
     let nnav = s:GetToken(g:calendar_navi_label, ',', 3)
     execute 'nnoremap <silent> <buffer> <Up>    :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
     execute 'nnoremap <silent> <buffer> <Left>  :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
     execute 'nnoremap <silent> <buffer> <Down>  :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
     execute 'nnoremap <silent> <buffer> <Right> :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
   
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   "+++ build highlight    "+++ build highlight
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   " today    " today
   syn clear    syn clear
   if g:calendar_mark =~ 'left'  
     syn match Directory display "\*\s*\d*"  
     syn match Identifier display "[+!#$%&@?]\s*\d*"  
   endif  
   if g:calendar_mark =~ 'left-fit'    if g:calendar_mark =~ 'left-fit'
     syn match Directory display "\s*\*\d*"      syn match CalToday display "\s*\*\d*"
     syn match Identifier display "\s*[+!#$%&@?]\d*"      syn match CalMemo display "\s*[+!#$%&@?]\d*"
   endif    elseif g:calendar_mark =~ 'right'
   if g:calendar_mark =~ 'right'      syn match CalToday display "\d*\*\s*"
     syn match Directory display "\d*\*\s*"      syn match CalMemo display "\d*[+!#$%&@?]\s*"
     syn match Identifier display "\d*[+!#$%&@?]\s*"    else
       syn match CalToday display "\*\s*\d*"
       syn match CalMemo display "[+!#$%&@?]\s*\d*"
   endif    endif
   " header    " header
   syn match Special display "[^ ]*\d\+\/\d\+([^)]*)"    syn match CalHeader display "[^ ]*\d\+\/\d\+([^)]*)"
   
   " navi    " navi
   if exists('g:calendar_navi')    if exists('g:calendar_navi')
     exec "syn match Search display \"\\(<"      exec "silent! syn match CalNavi display \"\\(<"
         \.s:GetToken(g:calendar_navi_label, ',', 1)."\\|"          \.s:GetToken(g:calendar_navi_label, ',', 1)."\\|"
         \.s:GetToken(g:calendar_navi_label, ',', 3).">\\)\""          \.s:GetToken(g:calendar_navi_label, ',', 3).">\\)\""
     exec "syn match Search display \"\\s"      exec "silent! syn match CalNavi display \"\\s"
         \.s:GetToken(g:calendar_navi_label, ',', 2)."\\s\"hs=s+1,he=e-1"          \.s:GetToken(g:calendar_navi_label, ',', 2)."\\s\"hs=s+1,he=e-1"
   endif    endif
   
Riadok 977  function! Calendar(...)
Riadok 1049  function! Calendar(...)
   endif    endif
   let eolnstring = '\s\(|\|$\)'    let eolnstring = '\s\(|\|$\)'
   if exists('g:calendar_monday')    if exists('g:calendar_monday')
     execute "syn match Statement display \'"      execute "syn match CalSaturday display \'"
       \.dayorspace.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"        \.dayorspace.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
     execute "syn match Type display \'"      execute "syn match CalSunday display \'"
       \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"        \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
   else    else
     if dir      if dir
       execute "syn match Statement display \'"        execute "syn match CalSaturday display \'"
         \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"          \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
       execute "syn match Type display \'\|"        execute "syn match CalSunday display \'\|"
         \.dayorspace."\'ms=s+2,me=s+4"          \.dayorspace."\'ms=s+2,me=s+4"
     else      else
       execute "syn match Statement display \'"        execute "syn match CalSaturday display \'"
         \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"          \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
       execute "syn match Type display \'^"        execute "syn match CalSunday display \'^"
         \.dayorspace."\'ms=s+1,me=s+3"          \.dayorspace."\'ms=s+1,me=s+3"
     endif      endif
   endif    endif
   
   " week number    " week number
   if !exists('g:calendar_weeknm') || g:calendar_weeknm <= 2    if !exists('g:calendar_weeknm') || g:calendar_weeknm <= 2
     syn match Comment display "WK[0-9\ ]\d"      syn match CalWeeknm display "WK[0-9\ ]\d"
   else    else
     syn match Comment display "KW[0-9\ ]\d"      syn match CalWeeknm display "KW[0-9\ ]\d"
   endif    endif
   
   " ruler    " ruler
   execute 'syn match StatusLine "'.vwruler.'"'    execute 'syn match CalRuler "'.vwruler.'"'
   
   if search("\*","w") > 0    if search("\*","w") > 0
     silent execute "normal! gg/\*\<cr>"      silent execute "normal! gg/\*\<cr>"
Riadok 1061  function! s:CalendarDiary(day, month, ye
Riadok 1133  function! s:CalendarDiary(day, month, ye
   endif    endif
   let sfile = expand(sfile) . "/" . a:day . ".cal"    let sfile = expand(sfile) . "/" . a:day . ".cal"
   let sfile = substitute(sfile, ' ', '\\ ', 'g')    let sfile = substitute(sfile, ' ', '\\ ', 'g')
   let vwinnum = bufwinnr('__Calendar')    let vbufnr = bufnr('__Calendar')
   
   " load the file    " load the file
   exe "sp " . sfile    exe "sp " . sfile
   set ft=calendar    setlocal ft=calendar
   exe "auto BufLeave ".escape(sfile, ' \\')." normal! ".vwinnum."<c-w>w"    let dir = getbufvar(vbufnr, "CalendarDir")
     let vyear = getbufvar(vbufnr, "CalendarYear")
     let vmnth = getbufvar(vbufnr, "CalendarMonth")
     exe "auto BufLeave ".escape(sfile, ' \\')." w|call Calendar(" . dir . "," . vyear . "," . vmnth . ")"
 endfunc  endfunc
   
 "*****************************************************************  "*****************************************************************
Riadok 1102  function! s:CalendarHelp()
Riadok 1177  function! s:CalendarHelp()
   echo '<s-right> : goto next month'    echo '<s-right> : goto next month'
   echo 't         : goto today'    echo 't         : goto today'
   echo 'q         : close window'    echo 'q         : close window'
     echo 'r         : re-display window'
   echo '?         : show this help'    echo '?         : show this help'
   if g:calendar_action == "<SID>CalendarDiary"    if g:calendar_action == "<SID>CalendarDiary"
     echo '<cr>      : show diary'      echo '<cr>      : show diary'
Riadok 1122  function! s:CalendarHelp()
Riadok 1198  function! s:CalendarHelp()
   call getchar()    call getchar()
   redraw!    redraw!
 endfunction  endfunction
   
   hi def link CalNavi     Search
   hi def link CalSaturday Statement
   hi def link CalSunday   Type
   hi def link CalRuler    StatusLine
   hi def link CalWeeknm   Comment
   hi def link CalToday    Directory
   hi def link CalHeader   Special
   hi def link CalMemo     Identifier

Legend:
Odstranené z verzie1.5  
zmenené riadky
  Pridané vo verzii1.6

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok