ãç«ã¦ï¼ç«ã¤ãã ãã ã¼ï¼ã
ãã®è¨äºã¯ Vim ã¢ããã³ãã«ã¬ã³ãã¼ 2012 ã® 19 æ¥ç®ã®è¨äºã§ãï¼ æ¨æ¥ã¯hrsh7th ããã® vim-versions ã«ã¤ãã¦ã®è¨äº ã§ããï¼
ãããããã©ã°ã¤ã³ãå ¥ãããè¨å®ãæ¸ããããã¦ãã㨠Vim ã®ç«ã¡ä¸ããã¯ã©ãã©ãé ããªã£ã¦ãã¾ãã¾ãï¼ ä¸åº¦ Vim ãç«ã¡ä¸ããããã®ãã¨éãããã¨ãç¡ãã¹ã¿ã¤ã«ã®äººã¯ããã»ã©æ°ã«ãªããªãããããã¾ãããï¼ ã·ã§ã«ããã¿ã¼ããã«å 㧠Vim ãéãããéãããããã¹ã¿ã¤ã«ã®äººã«ã¨ã£ã¦ã¯èµ·åé度ã¯ã¨ã¦ã大äºã§ãï¼
ä»å¹´ã®ã¢ããã³ãã«ã¬ã³ãã¼ã§ã¯ï¼ç´ æµãªãã©ã°ã¤ã³ãå ¥ã㦠Vim ã®æ©è½ãå¼·åããè¨äºãããããç´¹ä»ããã¦ããã®ã§ï¼ ããã§ã¯ãããã£ã便å©ãããªãã¹ãç¶æãã¤ã¤ï¼èµ·åæéãæããæ¹æ³ãç´¹ä»ãã¾ãï¼
(1/3 追è¨) neobundle.vim ããã¼ã¸ã§ã³ 3 ã«ãªãï¼ãã¡ã¤ã«ã¿ã¤ãã»ã³ãã³ãã»é¢æ°åã»ãããã³ã°ã®ããããã§èªã¿è¾¼ã¿ã¿ã¤ãã³ã°ãæå®ããæ©è½ã追å ããã¾ããï¼
ã¢ã¦ãã©ã¤ã³
- è¦ããªããã©ã°ã¤ã³ãåãé¤ã
- è¦ããªãè¨å®ãåãé¤ã
- autoload 以ä¸ã®é¢æ°ããªãã¹ã使ããªãããã«ãã
- ãã©ã°ã¤ã³ã®èªã¿è¾¼ã¿èªä½ãé
延ããï¼neobundle.vim ç·¨ï¼
- NeoBundleLazy ã® autoload ãªãã·ã§ã³ã使ã (1/3 ã«è¿½è¨)
- ç¹å®ã® filetype ã§ã®ã¿èªã¿è¾¼ã
- gVim ã®ã¿ã§èªã¿è¾¼ã
- ç¹å®ã®ã³ãã³ãã使ã£ãæã«åãã¦èªã¿è¾¼ã
- ãã©ã°ã¤ã³åã㦠autoload ã«ç§»ã
- augroup ã1ã¤ã«çµ±ä¸ãã
- æéã®ãããå¦çããªãã¹ãé 延ãã
- èªã¿è¾¼ã vimrc ãå¶éãã
- vimrc èªæ¸ä¼ã«åå ãã
- ã¾ã¨ã
è¦ããªããã©ã°ã¤ã³ãåãé¤ã
è²ã ãã©ã°ã¤ã³ã試ãã¦ããã¨ï¼ãããè¯ãããã ãªã¼ãã¨æã£ã¦å ¥ãã¦ã¿ã¦çµå±ãã¾ã使ããªãã£ããã©ã°ã¤ã³ãªã©ãã©ããã¦ãåºã¦ãã¦ãã¾ãã¾ãï¼ ãããã£ããã©ã°ã¤ã³ãè¦ã¤ãã¦åãé¤ããã¨ã§ï¼èµ·åæéãæ¹åã§ãã¾ãï¼
ã©ã®ãã©ã°ã¤ã³ã®èªã¿è¾¼ã¿ã«ã©ã®ç¨åº¦ã®æéãããã£ã¦ããã㯠--startuptime
ãªãã·ã§ã³ãä»ãã¦èµ·åãããã¨ã§
確èªã§ãã¾ãï¼
vim --startuptime hoge
ã¨ã㦠Vim ãèµ·åããã¨ï¼Vim ãèµ·åæã®ãã¡ã¤ã«ãã¨ã®èªã¿è¾¼ã¿æéãã«ã¬ã³ããã£ã¬ã¯ããªã® hoge ã¨ãããã¡ã¤ã« ã«æ¸ãè¾¼ã¾ãã¾ãï¼ ç¬¬1ã«ã©ã ã«èµ·åéå§ããã®æéï¼ããªç§ï¼ï¼ç¬¬2ã«ã©ã ã«ãã¡ã¤ã«ã®èªã¿è¾¼ã¿ã«ããã£ãæéï¼ããªç§ï¼ãåºã¦ããã¯ãã§ãï¼ ãã¨ã¯ãããè¦ã¦ï¼èªã¿è¾¼ã¿æéãããã£ã¦ãã¦ï¼ãã¤ã»ã¼ä½¿ã£ã¦ããªããã©ã°ã¤ã³ãåã£ã¦ããã¾ãï¼
è¦ããªãè¨å®ãåãé¤ã
次㫠vimrc ã®ã©ã®é¨åã«ã©ããããèªã¿è¾¼ã¿æéãããã£ã¦ãããã調ã¹ã¾ãï¼
ä¸è¨ã® --startuptime
ãªãã·ã§ã³ã§ã¯ãã¡ã¤ã«ãã¨ã®èªã¿è¾¼ã¿æéããåãããªãããï¼.vimrc ã®åè¡ã®èªã¿è¾¼ã¿ã«ã©ãããã
ããã£ã¦ããããç¥ãããã«ã¯ mattn ããã®æ¸ãã benchvimrc ã¾ã㯠+profile ä»ãã§ãã«ãããã Vim ã使ãã¾ãï¼
- benchvimrc â vimrcã®ã©ããéãã®ãã調ã¹ããããã©ã°ã¤ã³æ¸ããã
- +profile ã使ã â vimrc ã®ã©ããéãã®ãã調ã¹ããã1ã¤ã®æ¹æ³
.vimrc ã®åè¡ã¨ï¼ããããã®è¡ã®èªã¿è¾¼ã¿ã«ããã£ãæéãåããã®ã§ï¼ãããå ã«ãã¾ã使ã£ã¦ããªãã¦ï¼ãã¤èªã¿è¾¼ã¿ã«æéã® ããã£ã¦ããé¨åãåã£ã¦ããã¾ãï¼
ããã¾ã§ã§ï¼ã¾ãã¯ããã¾ãæç¨ã§ã¯ãªãã®ã«èªã¿è¾¼ã¿ã«æéãããã¦ãã¾ããé¨åãå¹ççã«è¦ã¤ãã¦åãæ¹æ³ã示ãã¾ããï¼ æ¬¡ããã¯ï¼ãã©ã°ã¤ã³ãè¨å®ã®æ©è½ãæãªããã«ãªãã¹ãèµ·åæã®èªã¿è¾¼ã¿æéãæããæ¹æ³ã«ã¤ãã¦ï¼ããå°ãç´°ããé¨å ãè¦ã¦ããã¾ãï¼
autoload 以ä¸ã®é¢æ°ããªãã¹ã使ããªãããã«ãã
Vim ã®é¢æ°ã§ååã« #
ãå
¥ã£ã¦ãããã®ã¯ï¼åãã©ã°ã¤ã³ã® autoload ãã£ã¬ã¯ããªå
ã«å®ç¾©ããã¦ããé¢æ°ã§ãï¼
ä¾ãã°ï¼unite#do_action()
㯠autoload/unite.vim
ãã¡ã¤ã«ã®ä¸ã«å®ç¾©ããã¦ããé¢æ°ã«ãªãã¾ãï¼
autoload 以ä¸ã®ãã¡ã¤ã«ã¯å®éã«é¢æ°ãå¼ã°ãï¼ãã¼ãããå¿
è¦ãçããã¨ãã«åãã¦ãã¼ãããã¾ãï¼
詳ãã㯠:help autoload
ãåç
§ãã¦ã¿ã¦ä¸ããï¼
.vimrc å ã«ããã¦ã autoload 以ä¸ã§å®ç¾©ãããé¢æ°ããªãã¹ãå¼ã³åºããªãããã«ãããã¨ã§ï¼ä½è¨ãª autoload 以ä¸ã®ãã¡ã¤ã« ã®èªã¿è¾¼ã¿ãæ¸ããï¼.vimrc ã®èªã¿è¾¼ã¿é度ãä¸ãããã¨ãã§ãã¾ãï¼
å®éã« VimShell ã§ã®ä¾ãè¦ã¦ã¿ã¾ãï¼ VimShell ã§ã¯ï¼æ¡å¼µåã¨ã³ãã³ããç´ä»ãã¦ãããã¨ãã§ãã¾ãï¼
let g:vimshell_execute_file_list = {} call vimshell#set_execute_file('txt,vim,c,h,cpp,d,xml,java', 'vim')
ã¨ããã¨ï¼ä¾ãã° ./hoge.c
ã¨å®è¡ããã ã㧠vim ã³ãã³ããå®è¡ããã¦ãã®ãã¡ã¤ã«ãéãã¾ãï¼
ãããï¼ãã®è¨å®ã¯ vimshell#set_execute_file()
ãå¼ã³åºãã¦ããããï¼ãã®æç¹ã§ autoload/vimshell.vim ã®èªã¿è¾¼ã¿ãå¿
è¦ã«ãªãã¾ãï¼
ãã®é¢æ°ããã£ã¦ããã®ã¯ï¼åæ¡å¼µåããã¼ã«æã¡ããã«å¯¾å¿ããã³ãã³ããå¤ã«æã¤è¾æ¸ãå¤æ° g:vimshell_execute_file_list
ã«å®ç¾©ãã¦ãã
ã ãã§ãï¼ãã£ã¦ï¼æ¬¡ã®ããã«æ¸ãããããã¨ãã§ãã¾ãï¼
let g:vimshell_execute_file_list = \ { 'txt' : 'vim', 'vim' : 'vim', 'c' : 'vim', 'h' : 'vim', \ 'cpp' : 'vim', 'xml' : 'vim', 'java' : 'vim' }
ããã 㨠'vim'
ã®ç¹°ãè¿ããå¤ããã¦ç
©ãããã¨ãã人㯠for æã使ãã¨ããå°ã綺éºã«æ¸ãã¾ãï¼
let g:vimshell_execute_file_list = {} for ext in split('txt,vim,c,h,cpp,d,xml,java', ',') let g:vimshell_execute_file_list[ext] = 'vim' endfor
vimshell#set_execute_file()
ãå¼ã³åºããªãããã«ãããã¨ã§ï¼Vim èµ·åæã« autoload/vimshell.vim ããã¼ãããã«æ¸ã¿ã¾ãï¼
ãã©ã°ã¤ã³ã®èªã¿è¾¼ã¿èªä½ãé 延ããï¼neobundle.vim ç·¨ï¼
ãã©ã°ã¤ã³ã«ãã£ã¦ã¯ï¼ç¹å®ã®ç¶æ³ä¸ã§ã®ã¿åãçºæ®ãããã®ãããã¾ãï¼ä¾ãã° clang_complete ã¨ãã C++ ã®ã³ã¼ããéç㫠解æãã¦è£å®åè£ãçæãããã©ã°ã¤ã³ã¯ï¼å½ç¶ãªãã C++ ã®ã³ã¼ãã£ã³ã°ããã¦ããã¨ããã使ãã¾ããï¼ ãããã£ããã©ã°ã¤ã³ã常ã«ãã¼ãããå¿ è¦ã¯ããã¾ãããï¼èµ·åæã«ãã¼ãããåã¯ç¡é§ã«ãªã£ã¦ãã¾ãã¾ãï¼
ããã§ï¼ãã©ã°ã¤ã³ããã¼ã¸ã£ã®åãåãã¦ï¼æ¬å½ã«ãã®ãã©ã°ã¤ã³ãå¿ è¦ã«ãªãã¾ã§èªã¿è¾¼ã¿ãé 延ãã¾ãï¼ åã¯ãã©ã°ã¤ã³ç®¡çã« neobundle.vim ã使ã£ã¦ããã®ã§ï¼neobundle.vim ã 使ã£ãå ´åã«ã¤ãã¦æ¸ãã¾ãï¼pathogen ã vundleï¼unbundle ãªã©ã使ã£ãå ´åã§ããã®ãã©ããã¯åãã©ã°ã¤ã³ã®ãã«ããåç §ãã¦ä¸ããï¼
NeoBundleLazy ã® autoload ãªãã·ã§ã³ã使ã (1/3 ã«è¿½è¨)
neobundle.vim ver 3 ãã NeoBundleLazy
ã³ãã³ãã« autoload
ãªãã·ã§ã³ã追å ããã¾ããï¼
ããã«ããï¼ãã©ã°ã¤ã³ã®èªã¿è¾¼ã¿ã¿ã¤ãã³ã°ã
- ç¹å®ã®ãã¡ã¤ã«ã¿ã¤ããèªã¿è¾¼ã¾ããæ
- ç¹å®ã®ã³ãã³ãã使ç¨ããæ
- ç¹å®ã®é¢æ°ãå¼ã°ããæ
- ç¹å®ã®ãããã³ã°ãå®è¡ãããæ
ã®ããããã¾ã§é
延ãããã¨ãåºæ¥ãããã«ãªãã¾ããï¼
以ä¸ã¯ neobundle.vim ã® help ã«æ¸ãã¦ããä¾ã§ãï¼
" ãã¡ã¤ã«ã¿ã¤ãã c ã cpp ã®ãã¡ã¤ã«ãèªã¿è¾¼ãæã« clang_complete ããã¼ããã NeoBundleLazy 'Rip-Rip/clang_complete', { \ 'autoload' : { \ 'filetypes' : ['c', 'cpp'], \ }, \ } " TweetVimHomeTimeline ã³ãã³ãã使ãæã« TweetVim ããã¼ããã NeoBundleLazy 'basyura/TweetVim', { 'depends' : \ ['basyura/twibill.vim', 'tyru/open-browser.vim'], \ 'autoload' : { 'commands' : 'TweetVimHomeTimeline' }} " <Plug>(smartword-w)ï¼<Plug>(smartword-b)ï¼<Plug>(smartword-ge) ã®ããããã®ãããã³ã°ãå®è¡ããæã« vim-smartword ãèªã¿è¾¼ã NeoBundleLazy 'kana/vim-smartword', { 'autoload' : { \ 'mappings' : [ \ '<Plug>(smartword-w)', '<Plug>(smartword-b)', '<Plug>(smartword-ge)'] \ }} " vcs#info() é¢æ°ã Vcs ã³ãã³ããå®è¡ãããã¨ããã¨ãã« vim-vcs ãèªã¿è¾¼ã NeoBundleLazy 'Shougo/vim-vcs', { \ 'depends' : 'thinca/vim-openbuf', \ 'autoload' : {'functions' : 'vcs#info', 'commands' : 'Vcs'}, \ }
詳細ã«ã¤ãã¦ã¯ :help neobundle-options-autoload
ãåç
§ãã¦ã¿ã¦ä¸ããï¼
ç¹å®ã® filetype ã§ã®ã¿èªã¿è¾¼ã
neobundle.vim ãã¼ã¸ã§ã³ 3 ããï¼autoload ãªãã·ã§ã³ã§æå®ã§ããããã«ãªã£ãããï¼ãã®ã»ã¯ã·ã§ã³ã¯ä¸è¦ã«ãªãã¾ãã
å ã»ã©ã® clang_complete ã®ãããªä¾ã§ãï¼NeoBundleLazy ã§ãã©ã°ã¤ã³ç»é²ã ããè¡ãªã£ã¦ããï¼FileType ã¤ãã³ãã§å®é㫠対象ã®ãã¡ã¤ã«ã¿ã¤ãã®ãã¡ã¤ã«ãèªã¿è¾¼ã¾ããæã«åãã¦ãã©ã°ã¤ã³æ¬ä½ãèªã¿è¾¼ãããã«ãã¾ãï¼
åãå®éã«è¨å®ãã¦ãã C++ ã®ä¾ã§ãï¼
" ãã©ã°ã¤ã³ã¨ãã¦ç»é²ãããã ãã§ã¾ã èªã¿è¾¼ã¾ããªã " C++11 対å¿ã·ã³ã¿ãã¯ã¹ãã¡ã¤ã« NeoBundleLazy 'vim-jp/cpp-vim' " clang ã使ã£ãéçã³ã¼ã解æ NeoBundleLazy 'Rip-Rip/clang_complete' " ISO ç´è¿ã®ãã©ãã N3337 ãé²è¦§ããããã® unite ã½ã¼ã¹ NeoBundleLazy 'rhysd/unite-n3337' " ãã¡ã¤ã«ã¿ã¤ãã cpp ãªãã¡ã¤ã«ï¼ï¼ C++ ã½ã¼ã¹ã³ã¼ãï¼ãèªã¿è¾¼ã¾ããã¨ãã«ãã©ã°ã¤ã³ãèªã¿è¾¼ã augroup NeoBundleLazyLoadCpp autocmd! autocmd FileType cpp NeoBundleSource \ cpp-vim \ clang_complete \ unite-n3337 augroup END
gVim ã®ã¿ã§èªã¿è¾¼ã
errormarker.vim ã®ããã« GUI ã§ããæ©è½ããªããã©ã°ã¤ã³ã ã«ã©ã¼ã¹ãã¼ã ã®èªã¿è¾¼ã¿ã¯ CUI ã® Vim ã§ã¯ç¡æå³ã§ãï¼ ä¸è¨ã®ä¾ã§ã¯ï¼GUI ã§ãã使ããªãã«ã©ã¼ã¹ãã¼ã ã gVim èµ·åæã®ã¿èªã¿ããããã«ãã¦ãã¾ãï¼
" .vimrc ã«è¨è¿° NeoBundleLazy 'ujihisa/unite-colorscheme' NeoBundleLazy 'tomasr/molokai' NeoBundleLazy 'altercation/vim-colors-solarized' NeoBundleLazy 'earendel' NeoBundleLazy 'rdark' NeoBundleLazy 'telamon/vim-color-github' " .gvimrc ã«è¨è¿° NeoBundleSource unite-colorscheme \ molokai \ vim-colors-solarized \ earendel \ rdark \ vim-color-github
ç¹å®ã®ã³ãã³ãã使ã£ãæã«åãã¦èªã¿è¾¼ã
neobundle.vim ãã¼ã¸ã§ã³ 3 ããï¼autoload ãªãã·ã§ã³ã§æå®ã§ããããã«ãªã£ãããï¼ãã®ã»ã¯ã·ã§ã³ã¯ä¸è¦ã«ãªãã¾ãã
ç¹å®ã®ãã¡ã¤ã«ã¿ã¤ãã«ä¾åããªãï¼gVim 㨠端æ«å ã® Vim ã®ä¸¡æ¹ã§ä½¿ããã©ã°ã¤ã³ã§ãã£ã¦ãï¼ ã¾ã èªã¿è¾¼ã¿ãé 延ããæ¹æ³ãããã¾ãï¼
ä¾ãã°ï¼VimFiler ã¯ã¨ã¦ã便å©ã§ GUI 㨠CUI ãåããã§ã使ç¨ãã¾ããï¼ãã¡ã¤ã«æä½ããããã¨ãã«ãã使ãã¾ãããï¼ èªã¿è¾¼ã¿ã«çµæ§æéããããã®ãæ°ã«ãªãã¾ãï¼ ãããã£ãå ´åã¯ï¼ã³ãã³ããé¢æ°ã§ã©ãããã¦ãã¾ãï¼æåã«ã³ãã³ããå¼ã°ããæã«ãã©ã°ã¤ã³ããã¼ãããå¦çã追å ããæ¹æ³ãããã¾ãï¼ ãã㯠daisuzu ããã® vimrc ã§å®éã«å®è£ ããã¦ãã¾ãï¼
https://github.com/daisuzu/dotvim/blob/master/.vimrc#L2212
VimFiler ã®ã³ãã³ãã LoadVimFiler()
ã¨ããé¢æ°ã§ã©ãããï¼LoadVimFiler()
å
ã§ã¯ååå¼ã³åºãæã«
VimFiler æ¬ä½ããã¼ãããå¦çãè¡ãªã£ã¦ãã¾ãï¼
ãã©ã°ã¤ã³åã㦠autoload ã«ç§»ã
ãã©ã°ã¤ã³åããã»ã©ã§ããªãæ©è½ã vimrc å
ã«å®è£
ãããã¨ã¯ããããã¾ããï¼ããã«è²ã
ä»ã足ãã¦ãããã¨ã§ã ãã ã
å®è£
ã大ãããªãèªã¿è¾¼ã¿ã«æéãããã£ã¦ããããã«ãªããã¨ãããã¾ãï¼
ãã®é¨åãæãåºãï¼æ°ãããã©ã°ã¤ã³ã® autoload ã«ç§»ãã¦ãã¾ããã¨ã§ï¼ãã®é¨åã®èªã¿è¾¼ã¿ãæãããã¨ãã§ãã¾ãï¼
clever-f.vim ã¯æå㯠vimrc å
ã§
f
ãããã³ã°ãæ¡å¼µããããã«æ¸ããããã®ã§ãããï¼å®è£
ã大ãããªã£ã¦ãã & f
ãå®éã«ä½¿ãã¾ã§ã¯èªã¿è¾¼ã¿ã¯
ä¸è¦ãªã®ã§ãã©ã°ã¤ã³ã¨ãã¦åãåºãï¼é¢æ°ã autoload ã«ç§»ãã¾ããï¼
augroup ã1ã¤ã«çµ±ä¸ãã
ãè¦ããªãè¨å®ãåãé¤ããã®ç« ã§èª¬æããæ¹æ³ã§å®éã« vimrc ã®èªè¾¼ç¶æ³ãçºããæ¹ã¯ãæ°ã¥ããããããªãã§ããï¼
autocmd!
ã¯å°å³ã«æéã®ãããã³ãã³ãã§ãï¼
ãã£ã¦ï¼ä½å㪠augroup
ãä½ããï¼1ã¤ã®ã°ã«ã¼ãã«ã¾ã¨ãããã¨ã§å°ãæ¹åãããã¨ãã§ãã¾ãï¼
ä¾ãã°ï¼æ¬¡ã®ãããªè¨å®ããã£ãå ´åï¼
augroup SettingCpp autocmd! autocmd FileType cpp inoremap <buffer>;; :: augroup END augroup SettingRuby autocmd! autocmd FileType ruby inoremap <buffer><C-s> self. augroup END augroup SettingHaskell autocmd FileType haskell nnoremap <buffer><silent><Leader>ht \ :<C-u>call <SID>ShowTypeHaskell(expand('<cword>'))<CR> function! s:ShowTypeHaskell(word) echo join(split(system("ghc -isrc " . expand('%') . " -e ':t " . a:word . "'"))) endfunction augroup END
ã¨ããï¼ããããã®ãã¡ã¤ã«ã¿ã¤ããã¨ã« augroup ãä½ãã®ã§ã¯ç¡ãï¼
" æåã« vimrc å ¨ä½ã§ä½¿ã augroup ãå®ç¾©ãã¦ãã augroup MyVimrc autocmd! augroup END " ... " FileTypeDetect ã°ã«ã¼ãã«è¿½å ããã autocmd ã¤ãã³ããè¨é² autocmd MyVimrc FileType cpp inoremap <buffer>;; :: autocmd MyVimrc FileType ruby inoremap <buffer><C-s> self. autocmd MyVimrc FileType haskell nnoremap <buffer><silent><Leader>ht \ :<C-u>call <SID>ShowTypeHaskell(expand('<cword>'))<CR> function! s:ShowTypeHaskell(word) echo join(split(system("ghc -isrc " . expand('%') . " -e ':t " . a:word . "'"))) endfunction
ã¨ãããã¨ã«ããï¼autocmd!
ã®åæ°ãæ¸ãããã¨ãã§ãã¾ããï¼
ãã ãï¼autocmd! ã§å¾ã«ã¯ãªã¢ãããã¨ãåæã«èãããã¦ãã augroup ï¼ä¾ãã°å¾ã§åºã¦ãã UniteCustomActions
ï¼
ã§ã¯ã¤ãã³ããã¯ãªã¢ããããã«ã°ã«ã¼ããåããªããã°ãªããªãã®ã¨ï¼augroup ãç¹å®ã® autocmd ã³ãã³ã群ã®ãã¼ã ã¹ãã¼ã¹ã®
ããã«ä½¿ã£ã¦ããå ´åã¯å¯èªæ§ãããä½ä¸ããå ´åãããããï¼å°å
¥ããéã¯ãã®ããããèæ
®ãã¹ãã§ãï¼
æéã®ãããå¦çããªãã¹ãé 延ãã
ãã¾ãåºã使ããæ¹æ³ã§ã¯ç¡ãã§ããï¼æéã®ãããå¦çãç¹å®ã® autocmd ã¤ãã³ããçºçããã¾ã§é
延
ããæ¹æ³ãããã¾ãï¼èãæ¹ã¨ãã¦ã¯ï¼NeoBundleLazy
ã®ã¨ãã¨åãã§ãï¼
unite#custom_action()
ã®å®è¡ãé
延ããä¾ãæãã¾ãï¼
unite#custom_action()
ã¯ç¹å®ã®ç¨®é¡ã®åè£ã«å¯¾ãã¦èªä½ã®ã¢ã¯ã·ã§ã³ã追å ããé¢æ°ã§ãï¼
Mac ã® Finder ã§ãã£ã¬ã¯ããªãéãã¢ã¯ã·ã§ã³ã¯ãããªæã㧠.vimrc å
ã«æ¸ãã¾ãï¼
" Finder action for Mac if has('mac') let finder = { 'description' : 'open with Finder.app' } function! finder.func(candidate) if a:candidate.kind ==# 'directory' call system('open -a Finder '.a:candidate.action__path) endif endfunction call unite#custom_action('directory', 'finder', finder) endif
ãããï¼unite ã¢ã¯ã·ã§ã³ã¯å®éã« unite ã vimfiler ãç«ã¡ä¸ããã¾ã§å¿
è¦ã«ãªãã¾ãããï¼
unite#custom_action()
ã®å®è¡ã«ãçµæ§æéããããã¾ãï¼
ããã§ï¼FileType ã¤ãã³ããå©ç¨ãã¦ï¼å®éã« unite.vim ã vimfiler ãèªã¿è¾¼ã¾ããã¾ã§
ä¸è¨ã®ã³ã¼ããå®è¡ãããªãããã«ãã¾ãï¼
" é 延ãããå¦çãé¢æ°ã¨ãã¦å®ç¾©ãã¦ãã function! s:define_unite_actions() " Finder for Mac if has('mac') let finder = { 'description' : 'open with Finder.app' } function! finder.func(candidate) if a:candidate.kind ==# 'directory' call system('open -a Finder '.a:candidate.action__path) endif endfunction call unite#custom_action('directory', 'finder', finder) endif " ä¸åº¦èªã¿è¾¼ãã¨ãããã®é¢æ°ã¯å¼ã°ãªãã¦è¯ãã®ã§ã¤ãã³ããã¯ãªã¢ãã¦ãã autocmd! UniteCustomActions endfunction " filetype ã unite ã vimfiler ã®ã¨ãã«ã«ã¹ã¿ã ã¢ã¯ã·ã§ã³ãåãã¦å®ç¾©ãã augroup UniteCustomActions autocmd! autocmd FileType unite,vimfiler call <SID>define_unite_actions() augroup END
èªã¿è¾¼ã vimrc ãå¶éãã
ãè¦ããªããã©ã°ã¤ã³ãåãé¤ããã®ç« ã§ç´¹ä»ããæ¹æ³ã§ Vim èµ·åæã®ãã¡ã¤ã«ã®èªã¿è¾¼ã¿ç¶æ³ãçºããæ¹ã¯ãæ°ã¥ããããããªãã§ããï¼ Vim ã¯ããã©ã«ãã§ã·ã¹ãã ã® vimrc ã¨ã¦ã¼ã¶ã® vimrc ã®ä¸¡æ¹ãèªã¿è¾¼ã¿ã¾ãï¼ ããã·ã¹ãã ã®ã»ãã® vimrc ãèªã¿ãã¾ãªãã¦ãè¯ããã°ï¼æ¬¡ã®ãããªã³ãã³ã㧠Vim ãèµ·åãããã¨ã§ï¼èªã¿è¾¼ã vimrc ãã¦ã¼ã¶ã®ãã® ã®ã¿ã«å¶éã§ãã¾ãï¼
vim -u $HOME/.vimrc
ãã ãï¼ã·ã¹ãã ã® vimrc ã®ä¸ã«ãæç¨ãªè¨å®ãããã®ã§ï¼æ¬å½ã«èªã¿è¾¼ã¾ãªãã¦è¯ãã®ãï¼ã¡ããã¨ä¸èº«ã確ããã¦ããã¹ãã§ãï¼
vimrc èªæ¸ä¼ã«åå ãã
lingr ã® Vim é¨å± ã«ã¦ï¼æ¯é±åææ¥ã® 23:00 ãã vimrc èªæ¸ä¼ ãéå¬ããã¦ãã¾ãï¼ æ¯é±èª°ãã® vimrc ãé¡æã«ãã¦ãã¼ã ãã¼ã è¨ãä¼ã§ãï¼ä»ã®äººã® vimrc ã¯ã¨ã¦ãåèã«ãªãã¾ããï¼ Vim ã«è©³ããæ¹ã ãå¤ãåå ããã¦ããã®ã§ï¼è²ã 質åããæ©ä¼ã§ãããã¾ãï¼
ã¾ã¨ã
ä»åã®è¨äºã¯èªåãå®éã«è¡ã£ãæ¹åãå ã«æ¸ããã®ã§ï¼ã©ããããåèã«ãªããã¯åããã¾ãããï¼å°ãã§ã Vim ã®èµ·åé度æ¹åã«è²¢ç®ã§ãããªã幸ãã§ãï¼ æ®æ®µ vimrc ã®è¦ç´ããç¹ã«ããªãã¨ããæ¹ãï¼vimrc ã®æé¤ããã¦ã¿ã¦ã¯ãããã§ããããï¼å¹´æ«ã§ããï¼
åèã¾ã§ã«ä¸è¨ã®æ¹åãè¡ãªããã¨ã«ãã£ã¦ï¼Vim ã®èµ·åæéã¯ä¸è¨ã®ããã«å¤åãã¾ããï¼
- before: 454 ms â after: 364 ms
ææ¥ã®ã¢ããã³ãã«ã¬ã³ãã¼æ å½ã¯ @chikatoike ããã§ãï¼
è足
æ¬å½ã¯ help ã®ãã¼ã¯ã¼ãæå®ã®ã³ããªã©ã® help ã使ãããªã tips ãæ¸ããã¨æã£ã¦ããã®ã§ããï¼ä¸è¨ã®å ´æã«ååã¾ã¨ã¾ã£ãæ å ±ããã£ãã®ã§ããã¾ããï¼ åèã¾ã§ã«ï¼
:help help-context
â help ã®ãã¼ã¯ã¼ãã®æå®ã®ä»æ¹:help index
â help ä¸è¦§- Hack #45: help ãå¼ã
- Hack #199: :helpã«æ £ã親ãã