• 我的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垂直居中如何实现
    MUI顶部导航布局
    MUI底部导航栏切换效果
    Jsonp跨域问题
    【已解决】项目加载失败,Web应用程序项目XX已配置为使用IIS
    获取网站绝对路径
    css图片上加文字
    c#界面卡死处理方法
    BeginInvoke异步线程
    menustrip选项怎么设置竖向分割线
  • 原文地址:https://www.cnblogs.com/gdxzq/p/13301009.html
Copyright © 2020-2023  润新知