Cpp_src.vim

vim c++ 语言配置文件


C++是我使用时间最长的语言,我以为它的vim配置文件会很长的得意,但是仔细看了一下,好像没多少敲打

"The TitleSet Part**************************
map 
   
   
    
     : call SetTitle()
    
    
     
     
func! SetTitle()
	if &filetype=='cpp'
		call SetCppTitle()
	endif
endfunc

func! SetCppTitle()
	let l = 0 
	let l = l + 1 | call setline(l,"/*****************************************************************") 
	let l = l + 1 | call setline(l,"    > File Name: ".expand("%"))	 
	let l = l + 1 | call setline(l,"    > Author: Uncle_Sugar")
	let l = l + 1 | call setline(l,"    > Mail: uncle_sugar@qq.com")								  
	let l = l + 1 | call setline(l,"    > Created Time: ".strftime("%c"))
	let l = l + 1 | call setline(l,"*****************************************************************/") 
	let l = l + 1 | call setline(l,"# include 
     
     
      
      ")
	let l = l + 1 | call setline(l,"# include 
      
      
       
       ")
	let l = l + 1 | call setline(l,"# include 
       
       
         ") let l = l + 1 | call setline(l,"# include 
        
          ") let l = l + 1 | call setline(l,"# include 
         
           ") let l = l + 1 | call setline(l,"# include 
          
            ") let l = l + 1 | call setline(l,"# include 
           
             ") let l = l + 1 | call setline(l,"# include 
            
              ") let l = l + 1 | call setline(l,"# include 
             
               ") let l = l + 1 | call setline(l,"# include 
              ") let l = l + 1 | call setline(l,"# include 
               
                 ") let l = l + 1 | call setline(l,"# include 
                
                  ") let l = l + 1 | call setline(l,"# include 
                 
                   ") let l = l + 1 | call setline(l,"# include 
                  
                    ") let l = l + 1 | call setline(l,"using namespace std;") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"# ifdef ONLINE_JUDGE ") let l = l + 1 | call setline(l,"struct QuickIO{") let l = l + 1 | call setline(l," QuickIO(){const int SZ = 1<<20;") let l = l + 1 | call setline(l," setvbuf(stdin ,new char[SZ],_IOFBF,SZ);") let l = l + 1 | call setline(l," setvbuf(stdout,new char[SZ],_IOFBF,SZ);") let l = l + 1 | call setline(l," } //*From programcaicai*//") let l = l + 1 | call setline(l,"}QIO;") let l = l + 1 | call setline(l,"# endif") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"const int debug = 1;") let l = l + 1 | call setline(l,"const int size = 5000 + 10; ") let l = l + 1 | call setline(l,"const int INF = INT_MAX>>1;") let l = l + 1 | call setline(l,"typedef long long ll;") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"int main()") let l = l + 1 | call setline(l,"{") let l = l + 1 | call setline(l," std::ios::sync_with_stdio(false);cin.tie(0);") let l = l + 1 | call setline(l," int i,j;") | call cursor(l,0) let l = l + 1 | call setline(l," return 0;") let l = l + 1 | call setline(l,"}") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"") let l = l + 1 | call setline(l,"") endfunc "The Compile&Run Part*********************** "Compile&Run map 
                   
                     :call CompileRunGpp() 
                    
                      imap 
                      
                      
                        :call CompileRunGpp() 
                       
                         vmap 
                         
                         
                           :call CompileRunGpp() 
                          
                            func! CompileRunGpp() exec "w" if &filetype=='cpp' exec " !g++ -c './%\' -o './%<.o' " exec " !g++ -o './%<' './%<.o' " exec " !xterm -T './%<' -e /usr/bin/cb_console_runner \"./%<\" " endif endfunc "Only Compile map 
                           
                             :call Compile() 
                            
                              imap 
                              
                              
                                :call Compile() 
                               
                                 func! Compile() exec "w" if &filetype=='cpp' exec " !g++ -c './%\' -o './%<.o' " exec " !g++ -o './%<' './%<.o' " endif endfunc "Only Run map 
                                
                                  :call RunResult() 
                                 
                                   imap 
                                   
                                   
                                     :call RunResult() 
                                    
                                      func! RunResult() if &filetype=='cpp' exec "! ./%< < ~/VimIO/%.cppin > ~/VimIO/%.cppout " endif endfunc "The input Window**************************** map 
                                     
                                       :call OpenInputWindow() 
                                      
                                        imap 
                                        
                                         
                                         
                                           li func! OpenInputWindow() exec "! gedit ~/VimIO/%.cppin " endfunc "The IO Window*************************** nmap 
                                          
                                            :call OpenIOWIn() 
                                           
                                             func! OpenIOWIn() exec "vsplit ~/VimIO/%.cppin " exec "wincmd L" exec "split %<.cppout " exec "resize 20" exec "vertical resize 40" exec "wincmd h" endfunc map 
                                            
                                              :call AddAnnot() 
                                             
                                               imap 
                                               
                                                
                                                
                                                  i func! AddAnnot() let str = getline(line(".")) if -1 != match(str, '^\s*//') exec "norm ^xx" else exec "norm I// \ 
                                                 
                                                   " endif endfunc "Make brace pair vnoremap { dk$a{ 
                                                  
                                                    o} 
                                                   
                                                     kpk$%k$ vnoremap [ di[ 
                                                    
                                                      pi] 
                                                     
                                                       vnoremap ( di( 
                                                      
                                                        pi) 
                                                       
                                                         vnoremap < di< 
                                                        
                                                          pi> 
                                                         
                                                           "vnoremap " di" 
                                                          
                                                            pi" 
                                                           
                                                             vnoremap ' di' 
                                                            
                                                              pi' 
                                                             
                                                               " Test Part "function! AutoPair(open, close) " let line = getline('.') " if col('.') > strlen(line) || line[col('.') - 1] == ' ' " return a:open.a:close."\ 
                                                              
                                                                i" " else " return a:open " endif "endf " "function! ClosePair(open,close) " let line = getline('.') " if getline('.')[col('.') - 1] == a:char " return "\ 
                                                               
                                                                 " " else " return a:char " endif "endf " "function! SamePair(char) " let line = getline('.') " if col('.') > strlen(line) || line[col('.') - 1] == ' ' " return a:char.a:char."\ 
                                                                
                                                                  i" " elseif line[col('.') - 1] == a:char " return "\ 
                                                                 
                                                                   " " else " return a:char " endif "endf " "inoremap ( 
                                                                  
                                                                    =AutoPair('(', ')') 
                                                                   
                                                                     "inoremap ) 
                                                                    
                                                                      =ClosePair('(', ')') 
                                                                     
                                                                       "inoremap { 
                                                                      
                                                                        =AutoPair('{', '}') 
                                                                       
                                                                         "inoremap } 
                                                                        
                                                                          =ClosePair('{', '}') 
                                                                         
                                                                           "inoremap [ 
                                                                          
                                                                            =AutoPair('[', ']') 
                                                                           
                                                                             "inoremap ] 
                                                                            
                                                                              =ClosePair('[',]') 
                                                                             
                                                                               "inoremap " 
                                                                              
                                                                                =SamePair('"') 
                                                                               
                                                                                 "inoremap ' 
                                                                                
                                                                                  =SamePair("'") 
                                                                                 
                                                                                   "inoremap ` 
                                                                                  
                                                                                    =SamePair('`') 
                                                                                   
                                                                                     "map 
                                                                                    
                                                                                      :call AddTab() 
                                                                                     
                                                                                       "func AddTa() " exec normal ^I" "endfunc "let l = getline(line(".")) 
                                                                                      
                                                                                     
                                                                                    
                                                                                   
                                                                                  
                                                                                 
                                                                                
                                                                               
                                                                              
                                                                             
                                                                            
                                                                           
                                                                          
                                                                         
                                                                        
                                                                       
                                                                      
                                                                     
                                                                    
                                                                   
                                                                  
                                                                 
                                                                
                                                               
                                                              
                                                             
                                                            
                                                           
                                                          
                                                         
                                                        
                                                       
                                                      
                                                     
                                                    
                                                   
                                                  
                                                 
                                                
                                               
                                              
                                             
                                            
                                           
                                          
                                         
                                        
                                       
                                      
                                     
                                    
                                   
                                  
                                 
                                
                               
                              
                             
                            
                           
                          
                         
                        
                       
                      
                     
                    
                   
                  
                 
                
              
             
            
           
          
         
       
      
      
     
     
    
    
   
   

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值