vim配置

完整版

set nu
set ls=2
set sw=4
set ts=4
set ai
set cin
color ron
set t_Co=256
set mouse=a
set nobackup
set noswapfile
set mp=g++\ -o\ %<\ %\ -Ddebug\ -Dlocal\ -O2\ -std=c++11\ -w
func! M()
	exec "w"
	exec "make"
	exec "cw"
endf
func! R()
	exec "w"
	if &filetype=='cpp'
		exec "!g++ -o %< % && time ./%<"
	elseif &filetype=='python'
		exec "!python3 %"
	endif
endf
func! G()
	exec "w"
	exec "!g++ -o %< % -g && gdb ./%< -q"
endf
func! T()
	exec "w"
	exec "!g++ -o %< % -O2 -ftrapv && time ./%<"
endf
func! S()
	exec "w"
	exec "!g++ -o %< % && size %< | awk 'NR==2{print $3}' | numfmt --to=iec"
endf
func! P()
	exec "w"
	exec "!cat %"
endf
map <F5> :call R() <CR>
map <F7> :call M() <CR>
map <F6> :call T() <CR>
map <F8> :call G() <CR>
map <F9> :call S() <CR>
map <F12> :call P()<CR>
map <C-F10> :!gedit % &<CR>

map! <F5> <esc> :call R() <CR>
map! <F6> <esc> :call T() <CR>
map! <F7> <esc> :call M() <CR>
map! <F8> <esc> :call G() <CR>
map! <F9> <esc> :call S()<CR>
map! <F12> <esc>:call P()<CR>
map! <C-F10> <esc>:!gedit % &<CR>


map <c-up> <c-y>
map <c-down> <c-e>
imap <c-up> <esc><c-y>a
imap <c-down> <esc><c-e>a

考试精简版

set nu
set ls=2
set sw=4
set ts=4
set ai
set cin
color ron
set t_Co=256
set mouse=a
set nobackup
set noswapfile
func! R()
	exec "w"
	exec "!g++ -o %< % && time ./%<"
endf
func! G()
	exec "w"
	exec "!g++ -o %< % -g && gdb ./%< -q"
endf
func! T()
	exec "w"
	exec "!g++ -o %< % -O2 -ftrapv && time ./%<"
endf
func! S()
	exec "w"
	exec "!g++ -o %< % && size %< | awk 'NR==2{print $3}' | numfmt --to=iec"
endf
map <F5> <esc> :call R() <CR>
map <F6> <esc> :call T() <CR>
map <F8> <esc> :call G() <CR>
map <F9> :call S() <CR>

map! <F5> <esc> :call R() <CR>
map! <F8> <esc> :call G() <CR>
map! <F6> <esc> :call T() <CR>
map! <F9> <esc> :call S()<CR>
posted @ 2020-07-26 16:30  hyskr  阅读(403)  评论(0编辑  收藏  举报