Vim ã® help ã¯é常 modeline ãªã©ã«ãã£ã¦é²è¦§ã«æé©ãªããã«ãªãã·ã§ã³ãè¨å®ãããããããç·¨éãããæã«ã¯å°ããã¨ããããã¨ããããã§å ¨ã¦ã® Vim ãã©ã°ã¤ã³ä½è *1ã¯ä»¥ä¸ã®ãããªè¨å®ãå ¥ããã¨ããã¨æããï¼
" after/ftplugin/help.vim if &l:buftype !=# 'help' setlocal list tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab textwidth=78 if exists('+colorcolumn') setlocal colorcolumn=+1 endif if has('conceal') setlocal conceallevel=0 endif endif
以前もちらっと書いたã®ã ãã©ã'buftype' ã®å¤ãè¦ã¦ç·¨éä¸ãªã®ã :help ã§é²è¦§ä¸ãªã®ãå¤æããã
æ®æ®µ :help ã§è¦ããã«ããã¡ã¤ã«ãç´æ¥ç·¨éããå ´åãä¸åº¦ã§ã :help ã§éãã¦ããã 'buftype' ãè¨å®ããã¦ãã¾ãç¹ã«æ³¨æãç§ã®å ´åã¯ãããã普段使う用と開発用で別の場所にプラグインを置いているã®ã§åé¡ã«ãªããªãã
ã¡ãªã¿ã« 'colorcolumn' éè¦ãå人çã«ã¯ããã¯ç¢ºå®ã«è¨å®ãã¦æ¬²ãããè¨å®ãããä»ã¾ã§æ¸ãã help è¦ç´ãã¦ã¿ãã¹ãã
ã¤ãã§ã«ãããã¾ã以前名前だけちらっと出したç§ã使ã£ã¦ãç®æ¬¡çæã³ãã³ããæãã¦ãããããã 'buftype' ã 'help' ã®ã¨ãã ãå®ç¾©ãã¦ã¾ãã:GenerateContents ã§ç®æ¬¡ãçæ/æ´æ°ã
command! -buffer -bar GenerateContents call s:generate_contents() function! s:generate_contents() let cursor = getpos('.') let plug_name = expand('%:t:r') let ja = expand('%:e') ==? 'jax' 1 if search(plug_name . '-contents\*$', 'W') silent .+1;/^=\{78}$/-1 delete _ .-1 put ='' else /^License:/+1 let header = printf('%s%s*%s-contents*', (ja ? "ç®æ¬¡\t" : 'CONTENTS'), \ repeat("\t", 5), plug_name) silent put =['', repeat('=', 78), header] .+1 endif let contents_pos = getpos('.') let lines = [] while search('^\([=-]\)\1\{77}$', 'W') let head = getline('.') =~ '=' ? '' : ' ' .+1 let caption = matchlist(getline('.'), '^\([^\t]*\)\t\+\*\(\S*\)\*$') if !empty(caption) let [title, tag] = caption[1 : 2] call add(lines, printf("%s%s\t%s|%s|", head, title, head, tag)) endif endwhile call setpos('.', contents_pos) silent put =lines + ['', ''] call setpos('.', contents_pos) let len = len(lines) setlocal expandtab tabstop=32 execute '.,.+' . len . 'retab' setlocal noexpandtab tabstop=8 execute '.,.+' . len . 'retab!' call setpos('.', cursor) endfunction
å®å ¨ã«å人åããªã®ã§ãã©ã°ã¤ã³ã¨ãã«ããäºå®ã¯ãªããã
*1:å ¨ã¦ã® Vim ãã©ã°ã¤ã³ä½è 㯠help ãæ¸ãã¨ããåæã«åºãã¦ãã¾ã