• 我的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 
    
  • 相关阅读:
    事务处理多数据库的方法
    微信定位js
    linux命令大全
    git团队协作
    springboot入门的一点基础
    Spring Boot Actutaur + Telegraf + InFluxDB + Grafana 构建监控平台
    Hadoop+HBase+ZooKeeper三者关系与安装配置
    Centos7网络配置-转载
    【Java EE 学习 21 下】【 使用易宝支付接口实现java网上支付功能】
    linux 中 iptables关于ping的问题
  • 原文地址:https://www.cnblogs.com/gdxzq/p/13301009.html
Copyright © 2020-2023  润新知