- ããã¯ä½ï¼
-
,cã§é¸æè¡(orç¾å¨è¡)ã®ã³ã¡ã³ãã¢ã¦ãããã°ã«ããvimã¹ã¯ãªããã§ã
2009/6/11追è¨
åºæ¬çã«ãNERD_commenterã®ä¸ä½äºæã§ã
vimscriptã®ç·´ç¿ç¨ã«æ¸ãããã®ã§ãããã®ã§ãæ¶ããã«æ®ãã¦ããã¾ãããNERD_commenterã®ä½¿ç¨ãæ¨å¥¨ãã¾ã
- 使ãæ¹
-
ãããªå ´åã«ãä¸ã®2è¡ãé¸æãã¦ã,c ã§
123 456
ãããªé¢¨ã«ã³ã¡ã³ãã¢ã¦ãããã¾ã(ä¾ã¯rubyã®å ´å)# 123 # 456
ããä¸åº¦ã,cãæ¼ãã°ãã³ã¡ã³ãã解é¤ããã¾ã
- NERD_commenterã¨ã©ãéãã®ï¼
è¡ã³ã¡ã³ãããã°ã«ãã¾ã(NERD_commenterã¯/* */)
2009/6/11追è¨ï¼NERD_commenterãè¡ã³ã¡ã³ã対å¿ãã¦ã¾ããâ¦ã
ãã¨ãããã©ã«ãã§NERD_commenterããµãã¼ããã¦ãªããã¡ã¤ã«ã¿ã¤ãã主ã«æ±ã£ã¦ã¾ã
(ä»ã®ã¨ãããprel,ruby,sh,yami,javascript,htmlã«å¯¾å¿ãã¦ã¾ã)
2009/6/11追è¨ï¼ãã£ã¡ããNERD_commenterã®ã§ãã.vimrcã«ä»¥ä¸ã®è¨å®ã§å¯¾å¿å¯è½(HTML,XMLã®å ´å)
:autocmd Filetype xml,html set commentstring=<!--%s-->
- ã½ã¼ã¹
.vimrcã®ä¸çªä¸ã«ã§ãã³ãããã¦ãã ãã
"--------------------------------------------------------------------- " ã³ã¡ã³ããã°ã« {{{ " å ãã¿ï¼http://d.hatena.ne.jp/cooldaemon/20070126/1169795080 "--------------------------------------------------------------------- nmap ,c <Plug>CommentOut nnoremap <Plug>CommentOut :<C-u>call CommentOut()<Return> vmap ,c <Plug>CommentOutV vnoremap <Plug>CommentOutV :call CommentOut()<Return> function! CommentOut() " comment type # if &l:filetype ==# 'perl' || &l:filetype ==# 'ruby' || &l:filetype ==# 'sh' || &l:filetype ==# 'yaml' if getline('.') =~ '^\s*#' s/^\(\s*\)#\+ \?/\1/ else s/^\s*/\0# / endif " comment type // elseif &l:filetype ==# 'javascript' if getline('.') =~ '^\s*\/\/' s/^\(\s*\)\/\/\+ \?/\1/ else s/^\s*/\0\/\/ / endif " comment type " elseif &l:filetype ==# 'vim' if getline('.') =~ '^\s*"' s/^\(\s*\)"\+ \?/\1/ else s/^\s*/\0" / endif " comment type <!-- - -> elseif &l:filetype ==# 'html' || &l:filetype ==# 'xhtml' || &l:filetype ==# 'tt2html' if getline('.') =~ '<!--.*-->' s/^\(\s*\)<!--\s\(.*\)\s-->/\1\2/ else s/^\(\s*\)\(.*\)$/\1<!-- \2 -->/ endif " other else if getline('.') =~ '^\s*\/\/' s/^\(\s*\)\/\/\+ \?/\1/ else s/^\s*/\0\/\/ / endif endif :nohlsearch endf "}}}
è¬è¾
以ä¸ã®ãµã¤ããåèã«ä½æãã¾ãããæè¬!