Skip to content

Instantly share code, notes, and snippets.

@bootleq
Created December 23, 2010 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootleq/753121 to your computer and use it in GitHub Desktop.
Save bootleq/753121 to your computer and use it in GitHub Desktop.
按 <LocalLeader>cc 就能 toggle comment 的設定(使用 tComment plugin)
"「關閉這功能。我也忘記是幹嘛的了,既然如此,大概用不太到吧」
let g:tcommentMapLeaderOp1 = ''
let g:tcommentMapLeaderOp2 = ''
"「這個只要加在 vimrc 就能控制 comment 要不要縮排了!」——料理東西軍
let g:tc_option = ' col=1'
noremap <silent> <expr> <LocalLeader>cc ":TComment " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>cb ":TCommentBlock " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>ci ":TCommentInline " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>c$ ":TCommentRight " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
let g:EnhCommentifyRespectIndent = 'No'
let g:EnhCommentifyUseSyntax = 'Yes'
let g:EnhCommentifyPretty = 'Yes'
let g:EnhCommentifyBindInInsert = 'No'
let g:EnhCommentifyMultiPartBlocks = 'Yes'
let g:EnhCommentifyCommentsOp = 'Yes'
let g:EnhCommentifyAlignRight = 'Yes'
" 為各別 filetype 分別設定 tc_option ……
fun! s:js_rc()
let b:tc_option = ''
endf
fun! s:haml_rc()
let b:tc_option = ''
endf
fun! s:ruby_rc()
let b:tc_option = ''
endf
au FileType ruby :call s:ruby_rc()
au FileType haml :call s:haml_rc()
au FileType javascript :call s:js_rc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment