我的VIM配置

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"                                                           "
"       以下是我自己的配置2013.9.29     _____Mori_Miya         "
"                                                           "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"set nu!
	
"代码补全 
"set completeopt=preview,menu

colorscheme desert			"字体颜色主题

set guifont=Courier_New:h10:cANSI   " 设置字体  

"set background=dark "背景使用黑色 

" 选中状态下 Ctrl+c 复制

vmap <C-c> "+y

"去空行  

nnoremap <F2> :g/^\s*$/d<CR> 

map <C-F3> \be  

"C,C++ 按F5编译运行

map <F5> :call CompileRunGcc()<CR>

func! CompileRunGcc()

    exec "w"

    if &filetype == 'c'

        exec "!g++ % -o %<"

        exec "! ./%<"

    elseif &filetype == 'cpp'

        exec "!g++ % -o %<"

        exec "! ./%<"

    elseif &filetype == 'java' 

        exec "!javac %" 

        exec "!java %<"

    elseif &filetype == 'sh'

        :!./%

    endif

endfunc

"C,C++的调试

map <F8> :call Rungdb()<CR>

func! Rungdb()

    exec "w"

    exec "!g++ % -g -o %<"

    exec "!gdb ./%<"

endfunc


"共享剪贴板  

set clipboard+=unnamed 

" 语法高亮

set syntax=on

" 去掉输入错误的提示声音

"set noeb

" 在处理未保存或只读文件的时候,弹出确认

set confirm

" 自动缩进

set autoindent

set cindent

" Tab键的宽度

set tabstop=4

" 统一缩进为4

set softtabstop=4

set shiftwidth=4

" 不要用空格代替制表符

set noexpandtab

" 在行和段开始处使用制表符

set smarttab

" 显示行号

set number

"禁止生成临时文件

set nobackup

set noswapfile

"搜索逐字符高亮

set hlsearch

set incsearch

" 带有如下符号的单词不要被换行分割

set iskeyword+=_,$,@,%,#,-

" 使回格键(backspace)正常处理indent, eol, start等

set backspace=2

" 允许backspace和光标键跨越行边界

set whichwrap+=<,>,h,l

" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)

set mouse=a

set selection=exclusive

set selectmode=mouse,key

" 高亮显示匹配的括号

set showmatch

" 匹配括号高亮的时间(单位是十分之一秒)

set matchtime=1

" 为C程序提供自动缩进

set smartindent

"自动补全

:inoremap ( ()<ESC>i

:inoremap ) <c-r>=ClosePair(')')<CR>

:inoremap { {<CR>}<ESC>O

:inoremap } <c-r>=ClosePair('}')<CR>

:inoremap [ []<ESC>i

:inoremap ] <c-r>=ClosePair(']')<CR>

":inoremap " ""<ESC>i

":inoremap ' ''<ESC>i

function! ClosePair(char)

    if getline('.')[col('.') - 1] == a:char

        return "\<Right>"

    else

        return a:char

    endif

endfunction

filetype plugin indent on 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值