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 
    
  • 相关阅读:
    CSS效果:CSS实用技巧制作三角形以及箭头效果
    JS之this应用详解
    JS之iscroll.js的使用详解
    一个测试人员眼中的创业团队七宗罪
    一个WEB应用的开发流程
    一个年薪一百万的程序员:技术进阶之路
    一个十年IT从业者的职场感言:为什么不要自称是“程序员”
    一位程序员工作10年总结的13个忠告,却让很多人惋惜
    当个好的测试经理不容易,懂得这些很重要
    测试经理岗位职责及应具备的能力
  • 原文地址:https://www.cnblogs.com/gdxzq/p/13301009.html
Copyright © 2011-2022 走看看