原帖由 BBCC 于 2009-3-3 19:12 发表
vim也来了...支持一下...最好能贴下如何配置自己的vimrc嘛...
帖一个网上Vim高手配置的_vimrc文件配置(出处:http://fayaa.com/code/view/5/):
set nocompatible
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
if &sh =~ '\<cmd'
silent execute '!""C:\Program Files\Vim\vim71\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"'
else
silent execute '!C:\Program" Files\Vim\vim71\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endif
endfunction
set cursorline
set shiftwidth=4
set sts=4
set tabstop=4
set expandtab
set nonu
set nobackup
set guioptions-=T
set guioptions-=m
set guifont=Consolas:h12
"set guifont=Bitstream_Vera_Sans_Mono:h10
"set guifont=Lucida_Console:h10
set langmenu=none
language messages en_us
let $LANG='zh'
"set fileencodings=utf-8,GBK
set fileencoding=utf8
set encoding=utf8
set tenc=utf8
set ut=200
"colorscheme desert
colorscheme wombat
map <leader><leader> \be
map <leader>Enter \vt
map C-Enter C-Tab
let g:Tlist_Use_Right_Window=1
let g:Tlist_Auto_Open=1
let g:Tlist_Show_One_File=1
let g:Tlist_Compact_Format=1
let g:Tlist_Enable_Fold_Column=0
let g:treeExplVertical=1
let g:treeExplWinSize=30
let mapleader = '\'
set iskeyword+=.
set ambiwidth=double
set ignorecase smartcase
set so=7
au GUIEnter * simalt ~x
python << EOF
import time
import vim
def SetBreakpoint():
nLine = int( vim.eval( 'line(".")'))
strLine = vim.current.line
i = 0
strWhite = ""
while strLine == ' ' or strLine == "\t":
i += 1
strWhite += strLine
vim.current.buffer.append(
"%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" %
{'space':strWhite, 'mark': '#' * 30}, nLine - 1)
for strLine in vim.current.buffer:
if strLine == "import pdb":
break
else:
vim.current.buffer.append( 'import pdb', 0)
vim.command( 'normal j1')
break
vim.command( 'map <C-F7> :py SetBreakpoint()<cr>')
def RemoveBreakpoints():
nCurrentLine = int( vim.eval( 'line(".")'))
nLines = []
nLine = 1
for strLine in vim.current.buffer:
if strLine == 'import pdb' or strLine.lstrip()[:15] == 'pdb.set_trace()':
nLines.append( nLine)
nLine += 1
nLines.reverse()
for nLine in nLines:
vim.command( 'normal %dG' % nLine)
vim.command( 'normal dd')
if nLine < nCurrentLine:
nCurrentLine -= 1
vim.command( 'normal %dG' % nCurrentLine)
vim.command( 'map <C-F8> :py RemoveBreakpoints()<cr>')
vim.command( 'map <C-D> :!python %<cr>')
EOF
"Set some bindings up for 'compile' of python
"au BufNewFile,BufRead *.py :set makeprg=python\ %
"au BufNewFile,BufRead *.py :set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
"au BufNewFile,BufRead *.py nmap <buffer> <F8> :up!<cr>:make<cr>
"au BufNewFile,BufRead *.py vmap <buffer> <F8> :<c-u>up!<cr>:make<cr>
"au BufNewFile,BufRead *.py nmap <buffer> <F12> :cl<cr>
再上传一个这位高手已经配置好了的Vim 7.1(出处:http://www.2maomao.com/blog/vim-7-pack-configured/,下载地址:http://www.2maomao.com/files/Vim.7z)
插件列表:- a.vim : 同目录cpp/c与对应的.h文件之间切换,根据文件名
- bufexplorer.vim : 用来切换buffer,修改过,改动了启动方式
- comments.vim : 注释插件,在正常模式cm即可注释一行,v模式选中之后cm注释很多行,cu取消
- matchit.vim : 对映大中小括号,#if等等等之间用%跳转
- supertab.vim : 插入模式Tab补齐,Ctrl+N毕竟比较烦
- tabswitch.vim : 我写的,使用以后可以ctrl+hjkl,在窗口之间跳转,用Ctrl+Tab可以切换buffer
- taglist.vim : 显示多个tag的方式,修改过,现在针对一个文件显示比较简洁
- vtreeexplorer.vim : 显示文件系统树
复制代码 针对性的vimrc文件设置:- set cursorline " 当前光标所在行会有阴影
-
- "tab转空格的一坨设置
- set shiftwidth=4
- set sts=4
- set tabstop=4
- set expandtab
-
- set nonu " 不要行号
- set nobackup " 不要备份
- set guioptions-=T " 不要工具条
- set guifont=Bitstream_Vera_Sans_Mono:h10 " Bitstream字体
-
- set ut=200 " 更新时间200毫秒,针对taglist插件
-
- let mapleader = '\' " leader用反斜杠\
- map <leader><leader> \be " 双反斜杠\\即可打开bufexplorer
- map C-Enter C-Tab " Ctrl+Enter也可以切换buffer
-
- "Taglist插件的一坨设置
- let g:Tlist_Use_Right_Window=1
- let g:Tlist_Auto_Open=1
- let g:Tlist_Show_One_File=1
- let g:Tlist_Compact_Format=1
- let g:Tlist_Enable_Fold_Column=0
-
- "Tree explorer的一坨设置
- let g:treeExplVertical=1
- let g:treeExplWinSize=30
-
- "gvim打开以后最大化
- au GUIEnter * simalt ~x
-
- "smartcase,这样搜索时默认不区分大小写,只有搜索关键字中出现一个大字母时才区分大小写
- set ignorecase smartcase
- "光标在窗口上下边界时距离边界7行即开始滚屏
- set so=7
复制代码
|