PHP   发布时间:2022-04-09  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了PHP工程师VIM配置分享大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

关于我的vim配置

经常在服务器上写代码,@L_675_1@朋友提供了关于他的vim配置,在此分享给大家。

界面效果图:

PHP工程师VIM配置分享

.vimrc

内容如下

PHP;">
"=========================================================================
set nocompatible       " be iMproved,required
filetype off         " required

" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" let Vundle manage Vundle,required
Plugin 'gmarik/Vundle.vim'

" plugin on GitHub repo
Plugin 'shawncplus/PHPcomplete.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/syntastic'
Plugin 'vim-scripts/DoxygenToolkit.vim'
Plugin 'scrooloose/nerdcommenter'

Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'

" Optional:
Plugin 'honza/vim-snippets'

" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'vim-scripts/bufexplorer.zip'
Plugin 'vim-scripts/cscope.vim'
Plugin 'vim-scripts/taglist.vim'

" Plugin 'vim-scripts/winmanager'
" Plugin 'vim-scripts/project.tar.gz'

call vundle#end()

" Brief Help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append ! to update or just :Pluginupdate
" :PluginSearch foo - searches for foo; append ! to refresh local cache
" :PluginClean - confirms removal of unused plugins; append ! to auto-approve removal

filetype plugin on " required

Syntax on " 自动语法高亮
set number " 显示行号
set cursorline " 突出显示当前行
" set ruler " 打开状态栏标尺
set shiftwidth=4 " 设定 << 和 >> 命令移动时的宽度为 4
set tabstop=4 expandtab " 设定 tab 长度为 4 个空格
set noBACkup " 覆盖文件时不备份
" set autochdir " 自动切换当前目录为当前文件所在的目录
set BACkupcopy=yes " 设置备份时的行为为覆盖
set ignorecase smartcase " 搜索时忽略大小写,但在有@L_675_1@或以上大写字母时仍保持对大小写敏感
set Nowrapscan " 禁止搜索文件两端时重新搜索
" set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch " 搜索时高亮显示被找到的文本
set noerrorbells " 关闭错误信息响铃
set novisualbell " 关闭使用可视响铃代替呼叫
set t_vb= " 置空错误铃声的终端代码
set magic " 设置魔术
set hidden " 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单
set smarTindent " 开启新行时使用智能自动缩进
set BACkspace=indent,eol,start " 不设在插入状态无法用退格键和 delete 键删除回车符
set cmdheight=1 " 设定命令行的行数为 1
set laststatus=2 " 显示状态栏 (认值为 1,无法显示状态栏)
set statusline=\ %<%F[%1%M%%n%r%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ " 设置在状态行显示的信息
set errorformat=%m\ in\ %f\ on\ line\ %l
set autoindent
set softtabstop=4 " 使得按退格键时可以一次删掉 4 个空格

colorscheR_318_11845@e moloKai
set t_Co=256

"-----------------------------------------------------------------
" 获取当前系统类型
"------------------------------------------------------------------
function! MySys()
if has("win16") || has("win32") || has("win64") || has("win95")
return "windows"
elseif has("unix")
return "linux"
endif
endfunction

" 用户目录变量$VIMFILES
if MySys() == "windows"
let $VIMFILES = $VIm.'/vimfiles'
set BACkupdir=D://Vim/tmp
elseif MySys() == "linux"
let $VIMFILES = $HOME.'/.vim'
set BACkupdir=/tmp
endif

" 设置字体 以及中文支持
if has("win32")
set guifont=Inconsolata:h12:cANSI
endif

" 配置多语言环境
if has("multi_byte")
" UTF-8 编码
set encoding=utf-8
set termencoding=utf-8
set formatoptions+=mM
set fencs=utf-8,gbk

if v:lang =~? '^(zh)|(ja)|(ko)'
set ambiwidth=double
endif

if has("win32")
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
endif
else
echoerr "Sorry,this version of (g)vim was not compiled with +multi_byte"
endif

" 光标到上方窗口,需要k,非常麻烦,现在重映射为
nnoremap h
nnoremap j
nnoremap k
nnoremap l

"一些不错的映射转换语法(如果在@L_675_1@文件中混合了不同语言时有用)
nnoremap 1 :set filetype=xhtml
nnoremap 2 :set filetype=css
nnoremap 3 :set filetype=javascript
nnoremap 4 :set filetype=PHP

"-----------------------------------------------------------------
" 折叠配置
"
" manual 手工定义折叠
" indent 更多的缩进表示更高级别的折叠
" expr 用表达式来定义折叠
" Syntax 用语法高亮来定义折叠
" diff 对没有更改的文本进行折叠
" marker 对文中的标志折叠
"------------------------------------------------------------------
set foldenable
set foldmethod=manual
set foldlevel=100 " 启动vim时不要自动折叠代码
set foldcolumn=0 " 设置折叠栏宽度

" Python 文件的一般设置,比如不要 tab 等
" autOCMd FileType python set tabstop=4 shiftwidth=4 expandtab
" autOCMd FileType python map @H_661_197@ :!python %

" 设置数据字典 ~/.vim/Dict/文件的路径
set complete-=k complete+=k
" autOCMd filetype javascript set Dictionary=$VIMFILES/Dict/javascript.Dict
" autOCMd filetype css set Dictionary=$VIMFILES/Dict/css.Dict
au FileType PHP setlocal Dict+=$VIMFILES/Dict/PHP.Dict

"-----------------------------------------------------------------
" plugin - winManager 配置 (弃用,很多小bug)
"-----------------------------------------------------------------
" let g:winManagerWindowLayout="NERDTree,TagList"
" let g:winManagerWidth = 35
" let g:NERDTree_title="[NERDTree]"
"
" nmap :if IsWinManagerVisible() WMToggle else WMToggle:q endif
" " nmap :WMToggle
"
" function! NERDTree_Start()
" exec 'NERDTree'
" endfunction
"
" function! NERDTree_IsValid()
" return 1
" endfunction

"-----------------------------------------------------------------
" plugin - doxygen toolkit 配置
"-----------------------------------------------------------------
let g:DoxygenToolkiT_BriefTag_pre="@brief "
let g:DoxygenToolkit_paramTag_pre="@Param "
let g:DoxygenToolkit_returnTag="@return "

let g:DoxygenToolkitauthorName="jiangyh @H419_46@"
let g:DoxygenToolkiT_BriefTag_funcName="no"
let g:doxygen_enhanced_color=1

@H_672_0@map fg : Dox
map ffg : DoxAuthor

"-----------------------------------------------------------------
" plugin - NERDTree 配置
"-----------------------------------------------------------------
let NERDTreeWinPos="left"
let NERDTreeWinSize=30
" let NERDTreeChDirMode=1 " 改变tree目录的同时改变工程的目录

nnoremap @H_162_262@ :NERDTreeToggle

"-----------------------------------------------------------------
" plugin - ctags程序
"-----------------------------------------------------------------
if MySys() == "windows"
let Tlist_Ctags_Cmd = '"'.$VIMRUNTIME.'/ctags.exe"'
elseif MySys() == "linux"
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif

set tags=~/acl/tags;
nnoremap :!ctags -R --exclude=*.js --c++-kinds=+p --fields=+iaS --extra=+q .

"-----------------------------------------------------------------
" plugin - taglist.vim
"-----------------------------------------------------------------
let Tlist_Show_One_File = 1 " 不同时显示多个文件的tag,只显示当前文件
let Tlist_Exit_OnlyWindow = 1 " 如果taglist窗口是最后@L_675_1@窗口,则退出vim
let Tlist_Use_Right_Window = 1 " 在右侧窗口中显示taglist窗口
let Tlist_File_Fold_Auto_Close=1 " 自动折叠当前非编辑文件方法列表
let Tlist_Auto_Open = 0
let Tlist_Auto_update = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Enable_Fold_column = 0
let Tlist_Compact_Format = 1
" let Tlist_Display_Prototype = 0

nnoremap :TlistToggle

"-----------------------------------------------------------------
" plugin - cscope设置
"-----------------------------------------------------------------
set cscopequickfix=s-,c-,d-,i-,t-,e-
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb

" add any database in current directory
" if filereadable("cscope.out")
" cs add cscope.out
" endif
" set csverb
" endif

nmap <C-@>s :cs find s =expand("")
nmap <C-@>g :cs find g =expand("")
nmap <C-@>c :cs find c =expand("")
nmap <C-@>t :cs find t =expand("")
nmap <C-@>e :cs find e =expand("")
nmap <C-@>f :cs find f =expand("")
nmap <C-@>i :cs find i =expand("")
nmap <C-@>d :cs find d =expand("")
endif

"-----------------------------------------------------------------
" plugin - project.vim 组织项目列表
" \C 递归读取子目录 \c 读取当前文件
" \l (列出所有当前层文件)\L(递归),按任何键停止
" \w (关闭当前层文件)\W(递归)
" \g (在项目当前层文件搜索)\G(递归)
" \r 关闭文件夹并刷新当前文件夹下文件,\R递归打开文件夹并刷新所有文件
" \s 关闭文件夹并创建,\S递归打开文件夹并创建
" \s 将文件在水平打开多个窗口显示,打开或关闭文件夹列表
" \o 将文件在@L_675_1@窗口打开,打开或关闭文件夹列表
" \v 在右窗口显示指针停留在project窗口的文件内容
" \i 显示文件文件夹的设置参数,如filter="*"
" \I 显示文件文件夹的决对路径和参数
" \1 - \9,\f1-\f9,\F1-\F9执行指定命令,\0查询1-9命令,\f0查询f1-f9,F1-F9命令
" 空格扩大project窗口的宽度,恢复宽度
"-----------------------------------------------------------------
" let proj_window_width=24
" let proj_window_increment=12
" let loaded_project = 1 " 停用插架
" let proj_flags="imstcg" " 自动隐藏project列表
" nnoremap :Project " F5 打开project窗口

"-----------------------------------------------------------------
" plugin - NERD_commenter.vim 注释代码用的,
" [count],cc 光标以下count行逐行添加注释(7,cC)
" [count],cu 光标以下count行逐行取消注释(7,cu)
" [count],cm 光标以下count行尝试添加块注释(7,cm)
",cA 在行尾插入 / /,并且进入插入模式。 这个命令方便写注释。
" 注:count参数可选,无则认为选中行或当前行
"-----------------------------------------------------------------
let NERdspaceDelims=1 " 让注释符与语句之间留@L_675_1@空格
let NERDCompactSexyComs=1 " 多行注释时样子更好看

"-----------------------------------------------------------------
" plugin - ctrlp 设置
"-----------------------------------------------------------------
nnoremap :ClearAllCtrlPCache|:CtrlP

@H_534_450@@H_785_489@

大佬总结

以上是大佬教程为你收集整理的PHP工程师VIM配置分享全部内容,希望文章能够帮你解决PHP工程师VIM配置分享所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: