coreBugZJ

此 blog 已弃。

我喜欢的 VIM 配置

喜欢用 VIM  快一年了,这里把自己喜欢的配置分享出来,也免得我每次安装,都要复制配置文件。


这是我 Win7 下 gVim 的配置,Linux下略有区别。


:colorscheme elflord
set nocompatible
"set guioptions-=m
set mouse=a
set guioptions-=T
"set lines=50 columns=150

set number
set numberwidth=6
set autoindent
set smartindent
set cindent
set cmdheight=2

set shiftwidth=8
set tabstop=8
set softtabstop=8
set expandtab
set smarttab

"set cursorline
"set cursorcolumn

set guifont=Consolas:h14
"set guifontwide=

set ruler
set showcmd
set showmode

"set encoding=utf-8
"set fileencoding=utf-8
"set fileencodings=utf-8
"set termencoding=utf-8
"set ambiwidth=double

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


可以在这里下载,去掉扩展名即可用于 gVim 。

/Files/coreBugZJ/_vimrc.txt 

posted on 2011-03-16 15:28 coreBugZJ 阅读(1720) 评论(2)  编辑 收藏 引用 所属分类: LinuxEditor

Feedback

# re: 我喜欢的 VIM 配置 2011-03-20 11:10 mirguest

>source $VIMRUNTIME/mswin.vim
楼主竟然用了这个。
貌似这样子,像ctrl+x,ctrl+v就被覆盖了。  回复  更多评论   

# re: 我喜欢的 VIM 配置 2011-03-20 19:08 coreBugZJ

@mirguest
额。。。  回复  更多评论   



只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理