标签:mrc 全选 选项 run c++ 配置文件 main 文件 log
PS:F7编译 F9运行 F8调用GDB F12形成初始文件头(C++)(都在NORMAL模式下)
Ctrl+A 全选加复制(NORMAL模式下)
Ctrl+Z 自动缩进(NORMAL模式下)
编译选项加了 -std=c++11 -O2
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = ‘-a --binary ‘
if &diffopt =~ ‘icase‘ | let opt = opt . ‘-i ‘ | endif
if &diffopt =~ ‘iwhite‘ | let opt = opt . ‘-b ‘ | endif
let arg1 = v:fname_in
if arg1 =~ ‘ ‘ | let arg1 = ‘"‘ . arg1 . ‘"‘ | endif
let arg2 = v:fname_new
if arg2 =~ ‘ ‘ | let arg2 = ‘"‘ . arg2 . ‘"‘ | endif
let arg3 = v:fname_out
if arg3 =~ ‘ ‘ | let arg3 = ‘"‘ . arg3 . ‘"‘ | endif
let eq = ‘‘
if $VIMRUNTIME =~ ‘ ‘
if &sh =~ ‘\<cmd‘
let cmd = ‘""‘ . $VIMRUNTIME . ‘\diff"‘
let eq = ‘"‘
else
let cmd = substitute($VIMRUNTIME, ‘ ‘, ‘" ‘, ‘‘) . ‘\diff"‘
endif
else
let cmd = $VIMRUNTIME . ‘\diff‘
endif
silent execute ‘!‘ . cmd . ‘ ‘ . opt . arg1 . ‘ ‘ . arg2 . ‘ > ‘ . arg3 . eq
endfunction
syntax on
set nu
set nobackup
set noswapfile
set cindent
set mouse=a
set tabstop=8
set shiftwidth=8
set background=dark
colorscheme evening
set guifont=courier_new:h10
map <C-A> ggVG"+y
map <C-Z> gg=G
map <F7> :call Cmp()<CR>
func! Cmp()
exec "w"
exec "!g++ -O2 -std=c++11 % -o %<"
endfunc
map <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ -Wall -O2 -std=c++11 % -g -o %<"
exec "!gdb ./%<"
endfunc
map <F9> :call Run()<CR>
func! Run()
exec "!%<"
endfunc
map <F12> :call SetTitle()<CR>
func SetTitle()
let l = 0
let l = l + 1 | call setline(l,‘#include <bits/stdc++.h>‘)
let l = l + 1 | call setline(l,‘‘)
let l = l + 1 | call setline(l,‘using namespace std;‘)
let l = l + 1 | call setline(l,‘‘)
let l = l + 1 | call setline(l,‘#define rep(i, a, b) for (int i(a); i <= (b); ++i)‘)
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,‘‘)
let l = l + 1 | call setline(l,‘‘)
let l = l + 1 | call setline(l,‘ return 0;‘)
let l = l + 1 | call setline(l,‘}‘)
let l = l + 1 | call setline(l,‘‘)
let l = l + 1 | call setline(l,‘‘)
endfunc
标签:mrc 全选 选项 run c++ 配置文件 main 文件 log
原文地址:http://www.cnblogs.com/cxhscst2/p/6675412.html