This article mainly introduces the detailed process for PHP engineers to configure VIM, including VIM configuration and VIM configuration code. if you are interested, refer
About my vim configurations
I often write code on the server. a friend provides his vim configuration and shares it with you.
Interface:
. Vimrc
The content is as follows:
"============================================== ====================================== Set nocompatible "be iMproved, requiredfiletype off "required" git clone https://github.com/gmarik/Vundle.vim.git ~ /. Vim/bundle/Vundle. vim "set the runtime path to include Vundle and initializeset rtp + = ~ /. Vim/bundle/Vundle. vim call vundle # begin () "let Vundle manage Vundle, requiredPlugin 'gmarik/Vundle. vim '"plugin on GitHub repoPlugin' shawncplus/phpcomplete. vim 'plugin' scrooloose/nerdtree 'plugin' kien/ctrlp. vim 'plug-in '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.htmlPlugin 'Vim-scripts/bufexplorer.zip 'in 'vim-scripts/CSTS. 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-instils 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" auto syntax highlight set number "display row number set cursorline" highlight current row "set r0000" open status bar ruler set shiftwidth = 4 "set <and> the width of the command to move is 4 set tabstop = 4 expandtab" set the tab length to 4 spaces set nobackup "do not back up when overwriting files" set autochdir "automatic switch the current directory is the directory where the current file is located. set backupcopy = yes. the backup behavior is to overwrite the set ignorecase smartcase. case sensitivity is ignored during search, however, when one or more uppercase letters exist, the set nowrapscan is case sensitive. "re-searching is prohibited when both ends of the file are searched" Set incsearch "display search results when entering search content set hlsearch" highlight the found text set noerrorbells "close error message ring set novisualbell" disable use of visual Bell instead of call set t_vb = "terminal code set magic for setting an empty error ringtone" set magic set hidden "allows you to switch the buffer zone when there are unsaved changes, in this case, vim is responsible for saving set guioptions-= T "hidden toolbar set guioptions-= m" hidden menu bar set smartindent ". when the new feature is enabled, it uses smart automatic indent set backspace = indent, eol, start "is not set in the insert status. the return key and Delete key cannot be used to Delete the carriage return character set into height = 1" set the number of lines in the command line to 1 set laststatus = 2 "display the status bar If the value is 1, the status bar cannot be displayed) set statusline = \ % <% F [% 1 * % M % * % n % R % H] % = \ % y \ % 0 (% {& fileformat} \ % {& amp; encoding} \ % c: % l/% L %) \ "set errorformat = % m \ in \ % f \ on \ line \ % lset autoindent set softtabstop = 4" allows you to delete 4 at a time when you press the return key. space colorscheme molokaiset t_Co = 256 "courier" get current system type "---------------------------------------------------------------- function! MySys () if has ("win16") | has ("win32") | has ("win64") | has ("win95 ") return "windows" elseif has ("unix") return "linux" endifendfunction "user directory variable $ VIMFILESif MySys () =" windows "let $ VIMFILES = $ VIM. '/vimfiles' set backupdir = D: // Vim/tmpelseif MySys () = "linux" let $ VIMFILES = $ HOME. '/. vim 'set backupdir =/tmpendif "font and Chinese support if has (" win32 ") set guifont = Inconsolata: h12: cANSIendif" configure multilingual environment if h As ("multi_byte") "UTF-8 encoding 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 endifelse echoerr "Sorry, this version of (g) vim was not compiled with + multi_byte" endif "cursor over the window, need
K, which is very troublesome. now the re ING is
Nnoremap
Hnnoremap
Jnnoremap
Knnoremap
L "some good ing conversion syntaxes (useful if a file is mixed with different languages) nnoremap
1: set filetype = xhtml
Nnoremap
2: set filetype = css
Nnoremap
3: set filetype = javascript
Nnoremap
4: set filetype = php
"Manual" folding configuration "" manual definition folding "indent more indent represents more advanced folding" expr defines folding using expressions "syntax uses syntax highlighting to define folding" diff pair folding text without changes "marker folding text" sorted set foldenableset foldmethod = manualset foldlevel = 100 "do not fold code set foldcolumn = 0 when vim is started" set foldcolumn width "General settings of Python files, for example, "autocmd FileType python set tabstop = 4 shiftwidth = 4 expandtab" autocmd FileType python map
:! Python %
"Set data dictionary ~ /. Vim/dict/file path set complete-= k complete + = k "autocmd filetype javascript set dictionary = $ VIMFILES/dict/javascript. dict "autocmd filetype css set dictionary = $ VIMFILES/dict/css. dictau FileType php setlocal dict + = $ VIMFILES/dict/php. dict "plugin" plugin-winManager configuration (obsolete, many small bugs) "plugin" 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" plugin-doxygen toolkit configuration "let g: plugin =" @ brief "let g: DoxygenToolkit_paramTag_pre =" @ Param "let g: doxygenToolkit_returnTag = "@ return" let g: DoxygenToolkit_authorName = "jiangyh
"Let g: DoxygenToolkit_briefTag_funcName =" no "let g: doxygen_enhanced_color = 1 map fg: Dox
Map ffg: DoxAuthor
"Plugin" plugin-NERDTree configuration "let NERDTreeWinPos =" left "let NERDTreeWinSize = 30" let NERDTreeChDirMode = 1 "change the tree directory while changing the project directory nnoremap
: NERDTreeToggle
"Plugin" plugin-ctags program "--------------------------------------------------------------- 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 "cmdlet Tlist_Show_One_File = 1" does not display the tags of multiple files at the same time, only show the current file's let Tlist_Exit_OnlyWindow = 1 "if the taglist window is the last window, exit vimlet records = 1. in the right window, the taglist window is displayed. let records = 1. the method list of the current non-edited file is automatically folded. let Tlist_Auto_Open = 0let Tlist_Auto_Update = 1let records = 1let tlist_enable_fold _ 0let Tlist_Compact_Format = 1 "let Tlist_Display_Prototype = 0 nnoremap
: TlistToggle
"Plugin" plugin-csfix settings "sorted set cscopequickfix = s-, c-, d-, I-, t-, e-if has (" CSAs ") set csprg =/usr/bin/cs1_set csto = 1 set cst set nocsverb "add any database in current directory" if filereadable ("csable. out ")" cs add cscope. out "endif" set csverb "endif nmap
S: cs find s
= Expand ("
")
Nmap
G: cs find g
= Expand ("
")
Nmap
C: cs find c
= Expand ("
")
Nmap
T: cs find t
= Expand ("
")
Nmap
E: cs find e
= Expand ("
")
Nmap
F: cs find f
= Expand ("
")
Nmap
I: cs find I
= Expand ("
")
Nmap
D: cs find d
= Expand ("
")
Endif "-----------------------------------------------------------------" plugin-project. vim organization Project List "\ C recursive reading subdirectory \ c reading current file" \ l (listing all current layer files) \ L (recursion ), press any key to stop "\ w (close current layer file) \ W (recursion)" \ g (search for files at current layer of the project) \ G (recursion) "\ r close the subfolders and refresh the files in the current folder, \ R recursively open the folder and refresh all files" \ s close the folder and create, \ S recursively open a folder and create "\ s open the file horizontally in multiple windows, open or close the folder list" \ o open the file in a window, open or close the folder list "\ v show the file content of the pointer staying in the project window in the right window" \ I set parameters for displaying files or folders, for example, filter = "*" \ I displays the path and parameters of a file or folder "\ 1-\ 9, \ f1-\ f9, \ F1-\ F9 execute the specified command, \ 0 query 1-9 command, \ f0 query F1-F9, F1-F9 command"
Space to expand the width of the project window, restore width "allow" let proj_window_width = 24 "let proj_window_increment = 12" let loaded_project = 1 "disable plug-in shelf" let proj_flags = "imstcg" "automatically hide project list" nnoremap
: Project
"F5 open the project window" comment "plugin-NERD_commenter.vim used to comment on the code," [count], cc cursor following count line by line add comment (7, cc) "[count], cu cursor: The following count rows uncomment (7, cu) "[count], cm cursor: The following count rows attempt to add block annotation (7, cm )", cA inserts/**/at the end of a row and enters the insert mode. This command is convenient for writing comments. "Note: the count parameter is optional, if none, the selected row or the current row is selected by default. "let NERDSpaceDelims = 1" leaves a space between the annotator and the statement. let NERDCompactSexyComs = 1 "multi-line comments look better" comment "-----------------------------------------------------------------" plugin-ctrlp settings "------------------------------------------------------------------- nnoremap
: ClearAllCtrlPCache
\ |: CtrlP
Procedure:
1. download the plug-in manager
~ /. Vim/bundle/Vundle. vim
2. install the plug-in
Open a file
Vim ~ /. Vimrc
Go to the command to execute the installation
: BundleInstall
3. Upload The PHP automatic instance Dictionary and the true color schemeDecompress the package to the. vim directory.
The above is the detailed process for configuring VIM, and I hope it will be helpful for everyone's learning.