Skip to content

Instantly share code, notes, and snippets.

@thinca
Created April 4, 2010 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinca/355513 to your computer and use it in GitHub Desktop.
Save thinca/355513 to your computer and use it in GitHub Desktop.
Index: calendar.vim
===================================================================
--- calendar.vim (リビジョン 770)
+++ calendar.vim (作業コピー)
@@ -997,6 +997,7 @@
else
execute 'to '.vcolumn.'vsplit __Calendar'
endif
+ call s:CalendarBuildKeymap(dir, vyear, vmnth)
setlocal noswapfile
setlocal buftype=nofile
setlocal bufhidden=delete
@@ -1066,24 +1067,6 @@
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
@@ -1238,6 +1221,38 @@
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
"*----------------------------------------------------------------
"*****************************************************************
Index: calendar.vim
===================================================================
--- calendar.vim (リビジョン 778)
+++ calendar.vim (作業コピー)
@@ -996,6 +996,7 @@
setlocal winfixheight
else
execute 'to '.vcolumn.'vsplit __Calendar'
+ setlocal winfixwidth
endif
call s:CalendarBuildKeymap(dir, vyear, vmnth)
setlocal noswapfile
@mattn
Copy link

mattn commented May 6, 2010

おっと。忘れてました。取り入れます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment