vim配置

” vim默认设置,安装时有的
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
  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
“”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"”"
” 个性化设置
“编码设置
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has(“win32″)
set fileencoding=chinese
else
set fileencoding=utf-8
endif
” 解决菜单乱码
“source $VIMRUNTIME/delmenu.vim
“source $VIMRUNTIME/menu.vim
“解决输出乱码
language messages zh_CN,utf-8
“NERDTree设置,将NERDTree映射到F8
let NERDTreeWinPos = “left” 
nmap <F8> <ESC>:NERDTreeToggle<RETURN>
“语法高亮设置
syntax on 
“设置每一次backspace删除4个空格
set tabstop=4
“设定<< 和 >> 移动宽度
set softtabstop=4
set smarttab
set history=1024
“自动切换当前目录为当前文件所在目录
set autochdir
“隐藏菜单
if has(“gui_running”)
set guioptions-=m
set guioptions-=T
set guioptions-=L
set guioptions-=r
set guioptions-=b
set showtabline=0
endif
“窗口切换
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
“将phpmanual整合入vim
” 在vim里输入  :set runtimepath=D:/phpmanual
” 打开doc/tags文件 输入 %sort
autocmd BufNewfile,Bufread *.ros,*.inc,*.php set keywordprg=”help”
“取消自动备份
set nobackup   ” 设置自动备份路径 set backupdir=~/.vim/backup
“vim 字体、颜色设置
set gfn=Tlwg\ Typist\ 16
“设置默认配色方案
“colorscheme desert
“vim设置默认开启时窗口大小
set lines=50 columns=130
” 搜索到文件两端时不重新搜索
set nowrapscan
” 设置状态栏(左边)
set number
” 设置taglist
if has(‘win32′)
let Tlist_Ctags_Cmd = ‘ctags’
else
let Tlist_Ctags_Cmd = ‘/usr/bin/ctags’
endif
let Tlist_Show_One_File = 1  “只显示当前文件的tag
let Tlist_Exit_OnlyWindow = 1 “如果taglist窗口是最后一个窗口,退出vim
let Tlist_Use_Right_Window = 1 “在窗口右侧显示tags
map <silent> <F9> :TlistToggle<cr> “将taglist快捷键映射为F9
使用:
NERDTree:F8进行打开或关闭,:Bookmark mark_name 添加书签,shift+B打开书签列表
NERD_commenter:\cc进行注释,\c+space去注释
buffer_explorer:\be 出已在buffer的文件列表
其它东拼西凑了些,都瞎找的,不知道哪了
posted @ 2012-07-14 21:58  X海阳  阅读(136)  评论(0编辑  收藏  举报