vim配置【自用】

syntax on
set nu
set mouse=a

set ci
set si
set ai

set ts=4
set sw=4
set sts=4
set noexpandtab

imap jj <ESC>
imap ww <ESC>:w<CR>

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 == 'python'
        exec '!time python %'
    elseif &filetype == 'sh'
        :!time bash %
    endif                                                                              
endfunc 
posted @ 2021-05-12 21:09  牟翔宇  阅读(44)  评论(0编辑  收藏  举报