56 calendar.vim (3-2) howm-mode.vim ã¨ã®é£æº
45 3-1 ã§æ¸ãã¦ãããæ¾ç½®ãã£ã±ãªãã ã£ã calendar.vim ã«ã¤ãã¦æ¸ãã
ç®æ¨ã¯æ¥ä»ä¸ã§ ENTER ã§ãã®æ¥ä»åå¾ã®äºå®ã表示ãããã¨ã49 2-26 ã®ä¿®æ£ãå©ç¨ããã
ENTERã§ç¬èªã®åä½ããããããã«ã¯ g:calendar_action ã«é¢æ°ãæå®ãã¦ããã°ãããããããããããããªããã¨ããããããã¹ãããã¦ã¿ãã
let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) let query = a:year . '-' . a:month . '-' . a:day echo query endfunction
æ¥ä»ã®ãã©ã¼ããããæ°ã«ãªãæãããããä¿®æ£ãã¦åãã¹ã
let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) let query = printf('%04d-%02d-%02d', a:year, a:month, a:day) echo query endfunction
OK ã次ã¯å®éã«æ¤ç´¢ãã¦ã¿ããä¾ã® howm å´ã«è¿½å ãã :ShowSchedule ã使ãã
let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) let query = printf('%04d-%02d-%02d', a:year, a:month, a:day) " echo query execute ':HowmSchedule' query endfunction
ä¸å¿ãæ¤ç´¢ã¯ã§ããããéãä½ç½®ã¨ãããéãããã¨ã®ã«ã¬ã³ãã¼ã¨ãããæ°æã¡ãæªããããã§ãä¸æ¦ã«ã¬ã³ãã¼ãéãã¦ãå度éãç´ãã¦ããã
let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) let query = printf('%04d-%02d-%02d', a:year, a:month, a:day) " echo query only | enew execute ':HowmSchedule' query let cmd = ':Calendar' if a:dir != 'V' | let cmd .= 'H' | endif execute cmd a:year a:month endfunction
ã©ã®æ¥ä»ãå©ãã¦ããã«ã¬ã³ãã¼ã®ä»æ¥ã«ãã©ã¼ã«ã¹ãè¡ããã©ããæ¤ç´¢ãã¦ããã®ããããããã¤ã©ã¤ã©ãããã«ã¼ã½ã«ä½ç½®ãå¤æ´ãã¦ããã g:calendar_sign ã使ã£ã¦ãç®å°ãã¤ãã¦ããã¦ãããã«ç§»åããã
let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) let g:calendar_focus = {'year': a:year, 'month': a:month, 'day': a:day} let query = printf('%04d-%02d-%02d', a:year, a:month, a:day) " echo query only | enew execute ':HowmSchedule ' query let cmd = ':Calendar' if a:dir != 'V' | let cmd .= 'H' | endif execute cmd a:year a:month call cursor(1, 1) let [lnum, col] = searchpos('+', 'n') if ((lnum != 0) && (col != 0)) call cursor(lnum, col) else let [lnum, col] = searchpos('*', 'n') if ((lnum != 0) && (col != 0)) call cursor(lnum, col) endif endif endfunction let g:calendar_sign = 'CalendarSignHowm' function! CalendarSignHowm(day,month,year) if !exists('g:calendar_focus') | return 0 | endif if a:year == g:calendar_focus['year'] && \ a:month == g:calendar_focus['month'] && \ a:day == g:calendar_focus['day'] return 1 else return 0 endif endfunction
ããã§ä¸å¿ã®å®æãéãå¢ãã¦ããã®ã§å¥ãã¡ã¤ã«ã«åé¢(å¥ã« fold ã§ãè¯ãã£ãã)ãvimrc ã§ããã¾ãããã°ããã¦ãå°ãããã念ã®ããããã§ãã¯ç¨ã®ã³ã¼ãã追å ãã¦ããããã¨ãã£ãããªã®ã§ g:howm_date_pattern ã使ãå½¢ã«ã
so ~/vimfiles/calendar_action.vim
scriptencoding utf-8 let g:calendar_action = 'CalendarActionHowm' function! CalendarActionHowm(day, month, year, week, dir) if exists(':HowmSchedule') != 2 | return | endif if exists(':Calendar') != 2 || exists(':CalendarH') != 2 | return | endif let g:calendar_focus = {'year': a:year, 'month': a:month, 'day': a:day} let query = g:howm_date_pattern let query = substitute(query, '%Y', printf('%04d', a:year), 'g') let query = substitute(query, '%m', printf('%02d', a:month), 'g') let query = substitute(query, '%d', printf('%02d', a:day), 'g') " echo query only | enew execute ':HowmSchedule ' query let cmd = ':Calendar' if a:dir != 'V' | let cmd .= 'H' | endif execute cmd a:year a:month call cursor(1, 1) let [lnum, col] = searchpos('+', 'n') if ((lnum != 0) && (col != 0)) call cursor(lnum, col) else let [lnum, col] = searchpos('*', 'n') if ((lnum != 0) && (col != 0)) call cursor(lnum, col) endif endif endfunction let g:calendar_sign = 'CalendarSignHowm' function! CalendarSignHowm(day,month,year) if !exists('g:calendar_focus') | return 0 | endif if a:year == g:calendar_focus['year'] && \ a:month == g:calendar_focus['month'] && \ a:day == g:calendar_focus['day'] return 1 else return 0 endif endfunction
ã§ããã¼ã使ç¨æ¡ä»¶ã¯ Vim7 && howm-mode.vim ( çããããé©ç¨ç ) && calendar.vim ãå ¬éãã¨ãã®ã§ã使ãããæ¹é©å½ã«ã©ããã
http://d.hatena.ne.jp/eclipse-a/20080315/1205586936 ã§åé¡ç¹ä¿®æ£ã¨ããããï¼ãã¨ä¸è¨ã®å ¬éURLã¯å¤ããï¼