Created
September 3, 2012 12:22
-
-
Save qickstarter/3608941 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"------------------------------------ | |
" t_comment | |
"------------------------------------ | |
" let g:tcommentMapLeader1 = "<C-_>""{{{ | |
" mappingを消費するので、段々デフォルトになれるべし。 | |
" nmap <Leader>x <C-_><C-_> | |
" nmap <Leader>b <C-_>p | |
" vmap <Leader>x <C-_><C-_> | |
if !exists('g:tcomment_types') | |
let g:tcomment_types = {} | |
endif | |
let g:tcomment_types = { | |
\'php_surround' : "<?php %s ?>", | |
\'eruby_surround' : "<%% %s %%>", | |
\'eruby_surround_minus' : "<%% %s -%%>", | |
\'eruby_surround_equality' : "<%%= %s %%>", | |
\'eruby_block' : "<%%=begin rdoc%s=end%%>", | |
\'eruby_nodoc_block' : "<%%=begin%s=end%%>" | |
\} | |
"{{{ | |
function! SetErubyMapping2() | |
nmap <buffer> <C-_>c :TCommentAs eruby_surround<CR><Right><Right><Right> | |
nmap <buffer> <C-_><C-C> :TCommentAs eruby_surround<CR><Right><Right><Right> | |
nmap <buffer> <C-_>- :TCommentAs eruby_surround_minus<CR><Right><Right><Right> | |
nmap <buffer> <C-_>= :TCommentAs eruby_surround_equality<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-_>d :TCommentAs eruby_block<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-_>n :TCommentAs eruby_nodoc_block<CR><Right><Right><Right><Right> | |
imap <buffer> <C-_>c <% %><ESC><Left><Left>i | |
imap <buffer> <C-_><C-C> <% %><ESC><Left><Left>i | |
imap <buffer> <C-_>- <% -%><ESC><Left><Left><Left>i | |
imap <buffer> <C-_>= <%= %><ESC><Left><Left>i | |
imap <buffer> <C-_>d <%= begin rdoc =end %><ESC><Left><Left>i | |
imap <buffer> <C-_>n <%= begin =end %><ESC><Left><Left>i | |
vmap <buffer> <C-_>c :TCommentAs eruby_surround<CR> | |
vmap <buffer> <C-_><C-C> :TCommentAs eruby_surround<CR> | |
vmap <buffer> <C-_>- :TCommentAs eruby_surround_minus<CR> | |
vmap <buffer> <C-_>= :TCommentAs eruby_surround_equality<CR> | |
nmap <buffer> <C-j>c :TCommentAs eruby_surround<CR><Right><Right><Right> | |
nmap <buffer> <C-j><C-C> :TCommentAs eruby_surround<CR><Right><Right><Right> | |
nmap <buffer> <C-j>- :TCommentAs eruby_surround_minus<CR><Right><Right><Right> | |
nmap <buffer> <C-j>= :TCommentAs eruby_surround_equality<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-j>d :TCommentAs eruby_block<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-j>n :TCommentAs eruby_nodoc_block<CR><Right><Right><Right><Right> | |
imap <buffer> <C-j>c <% %><ESC><Left><Left>i | |
imap <buffer> <C-j><C-C> <% %><ESC><Left><Left>i | |
imap <buffer> <C-j>- <% -%><ESC><Left><Left><Left>i | |
imap <buffer> <C-j>= <%= %><ESC><Left><Left>i | |
imap <buffer> <C-j>d <%= begin rdoc =end %><ESC><Left><Left>i | |
imap <buffer> <C-j>n <%= begin =end %><ESC><Left><Left>i | |
vmap <buffer> <C-j>c :TCommentAs eruby_surround<CR> | |
vmap <buffer> <C-j><C-C> :TCommentAs eruby_surround<CR> | |
vmap <buffer> <C-j>- :TCommentAs eruby_surround_minus<CR> | |
vmap <buffer> <C-j>= :TCommentAs eruby_surround_equality<CR> | |
endfunction | |
function! SetRubyMapping() | |
nmap <buffer> <C-j>b :TCommentAs ruby_block<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-j>n :TCommentAs ruby_nodoc_block<CR><Right><Right><Right><Right> | |
imap <buffer> <C-j>b <%= begin rdoc =end %><ESC><Left><Left>i | |
imap <buffer> <C-j>n <%= begin =end %><ESC><Left><Left>i | |
nmap <buffer> <C-_>b :TCommentAs ruby_block<CR><Right><Right><Right><Right> | |
nmap <buffer> <C-_>n :TCommentAs ruby_nodoc_block<CR><Right><Right><Right><Right> | |
imap <buffer> <C-_>b <%= begin rdoc =end %><ESC><Left><Left>i | |
imap <buffer> <C-_>n <%= begin =end %><ESC><Left><Left>i | |
endfunction | |
"}}} | |
au FileType eruby call SetErubyMapping2() | |
au FileType ruby,ruby.rspec call SetRubyMapping() | |
au FileType php nmap <buffer><C-_>c :TCommentAs php_surround<CR><Right><Right><Right> | |
au FileType php vmap <buffer><C-_>c :TCommentAs php_surround<CR><Right><Right><Right> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment