[SCM] vim-scripts packaging branch, master, updated. v20091011-30-gc476b42

James Vega jamessan at debian.org
Sun Aug 14 03:27:01 UTC 2011


The following commit has been merged in the master branch:
commit e60a552de9276a85ccaf39aa011bad16fa8e6fdb
Author: James Vega <jamessan at debian.org>
Date:   Sat Jun 25 23:44:26 2011 -0400

    Update calendar to 2.5
    
    Signed-off-by: James Vega <jamessan at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 43cde3f..0e27000 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,7 +7,7 @@ vim-scripts (20091012) UNRELEASED; urgency=low
     - DoxygenToolkit: Update to 0.2.13
     - Color Sampler Pack: Update to 8.03
     - vcscommand: Update to 1.99.35
-    - calendar: Update to 2.0
+    - calendar: Update to 2.5
     - bufexplorer: Update to 7.2.4
     - gnupg: Update to 3026
       + Fixes a bug when the user's shell is (t)csh and /bin/sh is dash.
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 883d125..6abd291 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -92,7 +92,7 @@ author_url:  http://www.vim.org/account/profile.php?user_id=103
 email:       mattn.jp at gmail.com
 license:     no license
 disabledby:  let calendar_version = 1
-version:     2.0
+version:     2.5
 
 script_name: plugin/winmanager.vim
 addon:       winmanager
diff --git a/html/index.html b/html/index.html
index 06523e0..1cfb11f 100644
--- a/html/index.html
+++ b/html/index.html
@@ -50,7 +50,7 @@
    <li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
   </ul>
   <p>
-  Page generated on Sat, 25 Jun 2011 23:28:10 -0400
+  Page generated on Sat, 25 Jun 2011 23:43:53 -0400
 .
   </p>
  </body>
diff --git a/html/plugin_calendar.vim.html b/html/plugin_calendar.vim.html
index 22ba5de..b678bb0 100644
--- a/html/plugin_calendar.vim.html
+++ b/html/plugin_calendar.vim.html
@@ -166,8 +166,14 @@
 <tr>
   <td class="lightbg"><b> script karma </b></td>
   <td>
-    Rating <b>1335/544</b>,
-    Downloaded by 25267  </td>
+    Rating <b>1527/612</b>,
+    Downloaded by 30862  </td>
+  <td class="lightbg">
+  <b> Comments, bugs, improvements </b>
+  </td>
+  <td>
+    <a href="http://vim.wikia.com/wiki/Script:52">Vim wiki</a>
+  </td>  
 </tr>
 </table>
 <p>
@@ -180,10 +186,10 @@
 <tr><td>utility</td></tr>
 <tr><td> </td></tr>
 <tr><td class="prompt">description</td></tr>
-<tr><td>This script create calender window.
<br>This don't use the external program(cal).</td></tr>
+<tr><td>This script create calender window. <br>This don't use the external program(cal).<br></td></tr>
 <tr><td> </td></tr>
 <tr><td class="prompt">install details</td></tr>
-<tr><td>Copy calendar.vim to your plugin directory.</td></tr>
+<tr><td>Copy calendar.vim to your plugin directory.<br></td></tr>
 <tr><td> </td></tr>
 </table>
 
@@ -217,68 +223,108 @@ Click on the package to download.
     <th valign="top">release notes</th>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11795">calendar.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>2.0</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2009-11-24</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14880">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>2.5</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2011-01-27</i></td>
+    <td class="rowodd" valign="top" nowrap>6.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
+    <td class="rowodd" valign="top" width="2000">[fix] 7.2 don't have relativenumber.<br></td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=14879">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>2.4</b></td>
+    <td class="roweven" valign="top" nowrap><i>2011-01-27</i></td>
+    <td class="roweven" valign="top" nowrap>6.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
+    <td class="roweven" valign="top" width="2000">Applied patch from SethMilliken: added g:calendar_options . default is 'fdc=0 nonu nornu' . you can overwrite default behavior of calendar window.<br></td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14707">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>2.3</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2011-01-08</i></td>
+    <td class="rowodd" valign="top" nowrap>6.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Applied patch from bw1: fixed weeknum function.<br></td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=12959">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>2.2</b></td>
+    <td class="roweven" valign="top" nowrap><i>2010-05-06</i></td>
+    <td class="roweven" valign="top" nowrap>6.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
+    <td class="roweven" valign="top" width="2000">Applied patch:<br>  <a target="_blank" href="http://gist.github.com/355513#file_customizable_keymap.diff">http://gist.github.com/355513#file_customizable_keymap.diff</A><br>  <a target="_blank" href="http://gist.github.com/355513#file_winfixwidth.diff">http://gist.github.com/355513#file_winfixwidth.diff</A><br></td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=12699">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>2.1</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2010-03-24</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="rowodd" valign="top" width="2000">Applied patch from Ingo Karkat. Thanks.<br><br>- ENH: Added a config setting g:calendar_datetime. This allows to remove the<br>display of the current date/time in the title (I don't like it), and offers the<br>window's statusline as an alternative.<br><br>- BUG: The checks for g:calendar_action and g:calendar_sign should also check<br>for an existing, but empty variable. Otherwise, it is not possible to disable it<br>in a .vimrc, because the sourcing of calendar.vim would initialize the variables.<br><br>- BUG: In s:CalendarDoAction(), the check for g:calendar_action must come after<br>the "navi" handling; otherwise "navi" breaks if g:calendar_action is disabled<br>(see above).<br><br>- ENH: The :set wrapscan is ugly, because it is a global setting. The search()<br>commands already pass the 'w' flag, so the only remaining issue were the<br>searches via /. I modified the 'G0/...' search to 'G$?' (i.e. backward from end<br>of buffer), so that 'wrapscan' isn't required any more. (Even better would be to<br>use search() for these jumps, too.) With this, I can also completely get rid of<br>the autocmds in case one does not want the date/time in the title, neither (see<br>above).<br><br>- Using :setlocal buftype=nofile instead of =nowrite; this is more suitable for<br>this kind of scratch buffer, and avoids that the path may be shown in the title<br>/ statusline (depending on the customization).<br><br>- BUG: Replaced :setlocal nowrap with 'wrap'. Without this, the 'sidescrolloff'<br>setting may cause the left side of the calendar to disappear if the last<br>inserted element is near the right window border. 'wrap' shouldn't matter,<br>anyway, and 'sidescrolloff' is a global setting, unfortunately.<br>Try :set sidescrolloff=3 in combination with :let g:calendar_navi = 'bottom' to<br>reproduce.<br><br>- BUG: The :normal i... for the navi rendering causes a trailing space after the<br>"Next>" button. This way, I cannot quickly type "G$<CR>" to activate the next<br>button. Now using :normal a... to append. This causes the entire navi to shift<br>one character to the right, but you could fix this by decreasing the column<br>counter.<br><br>- ENH: Use :stopinsert in case we've gotten here from insert mode (via<br><C-O>:Calendar<CR>)...<br><br>- Using :wincmd w instead of :normal <C-w>; it's simpler. (And you should always<br>use :normal! (with a bang) to avoid interference with user remappings!)<br><br>- ENH: I noticed that <left> and <s-left> do the same thing, but in different<br>ways (one uses the navi and the latter is called by the former). I dropped the<br>unintuitive shift mappings and instead do the jumps consistently in the navi,<br>using the b:Calendar... variables instead of that ugly maparg() stuff.<br><br>- ENH: I noticed that <left> and <up> do the same thing. I changed <up>/<down><br>to move an entire year, so one can quickly let the years pass...<br><br>- ENH: the 'q' mapping now returns to the previous window, not the first one.<br></td>
+    <td class="rowodd" valign="top" width="2000">Applied patch from thinca. Thanks.<br></td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=11771">calendar.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>1.9</b></td>
-    <td class="roweven" valign="top" nowrap><i>2009-11-20</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=11795">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>2.0</b></td>
+    <td class="roweven" valign="top" nowrap><i>2009-11-24</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="roweven" valign="top" width="2000">This is an upgrade for calendar.vim. use nnoremap.<br></td>
+    <td class="roweven" valign="top" width="2000">Applied patch from Ingo Karkat. Thanks.<br><br>- ENH: Added a config setting g:calendar_datetime. This allows to remove the<br>display of the current date/time in the title (I don't like it), and offers the<br>window's statusline as an alternative.<br><br>- BUG: The checks for g:calendar_action and g:calendar_sign should also check<br>for an existing, but empty variable. Otherwise, it is not possible to disable it<br>in a .vimrc, because the sourcing of calendar.vim would initialize the variables.<br><br>- BUG: In s:CalendarDoAction(), the check for g:calendar_action must come after<br>the "navi" handling; otherwise "navi" breaks if g:calendar_action is disabled<br>(see above).<br><br>- ENH: The :set wrapscan is ugly, because it is a global setting. The search()<br>commands already pass the 'w' flag, so the only remaining issue were the<br>searches via /. I modified the 'G0/...' search to 'G$?' (i.e. backward from end<br>of buffer), so that 'wrapscan' isn't required any more. (Even better would be to<br>use search() for these jumps, too.) With this, I can also completely get rid of<br>the autocmds in case one does not want the date/time in the title, neither (see<br>above).<br><br>- Using :setlocal buftype=nofile instead of =nowrite; this is more suitable for<br>this kind of scratch buffer, and avoids that the path may be shown in the title<br>/ statusline (depending on the customization).<br><br>- BUG: Replaced :setlocal nowrap with 'wrap'. Without this, the 'sidescrolloff'<br>setting may cause the left side of the calendar to disappear if the last<br>inserted element is near the right window border. 'wrap' shouldn't matter,<br>anyway, and 'sidescrolloff' is a global setting, unfortunately.<br>Try :set sidescrolloff=3 in combination with :let g:calendar_navi = 'bottom' to<br>reproduce.<br><br>- BUG: The :normal i... for the navi rendering causes a trailing space after the<br>"Next>" button. This way, I cannot quickly type "G$<CR>" to activate the next<br>button. Now using :normal a... to append. This causes the entire navi to shift<br>one character to the right, but you could fix this by decreasing the column<br>counter.<br><br>- ENH: Use :stopinsert in case we've gotten here from insert mode (via<br><C-O>:Calendar<CR>)...<br><br>- Using :wincmd w instead of :normal <C-w>; it's simpler. (And you should always<br>use :normal! (with a bang) to avoid interference with user remappings!)<br><br>- ENH: I noticed that <left> and <s-left> do the same thing, but in different<br>ways (one uses the navi and the latter is called by the former). I dropped the<br>unintuitive shift mappings and instead do the jumps consistently in the navi,<br>using the b:Calendar... variables instead of that ugly maparg() stuff.<br><br>- ENH: I noticed that <left> and <up> do the same thing. I changed <up>/<down><br>to move an entire year, so one can quickly let the years pass...<br><br>- ENH: the 'q' mapping now returns to the previous window, not the first one.<br></td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11496">calendar.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>1.8</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2009-10-08</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11771">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.9</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2009-11-20</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="rowodd" valign="top" width="2000">This is an upgrade for calendar.vim. fixed E382 while closing diary.<br></td>
+    <td class="rowodd" valign="top" width="2000">This is an upgrade for calendar.vim. use nnoremap.<br></td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=8279">calendar.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>1.7</b></td>
-    <td class="roweven" valign="top" nowrap><i>2008-02-15</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=11496">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.8</b></td>
+    <td class="roweven" valign="top" nowrap><i>2009-10-08</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="roweven" valign="top" width="2000">This is a fixed version of calendar.vim. fixed problem of week number on 03/01/2008.</td>
+    <td class="roweven" valign="top" width="2000">This is an upgrade for calendar.vim. fixed E382 while closing diary.<br></td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7409">calendar.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>1.6</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2007-07-24</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=8279">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.7</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2008-02-15</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="rowodd" valign="top" width="2000">Added new actions 'calendar_begin' and 'calenader_end'.</td>
+    <td class="rowodd" valign="top" width="2000">This is a fixed version of calendar.vim. fixed problem of week number on 03/01/2008.</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7047">calendar.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>1.5</b></td>
-    <td class="roweven" valign="top" nowrap><i>2007-05-01</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7409">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.6</b></td>
+    <td class="roweven" valign="top" nowrap><i>2007-07-24</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="roweven" valign="top" width="2000">This is an upgrade for calendar.vim. this include some bug fix.</td>
+    <td class="roweven" valign="top" width="2000">Added new actions 'calendar_begin' and 'calenader_end'.</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=4984">calendar.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>1.4a</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2006-01-16</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7047">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.5</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-05-01</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="rowodd" valign="top" width="2000">This is an upgrade for calendar.vim. this include some bug fix and calendar_today action.
<br></td>
+    <td class="rowodd" valign="top" width="2000">This is an upgrade for calendar.vim. this include some bug fix.</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=3599">calendar.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>1.4</b></td>
-    <td class="roweven" valign="top" nowrap><i>2004-11-03</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=4984">calendar.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.4a</b></td>
+    <td class="roweven" valign="top" nowrap><i>2006-01-16</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
-    <td class="roweven" valign="top" width="2000">This is an upgrade for Calendar.vim. this include 2 bug fixs and 1 improvement.</td>
+    <td class="roweven" valign="top" width="2000">This is an upgrade for calendar.vim. this include some bug fix and calendar_today action.
<br></td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=3599">calendar.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.4</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2004-11-03</i></td>
+    <td class="rowodd" valign="top" nowrap>6.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=103">Yasuhiro Matsumoto</a></i></td>
+    <td class="rowodd" valign="top" width="2000">This is an upgrade for Calendar.vim. this include 2 bug fixs and 1 improvement.</td>
 </tr>
 </table>
 <!-- finish off the framework -->
diff --git a/plugin/calendar.vim b/plugin/calendar.vim
index 1055ca5..598dd3a 100644
--- a/plugin/calendar.vim
+++ b/plugin/calendar.vim
@@ -2,11 +2,13 @@
 " What Is This: Calendar
 " File: calendar.vim
 " Author: Yasuhiro Matsumoto <mattn.jp at gmail.com>
-" Last Change: Tue, 24 Nov 2009
-" Version: 2.0
+" Last Change: 27-Jan-2011.
+" Version: 2.5
 " Thanks:
+"     SethMilliken                  : gave a hint for 2.4
+"     bw1                           : bug fix
 "     Ingo Karkat                   : bug fix
-"     Thinca                        : bug report
+"     Thinca                        : bug report, bug fix
 "     Yu Pei                        : bug report
 "     Per Winkvist                  : bug fix
 "     Serge (gentoosiast) Koksharov : bug fix
@@ -51,11 +53,18 @@
 "     :CalendarH ...
 "       show horizontal calendar ...
 "
-"     <Leader>ca
+"     <Leader>cal
 "       show calendar in normal mode
-"     <Leader>ch
+"     <Leader>caL
 "       show horizontal calendar ...
 " ChangeLog:
+"     2.5  : bug fix, 7.2 don't have relativenumber.
+"     2.4  : added g:calendar_options.
+"     2.3  : week number like ISO8601 
+"            g:calendar_monday and g:calendar_weeknm work together
+"     2.2  : http://gist.github.com/355513#file_customizable_keymap.diff
+"            http://gist.github.com/355513#file_winfixwidth.diff
+"     2.1  : bug fix, set filetype 'calendar'.
 "     2.0  : bug fix, many bug fix and enhancements.
 "     1.9  : bug fix, use nnoremap.
 "     1.8  : bug fix, E382 when close diary.
@@ -251,7 +260,6 @@
 "     *if you want to show week number, add this to your .vimrc:
 "
 "       set g:calendar_weeknm as below
-"       (Can't be used together with g:calendar_monday.)
 "
 "       let g:calendar_weeknm = 1 " WK01
 "       let g:calendar_weeknm = 2 " WK 1
@@ -315,7 +323,7 @@
 "       :echo calendar_version
 " GetLatestVimScripts: 52 1 :AutoInstall: calendar.vim
 
-let g:calendar_version = "2.0"
+let g:calendar_version = "2.5"
 if &compatible
   finish
 endif
@@ -354,6 +362,12 @@ if !exists("g:calendar_datetime")
  \&& g:calendar_datetime != 'statusline')
   let g:calendar_datetime = 'title'
 endif
+if !exists("g:calendar_options")
+  let g:calendar_options="fdc=0 nonu"
+  if has("+relativenumber")
+    let g:calendar_options .= " nornu"
+  endif
+endif
 
 "*****************************************************************
 "* Calendar commands
@@ -450,7 +464,7 @@ function! s:CalendarDoAction(...)
 
   if b:CalendarDir
     let dir = 'H'
-    if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+    if exists('g:calendar_weeknm')
       let cnr = col('.') - (col('.')%(24+5)) + 1
     else
       let cnr = col('.') - (col('.')%(24)) + 1
@@ -675,33 +689,41 @@ function! Calendar(...)
         let vnweek = 7
       endif
       let vnweek = vnweek - 1
-    elseif exists('g:calendar_weeknm')
+    endif
+
+    if exists('g:calendar_weeknm')
       " if given g:calendar_weeknm, show week number(ref:ISO8601)
-      let viweek = vparam / 7
-      let vfweek = vparam % 7
-      if vnweek == 0
-        let vfweek = vfweek - 7
-        let viweek = viweek + 1
-      else
-        let vfweek = vfweek - vnweek
-      endif
-      if vfweek <= 0 && viweek > 0
-        let viweek = viweek - 1
-        let vfweek = vfweek + 7
-      endif
-      if vfweek > -4
-        let viweek = viweek + 1
+
+      "vparam <= 1. day of month
+      "vnweek <= 1. weekday of month (0-6)
+      "viweek <= number of week
+      "vfweek <= 1. day of year
+
+      " mo di mi do fr sa so
+      " 6  5  4  3  2  1  0  vfweek
+      " 0  1  2  3  4  5  6  vnweek
+
+      let vfweek =((vparam % 7)  -vnweek+ 14-2) % 7
+      let viweek = (vparam - vfweek-2+7 ) / 7 +1 
+
+      if vfweek < 3
+         let viweek = viweek - 1
       endif
-      if vfweek > 3
-        let viweek = viweek + 1
+
+      "vfweekl  <=year length
+      let vfweekl = 52
+      if (vfweek == 3)  
+        let vfweekl = 53
       endif
+
       if viweek == 0
-        let viweek = '??'
-      elseif viweek > 52
-        if vnweek != 0 && vnweek < 4
-          let viweek = 1
+        let viweek = 52
+        if ((vfweek == 2) && (((vyear-1) % 4) !=0)) 
+              \ || ((vfweek == 1) && (((vyear-1) % 4) ==0))
+          let viweek = 53
         endif
       endif
+
       let vcolumn = vcolumn + 5
     endif
 
@@ -811,7 +833,7 @@ function! Calendar(...)
 
       let vinpcur = vinpcur + 1
       if vinpcur % 7 == 0
-        if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+        if exists('g:calendar_weeknm')
           if g:calendar_mark != 'right'
             let vdisplay2=vdisplay2.' '
           endif
@@ -834,6 +856,11 @@ function! Calendar(...)
             endif
           endif
           let viweek = viweek + 1
+
+          if viweek > vfweekl
+            let viweek = 1
+          endif
+
         endif
         let vdisplay2=vdisplay2."\n"
         if g:calendar_mark == 'right'
@@ -848,7 +875,7 @@ function! Calendar(...)
         let vdisplay2=vdisplay2.'   '
         let vinpcur = vinpcur + 1
       endwhile
-      if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+      if exists('g:calendar_weeknm')
         if g:calendar_mark != 'right'
           let vdisplay2=vdisplay2.' '
         endif
@@ -990,25 +1017,32 @@ function! Calendar(...)
 
     " or not
     if dir
-      execute 'bo '.vheight.'split __Calendar'
+      silent execute 'bo '.vheight.'split __Calendar'
       setlocal winfixheight
     else
-      execute 'to '.vcolumn.'vsplit __Calendar'
+      silent execute 'to '.vcolumn.'vsplit __Calendar'
+      setlocal winfixwidth
     endif
+    call s:CalendarBuildKeymap(dir, vyear, vmnth)
     setlocal noswapfile
     setlocal buftype=nofile
     setlocal bufhidden=delete
-    setlocal nonumber
+    silent! exe "setlocal " . g:calendar_options
+    let nontext_columns = &foldcolumn + &nu * &numberwidth
+    if has("+relativenumber")
+      let nontext_columns += &rnu * &numberwidth
+    endif
     " Without this, the 'sidescrolloff' setting may cause the left side of the
     " calendar to disappear if the last inserted element is near the right
     " window border.
-    setlocal wrap
+    setlocal nowrap
     setlocal norightleft
-    setlocal foldcolumn=0
     setlocal modifiable
     setlocal nolist
     let b:Calendar='Calendar'
+    setlocal filetype=calendar
     " is this a vertical (0) or a horizontal (1) split?
+    exe vcolumn + nontext_columns . "wincmd |"
   endif
   if g:calendar_datetime == "statusline"
     setlocal statusline=%{strftime('%c')}
@@ -1063,24 +1097,6 @@ function! Calendar(...)
   let vmnth = vmnth_org
 
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-  "+++ build keymap
-  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-  " make keymap
-  execute 'nnoremap <silent> <buffer> q :close<bar>wincmd p<cr>'
-
-  execute 'nnoremap <silent> <buffer> <cr> :call <SID>CalendarDoAction()<cr>'
-  execute 'nnoremap <silent> <buffer> <2-LeftMouse> :call <SID>CalendarDoAction()<cr>'
-  execute 'nnoremap <silent> <buffer> t :call Calendar(b:CalendarDir)<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> <Left>  :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
-  execute 'nnoremap <silent> <buffer> <Right> :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
-  execute 'nnoremap <silent> <buffer> <Up>    :call Calendar('.dir.','.(vyear-1).','.vmnth.')<cr>'
-  execute 'nnoremap <silent> <buffer> <Down>  :call Calendar('.dir.','.(vyear+1).','.vmnth.')<cr>'
-
-  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   "+++ build highlight
   "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   " today
@@ -1235,6 +1251,38 @@ function! s:CalendarVar(var)
 endfunction
 
 "*****************************************************************
+"* CalendarBuildKeymap : build keymap
+"*----------------------------------------------------------------
+"*****************************************************************
+function! s:CalendarBuildKeymap(dir, vyear, vmnth)
+  " make keymap
+  execute 'nnoremap <silent> <buffer> q :close<bar>wincmd p<cr>'
+
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarDoAction  :call <SID>CalendarDoAction()<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarDoAction  :call <SID>CalendarDoAction()<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarGotoToday :call Calendar(b:CalendarDir)<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarShowHelp  :call <SID>CalendarHelp()<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarReDisplay :call Calendar(' . a:dir . ',' . a:vyear . ',' . a:vmnth . ')<cr>'
+  let pnav = s:GetToken(g:calendar_navi_label, ',', 1)
+  let nnav = s:GetToken(g:calendar_navi_label, ',', 3)
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarGotoPrevMonth :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarGotoNextMonth :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarGotoPrevYear  :call Calendar('.a:dir.','.(a:vyear-1).','.a:vmnth.')<cr>'
+  execute 'nnoremap <silent> <buffer> <Plug>CalendarGotoNextYear  :call Calendar('.a:dir.','.(a:vyear+1).','.a:vmnth.')<cr>'
+
+  nmap <buffer> <CR>          <Plug>CalendarDoAction
+  nmap <buffer> <2-LeftMouse> <Plug>CalendarDoAction
+  nmap <buffer> t             <Plug>CalendarGotoToday
+  nmap <buffer> ?             <Plug>CalendarShowHelp
+  nmap <buffer> r             <Plug>CalendarReDisplay
+
+  nmap <buffer> <Left>  <Plug>CalendarGotoPrevMonth
+  nmap <buffer> <Right> <Plug>CalendarGotoNextMonth
+  nmap <buffer> <Up>    <Plug>CalendarGotoPrevYear
+  nmap <buffer> <Down>  <Plug>CalendarGotoNextYear
+endfunction
+
+"*****************************************************************
 "* CalendarHelp : show help for Calendar
 "*----------------------------------------------------------------
 "*****************************************************************

-- 
vim-scripts packaging



More information about the pkg-vim-maintainers mailing list