• vimrc 我的专属vim配置


      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     endif
    107 endfunc
    108 
    109 func! RunResult()
    110     exec "w"
    111     if &filetype == "cpp"
    112         exec "call CompileGpp()"
    113         exec "! ./%<"
    114     endif
    115     if &filetype == "c"
    116         exec "call CompileGcc()"
    117         exec "! ./%<"
    118     endif
    119 endfunc
    120 
    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>
  • 相关阅读:
    ios代码大全
    MYSQL数据库之如何在已经建立好表之后重构数据表
    关于cookie在一个页面设置但是在另外一个页面获取不到的原因
    cookie的那点事儿
    关于a标签不能调用js方法的小细节,你注意到了么?
    关于mysql预处理技术的一点小心得
    关于delete使用limit的一些注意事项
    DP1 等分连续1-N个数的划分种数
    Spring 编程式事务和声明式事务管理
    java https client信任所有证书
  • 原文地址:https://www.cnblogs.com/pertinencec/p/6741432.html
Copyright © 2020-2023  润新知