vim配置文件

set nocompatible
"好像能少点bug
set nu
"显示行数
set cursorline
"突出显示当前行
set tabstop=4
"缩进为4个空格
set sw=4
"自动缩进为4个空格
set autoindent
"自动缩进
set cindent
"c语言格式缩进
set mouse=a
"可以使用鼠标
set ls=2
"状态栏
set nobackup
set noswapfile
"禁止生成临时文件
set clipboard+=unnamed 
"共享剪贴板  
color ron
"主题
:inoremap ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}O
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
:inoremap " ""i
:inoremap ' ''i
function! ClosePair(char)
	if getline('.')[col('.') - 1] == a:char
		return "\"
	else
		return a:char
	endif
endfunction
"自动补全
map  :call Run()
func Run()
	exec "w"
	exec "!g++ % -o %< && ./%<"
endf
"F5映射为编译并运行文件
map  :call Gdb()
func Gdb()
	exec "w"
	exec "!g++ % -o %< -g && gdb %< -q"
endf 
"F8映射为编译并用gdb调试文件
map  :call Get()
func Get()
	exec "w"
	exec "!cat %"
endf
"F9映射为把代码搞出来
map  :call Bao()
func Bao()
	exec "w"
endf
"F6映射为保存

你可能感兴趣的:(vim配置文件)