vim配置

colorscheme desert
set guifont=Consolas:h11
set tabstop=4
set expandtab
set shiftwidth=4
set nowrap

set noswapfile
set nobackup
set noundofile

set nohlsearch
set incsearch

set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set nu
set guioptions-=T
set cindent
set tags=tags;
set autochdir
syntax enable
set nocompatible
set history=100
set confirm
set clipboard+=unnamed
filetype on
filetype indent on
syntax on
set backspace=2
set whichwrap+=<,>,h,l
set shortmess=atI
set report=0
set noerrorbells
set showmatch

map <F5> :call CompileRunGcc()<CR>

func! CompileRunGcc()
    exec "w" 
    if &filetype == 'c' 
        exec '!gcc % -o %<'
''linux
        exec '!time ./%<'
''windows
        exec '!%<.exe'
    elseif &filetype == 'cpp'
        exec '!g++ % -o %<'
''linux
        exec '!time ./%<'
''windows
        exec '!%<.exe'
    elseif &filetype == 'python'
        exec '!python %'
    elseif &filetype == 'sh'
        :!bash %
    endif                                                                              
endfunc 
posted @ 2019-08-12 17:19  明黄  阅读(123)  评论(0编辑  收藏  举报