calendar.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. *calendar.txt* Calendar utility for vim
  2. Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
  3. INTRODUCTION *calendar*
  4. This script creates a calendar window in vim. It does not rely on any
  5. external program, such as cal, etc.
  6. COMMANDS *calendar-commands*
  7. calendar.vim makes the following commands available:
  8. *calendar-:Calendar*
  9. :Calendar [[year] month] Show calendar at this year and this month in a
  10. vertical split. When [year] is omitted, the
  11. calendar will show the given month in the current
  12. year. When both [year] and [month] are omitted, the
  13. calendar will show the current month.
  14. *calendar-:CalendarH*
  15. :CalendarH [[year] month] Show calendar at this year and this month in a
  16. horizontal split. When [year] is omitted, the
  17. calendar will show the given month in the current
  18. year. When both [year] and [month] are omitted, the
  19. calendar will show the current month.
  20. *calendar-:CalendarT*
  21. :CalendarT [[year] month] Show calendar at this year and this month in a
  22. full-screen window. When [year] is omitted, the
  23. calendar will show the given month in the current
  24. year. When both [year] and [month] are omitted, the
  25. calendar will show the current month.
  26. *calendar-:CalendarVR*
  27. :CalendarVR [[year] month] Show calendar at this year and this month in a
  28. vertical split at the right site. When [year] is
  29. omitted, the calendar will show the given month in
  30. the current year. When both [year] and [month] are
  31. omitted, the calendar will show the current month.
  32. *calendar-:CalendarSearch*
  33. :CalendarSearch [keyword] Search something in current calendar diary book.
  34. MAPPINGS *calendar-mappings*
  35. calendar.vim makes the following normal mode mappings available:
  36. *calendar-cal*
  37. <LocalLeader>cal Brings up the calendar in a vertical split.
  38. Equivalent to calling |:Calendar|.
  39. *calendar-caL*
  40. <LocalLeader>caL Brings up the calendar in a horizontal split.
  41. Equivalent to calling |:CalendarH|.
  42. SETTINGS *calendar-settings*
  43. calendar.vim can be configured using the following settings:
  44. *g:calendar_no_mappings*
  45. Disable standard mappings:
  46. let g:calendar_no_mappings=0
  47. *g:calendar_focus_today*
  48. Keeps focus when moving to next or previous calendar: >
  49. let g:calendar_focus_today = 1
  50. <
  51. *g:calendar_keys*
  52. To change the key bindings in the calendar window, add entries to this
  53. dictionary. Possible keys, the action bound to the keycode given in the
  54. respective value for this key and the default binding are listed below.
  55. 'close' Closes calendar window. 'q'
  56. 'do_action' Executes |calendar_action|. '<CR>'
  57. 'goto_today' Executes |calendar_today|. 't'
  58. 'show_help' Displays a short help message. '?'
  59. 'redisplay' Redraws calendar window. 'r'
  60. 'goto_next_month' Jumps to the next month. '<Right>'
  61. 'goto_prev_month' Jumps to the previous month. '<Left>'
  62. 'goto_next_year' Jumps to the next year. '<Up>'
  63. 'goto_prev_year' Jumps to the previous year. '<Down>'
  64. An example in your .vimrc might look like this: >
  65. let g:calendar_keys = { 'goto_next_month': '<C-Right>', 'goto_prev_month': '<C-Left>'}
  66. <
  67. *g:calendar_mark*
  68. Place a '*' or '+' mark after the day. Acceptable values are 'left',
  69. 'left-fit', and 'right': >
  70. let g:calendar_mark = 'right'
  71. <
  72. *g:calendar_diary*
  73. Specify the directory for the diary files. The default value is $HOME/diary. >
  74. let g:calendar_diary=$HOME.'/.vim/diary'
  75. <
  76. *g:calendar_diary_list*
  77. Specify multiple diary configurations. >
  78. let g:calendar_diary_list = [
  79. \ {'name': 'Note', 'path': $HOME.'/note', 'ext': '.md'},
  80. \ {'name': 'Diary', 'path': $HOME.'/diary', 'ext': '.diary.md'},
  81. \ ]
  82. <
  83. *g:calendar_diary_list_curr_idx*
  84. Specify multiple diary default configuration. The default value is 0. >
  85. let g:calendar_diary_list_curr_idx = 1
  86. <
  87. *g:calendar_navi*
  88. To control the calendar navigator, set this variable. Acceptable values are
  89. 'top', 'bottom', or 'both'. >
  90. let g:calendar_navi = ''
  91. <
  92. *g:calendar_navi_label*
  93. To set the labels for the calendar navigator, for example to change the
  94. language, use this variable. Entries should be comma separated. >
  95. let g:calendar_navi_label = 'Prev,Today,Next'
  96. <
  97. *g:calendar_erafmt*
  98. To change the dating system, set the following variable. Include the name of
  99. the dating system and its offset from the Georgian calendar (A.D.). For
  100. example, to use the current Japanese era (Heisei), you would set: >
  101. let g:calendar_erafmt = 'Heisei,-1988'
  102. <
  103. *g:calendar_mruler*
  104. To change the month names for the calendar headings, set this variable. The
  105. value is expected to be a comma-separated list of twelve values, starting with
  106. January: >
  107. let g:calendar_mruler = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'
  108. <
  109. *g:calendar_wruler*
  110. To change the week names for the calendar headings, set this variable. The
  111. value is expected to be a space-separated list of seven values, starting with
  112. Sunday: >
  113. let g:calendar_wruler = 'Su Mo Tu We Th Fr Sa'
  114. <
  115. *g:calendar_monday*
  116. To make the week start on Monday rather than Sunday, set this variable. Note
  117. that the value of |g:calendar_wruler| is not affected by this; it should
  118. always begin with Sunday: >
  119. let g:calendar_monday = 1
  120. <
  121. *g:calendar_weeknm*
  122. To show the week number, set this variable. There are four valid settings: >
  123. let g:calendar_weeknm = 1 " WK01
  124. let g:calendar_weeknm = 2 " WK 1
  125. let g:calendar_weeknm = 3 " KW01
  126. let g:calendar_weeknm = 4 " KW 1
  127. let g:calendar_weeknm = 5 " 1
  128. <
  129. *g:calendar_datetime*
  130. To control display of the current date and time, set this variable.
  131. Acceptable values are 'title', 'statusline', and '': >
  132. let g:calendar_datetime = 'title'
  133. <
  134. *g:calendar_filetype*
  135. To control the filetype of calendar entries, set this variable. It defaults to
  136. 'markdown'. Acceptable values are values that are acceptable for |filetype|
  137. like e.g. 'markdown' or 'pandoc':
  138. let g:calendar_filetype = 'pandoc'
  139. *g:calendar_number_of_months*
  140. To control the number of months per view, set this variable. The default value
  141. is 3. >
  142. let g:calendar_number_of_months = 5
  143. <
  144. *g:calendar_search_grepprg*
  145. To set the command |:CalendarSearch| grepprg config. default value is 'grep',
  146. using system default grep program. If you want use Vim internal grep command
  147. |:vimgrep|, set value to 'internal'. >
  148. let g:calendar_search_grepprg = 'internal'
  149. <
  150. HOOKS *calendar-hooks*
  151. calendar.vim provides a number of hooks which allow you to run custom code on
  152. certain events. These are documented below.
  153. *calendar_action*
  154. The function declared in the calendar_action variable is run when the user
  155. presses enter on a date. Implement and set your function as follows: >
  156. function MyCalAction(day,month,year,week,dir)
  157. " day : day you actioned
  158. " month : month you actioned
  159. " year : year you actioned
  160. " week : day of week (Mo=1 ... Su=7)
  161. " dir : direction of calendar
  162. endfunction
  163. let calendar_action = 'MyCalAction'
  164. <
  165. *calendar_begin*
  166. The function declared in the calendar_begin variable is run just before the
  167. calendar is displayed. Implement and set your function as follows: >
  168. function MyCalActionBegin()
  169. endfunction
  170. let calendar_begin = 'MyCalActionBegin'
  171. <
  172. *calendar_end*
  173. The function declared in the calendar_end variable is run just after the
  174. calendar is displayed. Implement and set your function as follows: >
  175. function MyCalActionEnd()
  176. endfunction
  177. let calendar_end = 'MyCalActionEnd'
  178. <
  179. *calendar_sign*
  180. The function declared in the calendar_sign variable can be used to set a mark
  181. next to certain dates. Implement and set your function as follows: >
  182. function MyCalSign(day,month,year)
  183. " day : day you actioned
  184. " month : month you actioned
  185. " year : year you actioned
  186. if a:day == 1 && a:month == 1
  187. return 1 " happy new year
  188. else
  189. return 0 " or not
  190. endif
  191. endfunction
  192. let calendar_sign = 'MyCalSign'
  193. <
  194. *calendar_today*
  195. The function declared in the calendar_today variable is run when the user
  196. presses 'today'. Implement and set your function as follows: >
  197. function MyCalToday()
  198. endfunction
  199. let calendar_today = 'MyCalToday'
  200. <
  201. ABOUT *calendar-about*
  202. calendar.vim is available on GitHub:
  203. http://github.com/mattn/calendar-vim
  204. and also on VimScripts:
  205. http://www.vim.org/scripts/script.php?script_id=52
  206. vim:tw=78:et:ft=help:norl: