unite-messages ãã¤ãã£ã¦ã¿ã
ãã®è¨äºã¯ Vim Advent Calendar 2012 334æ¥ç®ã®è¨äºã«ãªãã¾ãã
ææ¥ä»¥éã®æ
å½è
ãã¾ã 決ã¾ã£ã¦ããªãã®ã§èª°ãæ¸ãããæ¹ãããã° @osyo_memo ã¾ã§ãé£çµ¡ä¸ããã
ã¡ãªã¿ã« Vim Advent Calendar 2013 ã¯ææ¥ãããããåéããäºå®ã§ãã
ä¸è¨ã®è¨äºã«è§¦çºãã㦠unite.vim ã ã¨ã©ãã¾ã§åºæ¥ãã®ãããããã¨è©¦ãã¦ã¿ã¾ããã
[:messages ã unite.vim ã§åºå]
:messages ã unite.vim ã¸ã¨åºåããå ´å㯠unite-output ã使ç¨ããã®ã楽ã ã¨æãã¾ãã
" :messages ã®åºåçµæã unite.vim ã¸åºåãã :Unite output:messages
ããã¯æ¬¡ã®ããã« aliases ãè¨å®ãã¦ããã¨å¼ã³åºãã楽ã«ãªãã¾ãã
let g:unite_source_alias_aliases = { \ 'messages' : { \ 'source': 'output', \ 'args': 'message', \ }, \}
" :Unite output:messages :Unite messages
[åè£ãéé ã«è¡¨ç¤ºãã]
LeafCage ããã®è¨äºã§ãæ¸ããã¦ãã¾ãããããã¡ãã¡ä¸çªä¸ã®åºåçµæã¾ã§ç§»åããã®ã¯æéã§ãã
ããã§ãåé¿æ¹æ³ãã®1ãã¨ããäºã§åºåçµæãéé ã«ãã¦ã¿ã¾ãã
ããã«ã¯ unite-filters ãå©ç¨ã§ãã¾ãã
" éé ã« sort ãã call unite#custom#source('messages', 'sorters', 'sorter_reverse')
ããã§ä¸çªæå¾ã«åºåããã :messages ãä¸çªä¸ã«ç§»åãã¾ãã
[unite.vim ã®èµ·åå¾ã«ä¸çªä¸ã«ã«ã¼ã½ã«ã移åããã]
ãåé¿æ¹æ³ãã®2ã
unite.vim ã®èµ·åæã« -log ãªãã·ã§ã³ã追å ããäºãã«ã¼ã½ã«ãä¸çªä¸ã«ç§»åãããäºãã§ãã¾ãã
:Unite messages -log
sorter_reverse ã®è¨å®ã¨ã¯å¬ã¿åããªãã®ã§ããã®ãªãã·ã§ã³ã使ç¨ããå ´å㯠sorter_reverse ãè¨å®ããªãã»ããããã§ãããã
[:messages ã®å 容ãåé¤ãã]
Vim ã§ã¯ :messages ã®å
容ãåé¤ãããã¨ã¯ã§ãã¾ããã
ãããã次ã®ããã«ç©ºã®æååãåºåããäºã§æ¬ä¼¼çã« :messages ã§è¡¨ç¤ºãããªãããã«ãããã¨ã¯ã§ãã¾ãã
" å±¥æ´ããã¹ã¦ç©ºã®æååã§åãã for n in range(200) | echom "" | endfor " ã³ãã³ããå®ç¾©ããã command! MessageClear for n in range(200) | echom "" | endfor
ãã㯠:messages ã使ç¨ããå ´åã«ã¯æå¹ãªã®ã§ãããunite.vim ã¸åºåããå ´åã«ã¯ç©ºã®è¡ãæ¿å
¥ãããã®ã§æå¹ã§ã¯ããã¾ããã
ããã§æ¬¡ã®ããã«ãåè£ã空ç½ã§ããã°åé¤ãããã¨ãã unite-filters ãå®ç¾©ãã¦ã¿ã¾ããã
" 空ç½è¡ãåãé¤ã converter ãå®ç¾©ãã let s:filters = { \ "name" : "converter_remove_empty_word", \} function! s:filters.filter(candidates, context) return filter(deepcopy(a:candidates), '!empty(v:val.word)') endfunction call unite#define_filter(s:filters) unlet s:filters " messages ã® converters ãè¨å®ãã call unite#custom#source('messages', 'converters', "converter_remove_empty_word")
[éãä½ç½®ãå¤æ´ãã]
:messages ã®å ´åã¯ä¸çªä¸ã®ä½ç½®ã§éãããã®ã§ unite.vim ã§ãä¸çªä¸ã®ä½ç½®ã§éãããã«è¨å®ãã¦ã¿ããã¨æãã¾ãã
unite.vim 㯠-direction ã³ãã³ããªãã·ã§ã³ã§éãä½ç½®ãè¨å®ãããã¨ãã§ãã¾ãã
:Unite messages -direction=botright
ä»ã®éãæ¹ãªããã¯ã
:help opening-window
ãåç
§ãã¦ä¸ããã
[unite.vim ã®ãããã¡ãåæç»ãã]
unite.vim 㧠messages ãéãã£ã±ãªãã«ãã¦ããå ´åãå¤é¨ãã messages ã®åºåã®åæç»ãè¡ãããå ´åãããã¨æãã¾ãã
ãã®ãããªå ´åã«ã¯æ¬¡ã®ããã«ãã¦ãå¤é¨ããç¹å®ã® unite.vim ã®ãããã¡ãåæç»ããäºãã§ãã¾ãã
" ãããã¡åãæå®ã㦠unite.vim ãéã :Unite messages -buffer-name=messages " unite.vim ã®èµ·åæã«æå®ãããããã¡å "messages" ãåæç»ãã call unite#force_redraw(unite#helper#get_unite_winnr("messages"))
[ã³ãã³ããå®ç¾©ãã]
é »ç¹ã«ä½¿ç¨ããããã§ããã°æ¬¡ã®ãããªã³ãã³ããå®ç¾©ãã¦ããã¨ä¾¿å©ã§ãã
" ã³ãã³ããªãã·ã§ã³ãè¨å®ããã³ãã³ããå®ç¾© command! -nargs=* -complete=customlist,unite#complete#source \ Message \ Unite messages -direction=botright -log -buffer-name=messages <args> " vim-altercmd ã使ç¨ã㦠:messages ã¨å ¥ãæ¿ãã¦ã¿ãã AlterCommand mes Message AlterCommand Mes mes
ç°¡åã«ã§ãããããªæãã§è¨å®ãã¦ã¿ã¾ããã
:messages ã«æ¯ã¹ã¦ unite.vim ãèµ·åãããªã¼ãã¼ãããã¯ããã®ã§ãããunite-filters çã使ç¨ããæ¡å¼µæ§ã¯é«ãã¨æãã¾ãã
ããã©ã«ãã® :messages ã§æºè¶³ã§ããªãã®ã§ããã°ä½¿ç¨ãã¦ã¿ãã¨ããã¨æãã¾ãã
ãã¨ã¯ãã¤ã©ã¤ãã¨ããè¨å®ãããã§ããã