123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- *calendar.txt* Calendar utility for vim
- Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
- INTRODUCTION *calendar*
- This script creates a calendar window in vim. It does not rely on any
- external program, such as cal, etc.
- COMMANDS *calendar-commands*
- calendar.vim makes the following commands available:
- *calendar-:Calendar*
- :Calendar [[year] month] Show calendar at this year and this month in a
- vertical split. When [year] is omitted, the
- calendar will show the given month in the current
- year. When both [year] and [month] are omitted, the
- calendar will show the current month.
- *calendar-:CalendarH*
- :CalendarH [[year] month] Show calendar at this year and this month in a
- horizontal split. When [year] is omitted, the
- calendar will show the given month in the current
- year. When both [year] and [month] are omitted, the
- calendar will show the current month.
- *calendar-:CalendarT*
- :CalendarT [[year] month] Show calendar at this year and this month in a
- full-screen window. When [year] is omitted, the
- calendar will show the given month in the current
- year. When both [year] and [month] are omitted, the
- calendar will show the current month.
- *calendar-:CalendarVR*
- :CalendarVR [[year] month] Show calendar at this year and this month in a
- vertical split at the right site. When [year] is
- omitted, the calendar will show the given month in
- the current year. When both [year] and [month] are
- omitted, the calendar will show the current month.
- *calendar-:CalendarSearch*
- :CalendarSearch [keyword] Search something in current calendar diary book.
- MAPPINGS *calendar-mappings*
- calendar.vim makes the following normal mode mappings available:
- *calendar-cal*
- <LocalLeader>cal Brings up the calendar in a vertical split.
- Equivalent to calling |:Calendar|.
- *calendar-caL*
- <LocalLeader>caL Brings up the calendar in a horizontal split.
- Equivalent to calling |:CalendarH|.
- SETTINGS *calendar-settings*
- calendar.vim can be configured using the following settings:
- *g:calendar_no_mappings*
- Disable standard mappings:
- let g:calendar_no_mappings=0
- *g:calendar_focus_today*
- Keeps focus when moving to next or previous calendar: >
- let g:calendar_focus_today = 1
- <
- *g:calendar_keys*
- To change the key bindings in the calendar window, add entries to this
- dictionary. Possible keys, the action bound to the keycode given in the
- respective value for this key and the default binding are listed below.
- 'close' Closes calendar window. 'q'
- 'do_action' Executes |calendar_action|. '<CR>'
- 'goto_today' Executes |calendar_today|. 't'
- 'show_help' Displays a short help message. '?'
- 'redisplay' Redraws calendar window. 'r'
- 'goto_next_month' Jumps to the next month. '<Right>'
- 'goto_prev_month' Jumps to the previous month. '<Left>'
- 'goto_next_year' Jumps to the next year. '<Up>'
- 'goto_prev_year' Jumps to the previous year. '<Down>'
- An example in your .vimrc might look like this: >
- let g:calendar_keys = { 'goto_next_month': '<C-Right>', 'goto_prev_month': '<C-Left>'}
- <
- *g:calendar_mark*
- Place a '*' or '+' mark after the day. Acceptable values are 'left',
- 'left-fit', and 'right': >
- let g:calendar_mark = 'right'
- <
- *g:calendar_diary*
- Specify the directory for the diary files. The default value is $HOME/diary. >
- let g:calendar_diary=$HOME.'/.vim/diary'
- <
- *g:calendar_diary_list*
- Specify multiple diary configurations. >
- let g:calendar_diary_list = [
- \ {'name': 'Note', 'path': $HOME.'/note', 'ext': '.md'},
- \ {'name': 'Diary', 'path': $HOME.'/diary', 'ext': '.diary.md'},
- \ ]
- <
- *g:calendar_diary_list_curr_idx*
- Specify multiple diary default configuration. The default value is 0. >
- let g:calendar_diary_list_curr_idx = 1
- <
- *g:calendar_navi*
- To control the calendar navigator, set this variable. Acceptable values are
- 'top', 'bottom', or 'both'. >
- let g:calendar_navi = ''
- <
- *g:calendar_navi_label*
- To set the labels for the calendar navigator, for example to change the
- language, use this variable. Entries should be comma separated. >
- let g:calendar_navi_label = 'Prev,Today,Next'
- <
- *g:calendar_erafmt*
- To change the dating system, set the following variable. Include the name of
- the dating system and its offset from the Georgian calendar (A.D.). For
- example, to use the current Japanese era (Heisei), you would set: >
- let g:calendar_erafmt = 'Heisei,-1988'
- <
- *g:calendar_mruler*
- To change the month names for the calendar headings, set this variable. The
- value is expected to be a comma-separated list of twelve values, starting with
- January: >
- let g:calendar_mruler = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'
- <
- *g:calendar_wruler*
- To change the week names for the calendar headings, set this variable. The
- value is expected to be a space-separated list of seven values, starting with
- Sunday: >
- let g:calendar_wruler = 'Su Mo Tu We Th Fr Sa'
- <
- *g:calendar_monday*
- To make the week start on Monday rather than Sunday, set this variable. Note
- that the value of |g:calendar_wruler| is not affected by this; it should
- always begin with Sunday: >
- let g:calendar_monday = 1
- <
- *g:calendar_weeknm*
- To show the week number, set this variable. There are four valid settings: >
- let g:calendar_weeknm = 1 " WK01
- let g:calendar_weeknm = 2 " WK 1
- let g:calendar_weeknm = 3 " KW01
- let g:calendar_weeknm = 4 " KW 1
- let g:calendar_weeknm = 5 " 1
- <
- *g:calendar_datetime*
- To control display of the current date and time, set this variable.
- Acceptable values are 'title', 'statusline', and '': >
- let g:calendar_datetime = 'title'
- <
- *g:calendar_filetype*
- To control the filetype of calendar entries, set this variable. It defaults to
- 'markdown'. Acceptable values are values that are acceptable for |filetype|
- like e.g. 'markdown' or 'pandoc':
- let g:calendar_filetype = 'pandoc'
- *g:calendar_number_of_months*
- To control the number of months per view, set this variable. The default value
- is 3. >
- let g:calendar_number_of_months = 5
- <
- *g:calendar_search_grepprg*
- To set the command |:CalendarSearch| grepprg config. default value is 'grep',
- using system default grep program. If you want use Vim internal grep command
- |:vimgrep|, set value to 'internal'. >
- let g:calendar_search_grepprg = 'internal'
- <
- HOOKS *calendar-hooks*
- calendar.vim provides a number of hooks which allow you to run custom code on
- certain events. These are documented below.
- *calendar_action*
- The function declared in the calendar_action variable is run when the user
- presses enter on a date. Implement and set your function as follows: >
- function MyCalAction(day,month,year,week,dir)
- " day : day you actioned
- " month : month you actioned
- " year : year you actioned
- " week : day of week (Mo=1 ... Su=7)
- " dir : direction of calendar
- endfunction
- let calendar_action = 'MyCalAction'
- <
- *calendar_begin*
- The function declared in the calendar_begin variable is run just before the
- calendar is displayed. Implement and set your function as follows: >
- function MyCalActionBegin()
- endfunction
- let calendar_begin = 'MyCalActionBegin'
- <
- *calendar_end*
- The function declared in the calendar_end variable is run just after the
- calendar is displayed. Implement and set your function as follows: >
- function MyCalActionEnd()
- endfunction
- let calendar_end = 'MyCalActionEnd'
- <
- *calendar_sign*
- The function declared in the calendar_sign variable can be used to set a mark
- next to certain dates. Implement and set your function as follows: >
- function MyCalSign(day,month,year)
- " day : day you actioned
- " month : month you actioned
- " year : year you actioned
- if a:day == 1 && a:month == 1
- return 1 " happy new year
- else
- return 0 " or not
- endif
- endfunction
- let calendar_sign = 'MyCalSign'
- <
- *calendar_today*
- The function declared in the calendar_today variable is run when the user
- presses 'today'. Implement and set your function as follows: >
- function MyCalToday()
- endfunction
- let calendar_today = 'MyCalToday'
- <
- ABOUT *calendar-about*
- calendar.vim is available on GitHub:
- http://github.com/mattn/calendar-vim
- and also on VimScripts:
- http://www.vim.org/scripts/script.php?script_id=52
- vim:tw=78:et:ft=help:norl:
|