搜索
首页后端开发php教程以前写PHP时的vim配置

第一步:下载vim插件管理工具vundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

第二步:copy我的vimrc到你的~/.vimrc里面(修改之前记得备份哦)

" See: http://vimdoc.sourceforge.net/htmldoc/options.html for details"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""=> General""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""设定 gvim 运行在增强模式下,不使用vi的键盘模式set nocompatible"设置支持多语言,解决乱码"设置内部编码为utf-8set encoding=utf-8set termencoding=utf-8set fileencodings=utf-8,gbk,default,latin1"解决consle输出乱码language messages zh_CN.utf-8"帮助菜单语言set helplang=cn" Sets how many lines of history VIM has to rememberset history=700" Enable filetype pluginsfiletype off    "requiredfiletype plugin onfiletype indent on" Set to auto read when a file is changed from the outsideset autoread" With a map leader it's possible to do extra key combinations" like <leader>w saves the current filelet mapleader = ","let g:mapleader = ","" Fast savingnmap <leader>w :w!<cr>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => VIM user interface""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Set 7 lines to the cursor - when moving vertically using j/k"光标离上下边界7行时开始滚屏set so=7" Turn on the Wild menuset wildmenu" Ignore compiled filesset wildignore=*.o,*~,*.pycif has("win16") || has("win32")    set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Storeelse    set wildignore+=.git\*,.hg\*,.svn\*endif" Height of the command barset cmdheight=2" Configure backspace so it acts as it should actset backspace=eol,start,indentset whichwrap+=<,>,h,l" Ignore case when searchingset ignorecase" When searching try to be smart about cases set smartcase" Highlight search resultsset hlsearch" Makes search act like search in modern browsersset incsearch" Following line clears the search highlights when pressing Lbnnoremap <leader>/ :nohlsearch<CR>"Don't redraw while executing macros (good performance config)set lazyredraw" For regular expressions turn magic onset magic" Show matching brackets when text indicator is over themset showmatch" How many tenths of a second to blink when matching bracketsset mat=2" No annoying sound on errorsset noerrorbellsset novisualbellset t_vb=set tm=500"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Colors and Fonts"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Enable syntax highlightingsyntax enabletry    colorscheme desertcatchendtryset background=dark" Set extra options when running in GUI modeif has("gui_running")    set guioptions-=T    set guioptions+=e    set t_Co=256    set guitablabel=%M\ %tendif" Use Unix as the standard file typeset ffs=unix,dos,mac"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Files, backups and undo"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Turn backup off, since most stuff is in SVN, git et.c anyway...set nobackupset nowbset noswapfile"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Text, tab and indent related"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Use spaces instead of tabsset expandtab" Be smart when using tabs ;)set smarttabset tabstop=4set shiftwidth=4"对于不同类型的文件,进行自定义设置au FileType html,im,javascript,css set shiftwidth=2au FileType html,im,javascript,css set tabstop=2au FileType java,python,php set shiftwidth=4au FileType java,python,php set tabstop=4"设置每行的最大字符数,超过的话,将换行set textwidth=80" Linebreak on 500 charactersset lbrset tw=500set ai    "Auto indentset si    "Smart indentset wrap  "Wrap lines""""""""""""""""""""""""""""""" => Visual mode related""""""""""""""""""""""""""""""" Visual mode pressing * or # searches for the current selection" Super useful! From an idea by Michael Naumann"vnoremap <silent> * :call VisualSelection('f')<CR>"vnoremap <silent> # :call VisualSelection('b')<CR>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Moving around, tabs, windows and buffers"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Treat long lines as break lines (useful when moving around in them)map j gjmap k gk" Moving Between Windowsnnoremap <Leader>h <C-w>hnnoremap <Leader>l <C-w>lnnoremap <Leader>j <C-w>jnnoremap <Leader>k <C-w>k""""""""""""""""""""""""""""""" => Status line""""""""""""""""""""""""""""""" Always show the status lineset laststatus=2" Format the status lineset statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ \ \ \ \line:\%-14.(%l,%c%V%)\ %P"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Editing mappings"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Remap VIM 0 to first non-blank charactermap 0 ^" type S, then type what you're looking for, a /, and what to replace it withnmap S :%s/<C-R><C-W>\>//g<LEFT><LEFT>vmap S :s/<C-R><C-W>\>//g<LEFT><LEFT>"基本编辑器设置set number          "显示行号set laststatus=2    "显示状态栏 (默认值为 1, 无法显示状态栏)set cmdheight=1     "设定命令行的行数为 1"set showtabline=2   "显示tab标签"set tabline+=%f     "tab标签" Enable Code Foldingset foldenableset foldmethod=syntaxset mouse=a         "任何情况都可以使用鼠标"工作目录随文件变autocmd BufEnter * cd %:p:h"不显示工具条set guioptions-=T" 配置文件.vimrc更改后自动重新载入使设置生效autocmd! bufwritepost .vimrc source ~/.vimrc "设置重新载入.vimrc快捷键map <silent> <leader>ss :source ~/.vimrc<cr>" 设置快速编辑.vimrc快捷键map <silent> <leader>ee :e ~/.vimrc<cr> "------  Replacing ------"type S, then type what you're looking for, a /, and what to replace it withnmap S :%s/<C-R><C-W>\>//g<LEFT><LEFT>vmap S :s/<C-R><C-W>\>//g<LEFT><LEFT>""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Scott McCoy/svn.vim" http://www.vim.org/scripts/script.php?script_id=743" cd  ~/.vim" tar zxvf svn-<version>.tgz"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""更新当前目录的代码"map <F5> :!svn up<CR>"提交SVN(当前目录)"map <F7> :!svn ci -m ""<CR>"提交SVN(当前文件)"map <F8> :!svn ci -m "" %<CR> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" =>Tagbar" http://www.vim.org/scripts/script.php?script_id=3465 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""noremap <silent> <Leader>y :TagbarToggle<CR>let g:tagbar_ctags_bin='/usr/bin/ctags-exuberant'let g:tagbar_width=26""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" =>Exuberant Ctags" sudo apt-get install exuberant-ctags""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" ,ct = Builds ctags in current directorymap <Leader>ct :! /usr/bin/ctags-exuberant -R *<CR>""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => vundle" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""set rtp+=~/.vim/bundle/vundle/call vundle#rc()"let Vundle manage Vundle"required!Bundle 'gmarik/vundle'"My Bundles here:""original repos on github" IndentBundle 'Yggdroot/indentLine'" PluginBundle 'The-NERD-tree'"------  NERDTree Options  ------"  当打开vim且没有文件时自动打开NERDTreeautocmd vimenter * if !argc(  )   | NERDTree | endif    let NERDTreeIgnore=['CVS']    let NERDTreeChDirMode=2     "setting root dir in NT also sets VIM's cd    noremap <silent> <Leader>n :NERDTreeToggle<CR>    " These prevent accidentally loading files while in the NERDTree panel    autocmd FileType nerdtree noremap <buffer> <c-left> <nop>    autocmd FileType nerdtree noremap <buffer> <c-h> <nop>    autocmd FileType nerdtree noremap <buffer> <c-right> <nop>    autocmd FileType nerdtree noremap <buffer> <c-l> <nop>Bundle 'jiangmiao/auto-pairs'Bundle 'pangloss/vim-javascript'Bundle 'mattn/emmet-vim'Plugin 'mattn/jscomplete-vim'Bundle 'Shougo/neocomplcache'    " Disable AutoComplPop.    let g:acp_enableAtStartup = 0    " Use neocomplete.    let g:neocomplete#enable_at_startup = 1    " Use smartcase.    let g:neocomplete#enable_smart_case = 1    " Set minimum syntax keyword length.    let g:neocomplete#sources#syntax#min_keyword_length = 3    let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'    " Define dictionary.    let g:neocomplete#sources#dictionary#dictionaries = {            \ 'default' : '',            \ 'vimshell' : $HOME.'/.vimshell_hist',            \ 'scheme' : $HOME.'/.gosh_completions'            \ }    " Define keyword.    if !exists('g:neocomplete#keyword_patterns')        let g:neocomplete#keyword_patterns = {}     endif    let g:neocomplete#keyword_patterns['default'] = '\h\w*'"Bundle 'joonty/vdebug'"<F5>: start/run (to next breakpoint/end of script)"<F2>: step over"<F3>: step into"<F4>: step out"<F6>: stop debugging"To stop debugging, press <F6>. Press it again to close the debugger interface."<F7>: detach script from debugger"<F9>: run to cursor"<F10>: set line breakpoint"<F11>: show context variables (e.g. after ""eval")"<F12>: evaluate variable under cursor":Breakpoint <type> <args>: set a breakpoint of any type (see :help VdebugBreakpoints)":VdebugEval <code>: evaluate some code and display the result"<Leader>e: evaluate the expression under visual highlight and display the result"SyntaxBundle 'scrooloose/Syntastic'    let g:syntastic_check_on_open = 1    let g:syntastic_error_symbol = '?'    let g:syntastic_warning_symbol = '?'    let g:syntastic_auto_loc_list = 1    let g:syntastic_loc_list_height = 5    let g:syntastic_enable_highlighting = 0" 如果要对javascript进行语法检查,可以安装JSHint插件" sudo apt-get install nodejs" sudo npm install jshint" # 如果是 12.10,我发现 nodejs 可执行文件的命名不符合常规,要做个链接" sudo ln -s /usr/bin/nodejs /usr/bind/node"" :Brief help" :BundleList           -list configured bundles" :BundleInstall(!)     - install(update) bundles" :BundleSearch(!) foo  - search(or refresh cache first) for foo" :BundleClean(!)       - confirm(or auto-approve) removal of unused bundles" vundle主要就是上面这个四个命令,例如BundleInstall是全部重新安装,BundleInstall!则是更新" 一般安装插件的流程为,先BundleSearch一个插件,然后在列表中选中,按i安装" 安装完之后,在vimrc中,添加Bundle 'xxx'  使得bundle能够加载这个插件,同时如果" 需要配置这个插件,也是在vimrc中设置即可" 如果search到的安装不了,就换过来先在vimrc里添加Bundle 'xxx'" 在去vim里执行BundleInstall来安装" 卸载的话" 1. 注释掉Bundle/Plugin &times;&times;&times;(要删除的插件相关语句)" 2. :BundleClean" Done!" see :h vundle for more details or wiki for FAQ" ps: comments after Bundle command are not allowed.."""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Helper functions"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""function! HasPaste()    if &paste        return 'PASTE MODE '    en    return ''endfunction
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
PHP的当前状态:查看网络开发趋势PHP的当前状态:查看网络开发趋势Apr 13, 2025 am 12:20 AM

PHP在现代Web开发中仍然重要,尤其在内容管理和电子商务平台。1)PHP拥有丰富的生态系统和强大框架支持,如Laravel和Symfony。2)性能优化可通过OPcache和Nginx实现。3)PHP8.0引入JIT编译器,提升性能。4)云原生应用通过Docker和Kubernetes部署,提高灵活性和可扩展性。

PHP与其他语言:比较PHP与其他语言:比较Apr 13, 2025 am 12:19 AM

PHP适合web开发,特别是在快速开发和处理动态内容方面表现出色,但不擅长数据科学和企业级应用。与Python相比,PHP在web开发中更具优势,但在数据科学领域不如Python;与Java相比,PHP在企业级应用中表现较差,但在web开发中更灵活;与JavaScript相比,PHP在后端开发中更简洁,但在前端开发中不如JavaScript。

PHP与Python:核心功能PHP与Python:核心功能Apr 13, 2025 am 12:16 AM

PHP和Python各有优势,适合不同场景。1.PHP适用于web开发,提供内置web服务器和丰富函数库。2.Python适合数据科学和机器学习,语法简洁且有强大标准库。选择时应根据项目需求决定。

PHP:网络开发的关键语言PHP:网络开发的关键语言Apr 13, 2025 am 12:08 AM

PHP是一种广泛应用于服务器端的脚本语言,特别适合web开发。1.PHP可以嵌入HTML,处理HTTP请求和响应,支持多种数据库。2.PHP用于生成动态网页内容,处理表单数据,访问数据库等,具有强大的社区支持和开源资源。3.PHP是解释型语言,执行过程包括词法分析、语法分析、编译和执行。4.PHP可以与MySQL结合用于用户注册系统等高级应用。5.调试PHP时,可使用error_reporting()和var_dump()等函数。6.优化PHP代码可通过缓存机制、优化数据库查询和使用内置函数。7

PHP:许多网站的基础PHP:许多网站的基础Apr 13, 2025 am 12:07 AM

PHP成为许多网站首选技术栈的原因包括其易用性、强大社区支持和广泛应用。1)易于学习和使用,适合初学者。2)拥有庞大的开发者社区,资源丰富。3)广泛应用于WordPress、Drupal等平台。4)与Web服务器紧密集成,简化开发部署。

超越炒作:评估当今PHP的角色超越炒作:评估当今PHP的角色Apr 12, 2025 am 12:17 AM

PHP在现代编程中仍然是一个强大且广泛使用的工具,尤其在web开发领域。1)PHP易用且与数据库集成无缝,是许多开发者的首选。2)它支持动态内容生成和面向对象编程,适合快速创建和维护网站。3)PHP的性能可以通过缓存和优化数据库查询来提升,其广泛的社区和丰富生态系统使其在当今技术栈中仍具重要地位。

PHP中的弱参考是什么?什么时候有用?PHP中的弱参考是什么?什么时候有用?Apr 12, 2025 am 12:13 AM

在PHP中,弱引用是通过WeakReference类实现的,不会阻止垃圾回收器回收对象。弱引用适用于缓存系统和事件监听器等场景,需注意其不能保证对象存活,且垃圾回收可能延迟。

解释PHP中的__ Invoke Magic方法。解释PHP中的__ Invoke Magic方法。Apr 12, 2025 am 12:07 AM

\_\_invoke方法允许对象像函数一样被调用。1.定义\_\_invoke方法使对象可被调用。2.使用$obj(...)语法时,PHP会执行\_\_invoke方法。3.适用于日志记录和计算器等场景,提高代码灵活性和可读性。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器