http://blog.sina.com.cn/s/blog_73ca27ba0100r1u3.html
更换了注释插件NER_commenter,函数出错找不到解决办法,于是更换为插件EnhancedCommentify
-----------------------------------------------------------------
折腾了四天终于把 vim差不多搞定了 实现了目录,函数跳转,注释和php自动缩进,自动补全。有待日后完后
vimrc代码如下:
" 设置leader为,
let mapleader=","
let g:mapleader=","
set nocompatible
syntax on
set mouse=a
filetype plugin indent on
set number
set nocursorline
set shiftwidth=4
set softtabstop=4
set tabstop=4
set nobackup
set autochdir
set backupcopy=yes
set ignorecase smartcase
set nowrapscan
set incsearch
set hlsearch
set noerrorbells
set novisualbell
set t_vb=
" set showmatch
" set matchtime=2
" set nowrap
set magic
set hidden
set smartindent
set cindent
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
set backspace=indent,eol,start " 不设定在插入状态无法用退格键和 Delete 键删除回车符
set cmdheight=1
set laststatus=2
set foldenable
set foldmethod=syntax
set foldcolumn=0
setlocal foldlevel=1
" set foldclose=all
" colorscheme colorzone
colorscheme default
" 设置在状态行显示的信息
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ [%{(&fenc==""?&enc:&fenc).(&bomb?",BOM":"")}]\ %c:%l/%L%)\
" 显示Tab符
:.,extends:>,precedes:<
set listset listchars=tab:>-
"设置代码折叠方式为 手工indent
set foldmethod=indent
"设置代码块折叠后显示的行数
set foldexpr=1
if has("gui_running")
endif
"启动后自动最大化
if has("win32")
endif
" vim 支持中文
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set guifont=NSimSun:h8
set helplang=cn
set ambiwidth=double
"php缩进
let PHP_autoformatcomment=1
"-------------------------------------------------------
"快捷键
" 全文搜索选中的文字。选中后
:vmap <silent> <leader>f y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
:vmap <silent> <leader>F y?<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
" 删除所有行未尾空格。快捷键f12
nmap <F12> :%s/[ \t\r]\+$//g<CR>
" Buffers操作快捷方式!切换文件 shirt+l.shift+h
nmap <S-L> :bnext<CR>
nmap <S-H> :bprevious<CR>
"切换窗口。ctrl+w+whjkl
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"nmap <C-w> <C-w>w
" 插入模式下左右移动光标
"imap <c-l> <esc>la
"imap <c-h> <esc>ha
" 选中状态下复制
vmap <C-c> "+y
"映射转换语法。快捷键:html:,1
nmap <leader>1 :set filetype=xhtml<CR>
nmap <leader>2 :set filetype=css<CR>
nmap <leader>3 :set filetype=javascript<CR>
nmap <leader>4 :set filetype=php<CR>
nmap <leader>5 :set filetype=default<CR>
" php语法进行检测 ctrl+p启动
map <C-P> :!/php/php/bin/php -l %<CR>
" php启动帮助 快捷键普通模式下K
autocmd BufNewFile,Bufread *.ros,*.inc,*.php set keywordprg="help
"快速保存。 ,wq保存并退出说有
nmap <leader>wq :wqa<cr>
nmap <leader>qq :qa!<cr>
nmap <leader>w :w!<cr>
"粘帖模式开启和关闭
:set pastetoggle=<F4>
"-------------------------------------------------------
"不同文件类型的缩进
au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java,php setl shiftwidth=4
au FileType java,php setl tabstop=4
set completeopt=longest,menu
"-----------------------------------------------------------------
" plugin - Mark.vim 给各种tags标记不同的颜色,便于观看调式的插件。
"
"
"
nmap <silent> <leader>hl <Plug>MarkSet
nmap <silent> <leader>hh <Plug>MarkClear
nmap <silent> <leader>hr <Plug>MarkRegex
vmap <silent> <leader>hl <Plug>MarkSet
vmap <silent> <leader>hh <Plug>MarkClear
vmap <silent> <leader>hr <Plug>MarkRegex
" 你可以在高亮文本上使用“,#”或“,*”来上索高亮文本。在使用了“,#”或“,*
" ”后,就可以直接输入“#”或“*”来继续查找该高亮文本,直到你又用“#”或“
" *”查找了其它文本。
"-----------------------------------------------------------------
" plugin - EnhCommentify.vim
"
"
nmap <silent> <F3> ,x
vmap <silent> <F3> ,x
imap <silent> <F3> ,x
let g:EnhCommentifyUseSyntax = 'Yes'
let g:EnhCommentifyMultiPartBl
let g:EnhCommentifyAlignRight = 'yes'
" let g:EnhCommentifyRespectInde
let g:EnhCommentifyPretty = 'Yes'
"-----------------------------------------------------------------
" plugin - NERD_tree.vim 以树状方式浏览系统中的文件和目录
" :ERDtree 打开NERD_tree
" NERDTree
map <F10> :NERDTreeToggle<CR>
" o 打开关闭文件或者目录
" T 在后台标签页中打开
" p 到上层目录
" K 到第一个节点
" u 打开上层目录
" r 递归刷新当前目录
"-----------------------------------------------------------------
" plugin - NeoComplCache.vim
" 自动补全结合supertab插件使用tab补全或者ctrl+n
" imap <C-t> <C-x><C-o>
let g:neocomplcache_enable_at_startup = 1 " Use smartcase.
let g:neocomplcache_enable_smart_case = 1 " Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1 " Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:NeoComplCache_DictionaryFileTypeLists = {'default' : '','php' :'/usr/share/vim/vim70/dict/php.dict'}
" imap <silent><C-T> <Plug>(neocomplcache_snippets_expand)
" smap <silent><C-T> <Plug>(neocomplcache_snippets_expand)
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
>->-let g:neocomplcache_keyword_patterns = {}
endif
>->-let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
"-----------------------------------------------------------------
" plugin -supertab
" tab键自动补全
let g:SuperTabDefaultCompletio
"-----------------------------------------------------------------
" plugin - bufexplorer.vim Buffers切换
" <F8>打开文件列表窗口(上下方式)
map <F8> <leader>bs
" ,be 全屏方式查看全部打开的文件列表
" ,bv 左右方式查看
" 切换Buffers的操作快捷方式: shirt+l.shift+h
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowRelativeP
let g:bufExplorerSortBy='mru'
let g:bufExplorerSplitRight=0
let g:bufExplorerSplitBelow=0
"-----------------------------------------------------------------
" plugin - Tlist相关设置
" <F9>开启和关闭
map <F9> :TlistToggle<cr>
let Tlist_Auto_Highlight_Tag = 1
let Tlist_Auto_Open = 0let Tlist_Auto_Update = 1
let Tlist_Close_On_Select = 0
let Tlist_Compact_Format = 0
let Tlist_Display_Prototype = 0
let Tlist_Display_Tag_Scope = 1
let Tlist_Enable_Fold_Column = 0
let Tlist_Exit_OnlyWindow = 1
let Tlist_File_Fold_Auto_Close = 0
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Inc_Winwidth = 0
let Tlist_Max_Submenu_Items = 1
let Tlist_Max_Tag_Length = 30
let Tlist_Process_File_Always = 0
let Tlist_Show_Menu = 0
let Tlist_Show_One_File = 0
let Tlist_Sort_Type = "order"
let Tlist_Use_Horiz_Window = 0
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 20
let tlist_php_settings = 'php;c:class;i:interfaces;d:constant;f:function'
"-----------------------------------------------------------------
"折叠设置
set diffexpr=MyDiff()
function! MyDiff()
endfunction
所安装的插件列表如下:
omnicppcomplete-0.41.zip:实现自动补全 Tab键或者ctrl+l
vim-php-manual.tar.gz : php函数文档
supertab.vba: 实现tab键补全
taglist_45.zip: 生成右侧的函数列表
NERD_tree.zip : vim界面左侧目录树
mattn-zencoding-vim-88d8991.zip :生成html
//NERD_commenter.vim
EnhancedCommentify 注释插件
php的字典文件
mark.vba.gz 标记
javascript.zip
css.vim
php.vim(PHP-correct-Indenting 最新修订的php缩进vim)
等