neosnippet.vim ãæ´»ç¨ããã
ãã®è¨äºã¯ Vim Advent Calendar 2012 320æ¥ç®ã®è¨äºã«ãªãã¾ãã
ãã¦ãä»å㯠neosnippet.vim ã®ä¾¿å©ãããªä½¿ãæ¹ã§ãç°¡åã«æ¸ãã¦ã¿ã¾ãã
[neosnippet.vim ã¨ã¯]
neosnippet.vim ã¨ã¯ Shougo æ°ãä½æãããã¹ããããè£å®ãè¡ãããã®ãã©ã°ã¤ã³ã§ãã
äºãè¨å®ãã¦ãããå®åæãç°¡åã«æ¿å
¥ããäºãã§ãã¾ãã
NeoBundle 'Shougo/neosnippet'
ã¾ããåä½ã§ã使ç¨ããäºã¯å¯è½ã§ãããneocomplete.vim ã¾ã㯠neocomplcache ã¨ä½µç¨ãã¦ä½¿ç¨ããã¨ããã§ãããã
NeoBundle 'Shougo/neocomplete.vim'
[ã¹ãããããå®ç¾©ãã]
neosnippet.vim ã§ä½¿ç¨ã§ããã¹ããããã¯ã¦ã¼ã¶å´ã§å®ç¾©ããäºãã§ãã¾ãã
ã¹ãããããã¡ã¤ã«ã¯ filetype ãã¨ã«è¨å®ã§ãã
NeoSnippetEdit
ã§ãç¾å¨ã® filetype ã®ã¹ãããããã¡ã¤ã«ãç·¨éããäºãã§ãã¾ãã
ä¾ãã°ãVim script ã® if æã¯
snippet if abbr if endif if ${1:condition} ${0} endif
ã®ãããªè¨è¿°ã§å®ç¾©ããäºãã§ãã¾ãã
詳ããã¯ã
:help neosnippet-snippet-syntax
ãåç
§ãã¦ä¸ããã
[Vim script ã®å¼ãåãè¾¼ã]
neosnippet.vim ã®ã¹ããããã§ã¯ `` ã§å²ã£ãæåå㯠Vim script ã®å¼ã¨ãã¦è©ä¾¡ããã¾ãã
ä¾ãã°ã次ã®ãããªå®ç¾©ãããã¨
snippet test `join(range(10), ', ')`
ã¨ãããããã«å±éããã¾ãã
ããã¯æ§ã
ãªãã¨ã«å©ç¨ããäºãã§ãã¾ãã
[ç¾å¨éãã¦ãããã¡ã¤ã«åãå±éãã]
ç¾å¨éãã¦ãããã¡ã¤ã«åãªã©ãå±éãããã¨ãã§ãã¾ãã
snippet filename alias fname `expand("%")` snippet ffilename alias ffname `substitute(expand("%:p"), '\', '/', "g")`
ãã¡ã¤ã«åãªã©ããµãã¨æ¿å
¥ãããå ´åã«ä¾¿å©ã§ããã
[é¢æ°åãå±éãã]
ä»ã®ãã©ã°ã¤ã³ã¨çµã¿åãããã¨æ´ã«å¼·åã§ãã
ä¾ãã°ãcurrent-func-info.vim ã使ç¨ããã°ã«ã¼ã½ã«ä½ç½®å
ã®é¢æ°åãæ¿å
¥ããäºãã§ãã¾ãã
snippet funcname `cfi#get_func_name()`
[plugin ã®ãã³ãã¬ã¼ããå®ç¾©]
ä¸è¨ã®å¿ç¨ã§ãã
Vim ã®ãã©ã°ã¤ã³ã§ plugin ã«ã¹ã¯ãªãããã¡ã¤ã«ãè¨è¿°ããå ´åãããã¦ãã¯æ¬¡ã®ãããªå®åæãåãè¾¼ã¿ã¾ãã
" æåã³ã¼ããè¨å®ããããg:loaded ãä»è¾¼ãã ã etc... scriptencoding utf-8 if exists('g:loaded_marching') finish endif let g:loaded_marching = 1 let s:save_cpo = &cpo set cpo&vim " ... let &cpo = s:save_cpo unlet s:save_cpo
ãããæ¯åæ¸ãã®ã¯ããã©ãã®ã§ neosnippet.vim ã§å®ç¾©ãã¦ããã¨ããã§ãã
snippet plugin abbr plugin scriptencoding utf-8 if exists('g:loaded_`expand("%:t:r")`') finish endif let g:loaded_`expand("%:t:r")` = 1 let s:save_cpo = &cpo set cpo&vim ${0} let &cpo = s:save_cpo unlet s:save_cpo
g:loaded ã®å¤æ°åããã¡ã¤ã«åã§å®ç¾©ãããã§ããã`` ã使ç¨ãã¦åçã«è¨å®ããããã«ãã¦ãã¾ãã
æ¢ã« neosnippet.vim ã§ãçµã¿è¾¼ã¾ãã¦ãã¾ãããautoload é¢æ°ã Cè¨èª,C++ ã®ã¤ã³ã¯ã«ã¼ãã¬ã¼ãã®ããã«ç¾å¨ã®ãã¡ã¤ã«ãã¹ã«ä¾åãããããªå®åæãè¨è¿°ããå ´åã«å¤§å¤æå¹ã§ãã
ã¨ãããäºã§ neosnippet.vim ã®è¨å®ãå¹¾ã¤ãç´¹ä»ãã¦ã¿ã¾ããã
Vim script ã®å¼ãåãè¾¼ããã®ã¯ã ãã¶ä¾¿å©ãªã®ã§ã©ãã©ã使ã£ã¦ã¿ãã¨ããã§ãã