我的vimrc配置

觉得我现在的vim配置用起来不错

特意在这份想出来,也便于以后自己需要时使用

配置如下:

syntax on
colo evening  
  
set nocompatible  
set backspace=indent,eol,start  
set number  
set background=dark  
set ruler  
set showcmd  
set noswapfile  
set autoread  
set nobackup  
set shiftwidth=4  
set tabstop=4  
set softtabstop=4  
set expandtab  
set smarttab  
set mouse=a  
set pastetoggle=<F3>  
  
hi Normal  ctermfg=252 ctermbg=none  
  
filetype plugin indent on  

inoremap ( ()<ESC>i//设置自动补全
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
  
autocmd filetype c set makeprg=gcc\ -Wall\ -o%<\ %  
autocmd filetype cppset makeprg=g++\ -Wall\ -o%<\ %  
autocmd filetype javaset makeprg=javac\ %  
autocmd filetype pythonset makeprg=python\ %  
  
func! CompileCode()  
    exec "w"  
    exec "make"  
    exec "copen"  
endfunc  
  
func! ExecutePro()  
    if &filetype == 'c'   
        exec "!./%<"  
    endif  
  
    if &filetype == 'cpp'   
        exec "!./%<"  
    endif  
  
    if &filetype == 'java'   
        exec "!java %<"  
    endif  
  
    exec "cclose"  
endfunc  

map <F2> :call SetTitle()<CR>
func SetTitle()
    let l = 0
    let l = l + 1 | call setline(l,'/* ***********************************************')
    let l = l + 1 | call setline(l,'Author        :yinhua')
    let l = l + 1 | call setline(l,'Created Time  :'.strftime('%c'))
    let l = l + 1 | call setline(l,'File Name     :'.expand('%'))
    let l = l + 1 | call setline(l,'************************************************ */')
    let l = l + 1 | call setline(l,'')

    let l = l + 1 | call setline(l,'#include <cmath>')
    let l = l + 1 | call setline(l,'#include <cstdio>')
    let l = l + 1 | call setline(l,'#include <string>')
    let l = l + 1 | call setline(l,'#include <cstring>')
    let l = l + 1 | call setline(l,'#include <iostream>')
    let l = l + 1 | call setline(l,'#include <algorithm>')
    let l = l + 1 | call setline(l,'using namespace std;')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'int main() {')
    let l = l + 1 | call setline(l,'    ')
    let l = l + 1 | call setline(l,'    return 0;')
    let l = l + 1 | call setline(l,'}')
endfunc
  
map  <F9> :call CompileCode()<CR>  
map! <F9> <ESC>:call CompileCode()<CR>  
  
map  <F12> :call ExecutePro()<CR>  
map! <F12> <ESC>:call ExecutePro()<CR>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值