微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的Vim(Gvim) 配置

大家都很强, 可与之共勉。

因为暂时用不到Linux,所以先用Gvim凑合一下。

我的配置

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set ai
set cin
set ruler
set number
set mouse=a
set showcmd
set hlsearch
set incsearch
set tabstop=4
set smartindent
set shiftwidth=4
set softtabstop=4

imap jj <ESC>
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap " ""<ESC>i "inoremap < <><ESC>i
inoremap { {}<ESC>i<CR><ESC>O

winpos 5 5
set lines=60
set columns=232

color desert
set guifont=Courier_new:h16:b:cDEFAULT

Syntax on

nmap <C-A> ggVG
vmap <C-C> "+y filetype plugin indent on autocmd FileType cpp set cindent autocmd FileType cpp map <F3> : !start vim %<.in autocmd FileType cpp map <F4> : !start vim %<.out autocmd FileType cpp map <F5> : ! time ./%< <CR> autocmd FileType cpp map <F8> : ! time ./%< < %<.in <CR> autocmd FileType cpp map <F9> : w <CR> : ! g++ % -o %< -g -Wall -Wextra -Wconversion && size %< <CR> autocmd FileType cpp map <C-F9> : w <CR> : ! g++ % -o %< -O2 && size %< <CR> autocmd FileType cpp map <F10> : ! gdb %< --silent <CR> 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐