vimrc 我的專屬vim配置

來源:互聯網
上載者:User

標籤:hls   lis   bst   open   form   -o   enable   run   tle   

  1 set nu  2 set wrap  3 set tabstop=4  4 set softtabstop=4  5 set shiftwidth=4  6 syntax on  7 filetype on        "開啟vim檔案類型自動檢測功能  8 set autoindent  9 set smartindent 10 set scrolloff=10 11 set ruler  12 set hlsearch 13 set history=100 14  15 "set foldenable 16 "set foldmethod=indent 17 "set foldcolumn=0 18 "set foldlevel=3 19  20 autocmd InsertLeave * se nocul 21 autocmd InsertEnter * se cul  22 autocmd BufNewFile *.cpp,*.c exec ":call SetTitle()" 23 func SetTitle() 24     call setline(1,"/* I can do all things */") 25     call append(line("."),"/*") 26     call append(line(".")+1,"File Name: ".expand("%")) 27     call append(line(".")+2,"Create Time: ".strftime("%c")) 28     call append(line(".")+3,"Description:") 29     call append(line(".")+4,"*/") 30     if &filetype==‘cpp‘ 31         call append(line(".")+5,"#include<iostream>") 32         call append(line(".")+6,"using namespace std;") 33         call append(line(".")+7,"") 34     endif 35     if &filetype==‘c‘ 36         call append(line(".")+5,"#include<stdio.h>") 37         call append(line(".")+6,"") 38     endif 39 endfunc 40 autocmd BufNewFile * normal G 41  42 let Tlist_Sort_Type="name" 43 let Tlist_Use_Left_Window=1 44 let Tlist_Compart_Format=1 45 let Tlist_Exist_OnlyWindow=1    "若只有一個BUFFER kill掉視窗  46  47  48 let Tlist_Auto_Open=0 49 set tags=tags; 50 set autochdir 51 let Tlist_Show_One_File=1 52 let Tlsit_Exit_OnlyWindow=1 53 let Tlist_WinWidth=20 54 map <silent> <F8> :TlistToggle<CR> 55  56 func! CompileGcc() 57     exec "w" 58     let compilecmd="!gcc " 59     let compileflag="-o %< " 60     if search("mpi\.h") != 0 61         let compilecmd = "!mpicc " 62     endif 63     if search("glut\.h") != 0 64         let compileflag .=" -lglut -lGLU -lGL " 65     endif 66     if search("cv\.h") != 0 67         let cpmpileflag .= " -lcv -lhighgui -lcvaux " 68     endif 69     if search("omp\.h") != 0 70         let compileflag .= " -fopenmp " 71     endif 72     if search("math\.h") != 0 73         let compileflag .= " -lm " 74     endif 75     exec compilecmd." % ".compileflag 76 endfunc 77  78 func! CompileGpp() 79     exec "w" 80     let compilecmd="!g++" 81     let compileflag="-o %< " 82     if search("mpi\.h") != 0 83         let compilecmd = "!mpic++ " 84     endif 85     if search("glut\.h") != 0 86         let compileflag .=" -lglut -lGLU -lGL " 87     endif 88     if search("cv\.h") != 0 89         let cpmpileflag .= " -lcv -lhighgui -lcvaux " 90     endif 91     if search("omp\.h") != 0 92         let compileflag .= " -fopenmp " 93     endif 94     if search("math.\h") != 0 95         let compileflag .=" -lm " 96     endif 97     exec compilecmd." % ".compileflag 98 endfunc 99 100 func! CompileCode()101     exec "w"102     if &filetype == "cpp"103         exec "call CompileGpp()"104     elseif &filetype == "c"105         exec "call CompileGcc()"106     endif107 endfunc108 109 func! RunResult()110     exec "w"111     if &filetype == "cpp"112         exec "call CompileGpp()"113         exec "! ./%<"114     endif115     if &filetype == "c"116         exec "call CompileGcc()"117         exec "! ./%<"118     endif119 endfunc120 121 map <F6> :call RunResult()<CR>122 123 124 map <F5> :call CompileCode()<CR>125 imap <F5> <ESC>:call CompileCode()<CR>126 vmap <F5> <ESC>:call CompileCode()<CR>

 

vimrc 我的專屬vim配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.