zoukankan      html  css  js  c++  java
  • 我的vim配置

    set autoindent
    set shiftwidth=4
    set softtabstop=4
    set number
    set relativenumber
    set cursorline
    set showmatch
    set hlsearch
    set spell spelllang=en_us
    set undofile
    set visualbell
    set autoread
    syntax on
    set showmode
    set mouse=a
    let g:ycm_seed_identifiers_with_syntax = 1
    filetype plugin on
    map <F5> :call CompileRunGcc()<CR>
    func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
    	exec "!g++ % -o %<"
    	exec "!time ./%<"
        elseif &filetype == 'cpp'
        exec "!g++ % -o %<"
        exec "!time ./%<"
    	elseif &filetype == 'java' 
    	exec "!javac %" 
    	exec "!time java %<"
        elseif &filetype == 'sh'
        :!time bash %
    	elseif &filetype == 'python'
    	exec "!time python2.7 %"
        elseif &filetype == 'html'
        exec "!firefox % &"
        elseif &filetype == 'go'
    	exec "!go build %<"
    	exec "!time go run %"
    	elseif &filetype == 'mkd'
    	exec "!~/.vim/markdown.pl % > %.html &"
    	exec "!firefox %.html &"
    	endif
    	endfunc
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    """""新文件标题
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "新建.c,.h,.sh,.java文件,自动插入文件头 
    autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
    ""定义函数SetTitle,自动插入文件头 
    func SetTitle() 
    	"如果文件类型为.sh文件 
    	if &filetype == 'sh' 
    		call setline(1,"#########################################################################") 
    		call append(line("."), "# File Name: ".expand("%")) 
    		call append(line(".")+1, "# Author: gdx") 
    		call append(line(".")+2, "# mail: 1437672807@qq.com") 
    		call append(line(".")+3, "# Created Time: ".strftime("%c")) 
    		call append(line(".")+4, "#########################################################################") 
    		call append(line(".")+5, "#!/bin/bash") 
    		call append(line(".")+6, "") 
    	else 
    		call setline(1, "/*************************************************************************") 
    		call append(line("."), "	> File Name: ".expand("%")) 
    		call append(line(".")+1, "	> Author: gdx") 
    		call append(line(".")+2, "	> Mail: 1437672807@qq.com ") 
    		call append(line(".")+3, "	> Created Time: ".strftime("%c")) 
    		call append(line(".")+4, " ************************************************************************/") 
    		call append(line(".")+5, "")
    	endif
    	if &filetype == 'cpp'
    		call append(line(".")+6, "#include<bits/stdc++.h>")
    		call append(line(".")+7, "using namespace std;")
    		call append(line(".")+8, "int main(){")
    		call append(line(".")+9, "    ")
    		call append(line(".")+10, "    return 0;")
    		call append(line(".")+11, "}")
    	endif
    	if &filetype == 'c'
    		call append(line(".")+6, "#include<stdio.h>")
    		call append(line(".")+7, "")
    	endif
    	"	if &filetype == 'java'
    	"		call append(line(".")+6,"public class ".expand("%"))
    	"		call append(line(".")+7,"")
    	"	endif
    	"新建文件后,自动定位到文件末尾
    	autocmd BufNewFile * normal G
    endfunc 
    
  • 相关阅读:
    病毒分裂(分治)
    【CQYZ-vijos】P1333 舞伴的搭配(贪心算法)
    算法系列之图--拓扑排序
    算法系列之图--DFS
    算法系列之图--BFS
    python读取txt里的json文件,存到excel,例子2
    python读取txt里的json文件,存到excel,例子1
    python读取excel数据做分类统计
    python datetime中timedelta的用法
    bootstrap用法小计
  • 原文地址:https://www.cnblogs.com/gdxzq/p/13301009.html
Copyright © 2011-2022 走看看