Vim configuration file highlight + automatic indent + row number + folding + Optimization

Source: Internet
Author: User
Tags delete key set set

The configuration file was found online. I changed the error items

Copy the code to the user directory to create a file named. vimrc.
Save to take effect. If you want all users to take effect, modify/etc/vimrc (we recommend that you copy CP first)

"============================================== ====================================== "Description: suitable for your own vimrc files, for Linux/Windows, Gui/console "" last change: August 06, 2014 "" version: 1.0 "" ============================================ ====================================================== set compatible "close VI compatibility mode syntax on "automatic syntax highlighting colorscheme blue" set color scheme set number "display row number set cursorline" highlight current row set rcategory "Open Status Bar ruler set shiftwidth = 4" Set Set <and> the width of the command to 4 set softtabstop = 4 ". When you press the return key, you can delete four spaces at a time. Set tabstop = 4" set the tab length to 4 set nobackup. "Do not back up set autochdir when overwriting files" automatically switch the current directory to the directory where the current file is located filetype plugin indent on "to enable the plug-in) t nocp "uses the cursor key (for example, in Sun OS, to enable this function, you can use the optical key set backupcopy = yes "to set the backup behavior to overwrite the case-sensitive se smartcase." Case sensitivity is ignored during search, however, when one or more uppercase letters exist, keep set nowrapscan. "You are not allowed to re-search the set incsearch file when searching for the two ends." When you enter the search content, the search result set hlsearch is displayed. "When searching, the search is highlighted. found text set noerrorbells "Disable Error message ring set novisualbell" Disable use of visual ring instead of call set t_vb = "Terminal code for empty error ringtone" set showmatch "When brackets are inserted, briefly jump to matching brackets "set matchtime = 2" temporarily jump to matching brackets time set magic "set magic to save N" allow switching the buffer when there are unsaved changes, in this case, viset guioptions-= T "hide the toolbar set guioptions-= m" hide the menu bar set smartindent "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 (default value: 1, unable to display status bar) se T statusline = \ % <% F [% 1 * % m % * % N % R % H] % = \ % Y \ % 0 (% {& fileformat} \ % {& encoding} \ % C % L/% L %) "Set foldenable" start to fold set foldmethod = Syntax "set syntax fold set foldcolumn = 0" set the width of the fold area setlocal foldlevel = 1 "set the number of fold layers "Set foldclose = all" set to auto-disable fold "nnoremap <space >@= (foldclosed (line ('. ') <0 )? 'Zc': 'Z') <CR> "use the space key to switch and collapse" Return OS type, eg: windows, or Linux, Mac, ET. St... 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' elseif mysys () = "Linux" let $ vimfiles = $ home. '/. vim 'endif "sets the DOC file directory let helptags = $ vimfiles. '/doc' "Set Font and Chinese support if has (" Win32 ") set guifont = inconsolata: H12: cansiendif" Configure multilingual environment if has ("Mult I _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 "buffers operation shortcut! Nnoremap <C-RETURN>: bnext <CR> nnoremap <C-S-RETURN>: bprevious <CR> "tab operation shortcut! Nnoremap <C-TAB>: tabnext <CR> nnoremap <C-S-TAB>: tabprev <CR> "about the tab shortcut" map TN: tabnext <CR> "map TP: tabprevious <CR> "map TD: tabnew. <CR> "map te: tabedit" map TC: tabclose <CR> "when the window is split, the shortcut key for switching needs to be connected twice, for example, moving the cursor from the lower window to the upper window requires <c-W> K, which is very troublesome. Now, REMAP to <c-k>, switching will become very convenient. nnoremap <c-h> <c-W> hnnoremap <c-j> <c-W> jnnoremap <c-k> <c-W> knnoremap <c-l> <c-W> L "some good ing conversion syntaxes (useful if different languages are mixed in a file) nnoremap <leader> 1: SE T filetype = XHTML <CR> nnoremap <leader> 2: Set filetype = CSS <CR> nnoremap <leader> 3: Set filetype = JavaScript <CR> nnoremap <leader> 4: set filetype = php <CR> "set fileformats = UNIX, DOS, Mac" NMAP <leader> FD: se fileformat = dos <CR> "NMAP <leader> Fu: se fileformat = UNIX <CR> "use Ctrl + [L | n | p | CC] to list | next | previous | jump to count the result" Map <c-x> L <ESC>: CL <CR> "Map <c-x> n <ESC>: CN <CR>" Map <c-x> P <ESC>: CP <CR> "Map <c-x> C <ESC>: CC <CR>" enables tohtml to generate HTML with CSS syntax "syntax/2html. Vim, which can be used: runtime! Syntax/2html. vimlet html_use_css = 1 "general settings of the python file, for example, autocmd filetype Python set tabstop = 4 shiftwidth = 4 expandtabautocmd filetype Python Map <F12> :! Python % <CR> "Ctrl + C in selected state copy vmap <c-c>" + Y "Open JavaScript collapse Let B: javascript_fold = 1 "Open JavaScript to support DOM, HTML, and CSS. Let javascript_enable_domhtmlcss = 1" set the dictionary ~ /. Vim/dict/file path autocmd filetype JavaScript set dictionary = $ vimfiles/dict/JavaScript. dictautocmd filetype CSS set dictionary = $ vimfiles/dict/CSS. dictautocmd filetype PHP set dictionary = $ vimfiles/dict/PHP. dict "-----------------------------------------------------------------" Plugin-bufexplorer. vim buffers switch "/be full screen view all open file list"/BV left and right view/BS up and down view "----------------------------------------------- ------------------ "-----------------------------------------------------------------" Plugin-taglist. vim to view the function list, you need the ctags program "F4 open the hidden taglist window" ------------------------------------------------------------- if mysys () = "Windows" "sets the ctags program location in windows. Let tlist_ctags_cmd = '"'. $ vimruntime. '/ctags.exe "' elseif mysys () =" Linux "" sets the location of the ctags program in the Windows system. Let tlist_ctags_cmd = '/usr/bin/ctags' endi Fnnoremap <silent> <F4>: tlisttoggle <CR> T tlist_show_one_file = 1 "does not display tags of multiple files at the same time, only the current file met tlist_exit_onlywindow = 1 is displayed. "If the taglist window is the last window, exit vlet layout = 1. The taglist window is displayed in the right window. Let layout = 1. The method list for automatically folding the current non-editable file. Let tlist_auto_open = 0let tlist_auto_update = 1let layout = 1let tlist_enable_fold_column 0let tlist_process_file_always = 1le T tlist_display_prototype = 0let tlist_compact_format = 1 "plugin" Plugin-mark. Vim marks different colors for various tags to facilitate viewing and debugging plug-ins. "/M mark or unmark the word under (or before) the cursor"/R manually input a regular expression. used for search. "/n clear this mark (I. e. the mark under the cursor), or clear all highlighte marks. "/* next to the current markword/# previous to the current markword" // next to all markwords /? The previous "plugin" --------------------------------------------------------------------- "Plugin-nerd_tree.vim browses the files and directories in the system in tree mode": erdtree opens nerd_tree: nerdtreeclose close nerd_tree "O open close file or directory t open in the tab" t open in the background tab! Run the "P to the upper directory P to the root directory" K to the first node J to the last node "u to open the upper directory m to display the file system menu (add, delete, and move operations)) "R recursively refresh current directory R recursively refresh current root directory" failed "F3 nerdtree switchover Map <F3>: nerdtreetoggle <CR> imap <F3> <ESC>: nerdtreetoggle <CR> "plugin" Plugin-nerd_commenter.vim used to annotate the code, "[count], add comments (7, CC) row by row under the CC cursor count" [count], cou below Cu cursor NT line by line uncomment (7, Cu) "[count], CM cursor below count line tries to add block comment (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-doxygentoolkit. vim is a document generated by annotations and can quickly generate standard function comments "--------------------------------------------------------------- Let G: doxygentoolkit_authorname =" asins-asinsimp Le at gmail dot com "Let G: doxygentoolkit_brieftag_funcname =" yes "Map <leader> da: doxauthor <CR> Map <leader> DF: Dox <CR> Map <leader> DB: doxblock <CR> Map <leader> dc a/**/<left> "---------------------------------------------------------------" Plugin-zencoding. vim cool plug-in, HTML code generation "plug-in latest version: http://github.com/mattn/zencoding-vim" Common commands can be seen: http://nootn.com/blog/Tool/23 "-------------------------- --------------------------------------- "-------------------------------------------------------------" Plugin-checksyntax. vim JavaScript common syntax error check "Default shortcut: F5" ------------------------------------------------------------------- Let G: checksyntax_auto = 0 "do not automatically check" plugin "Plugin-neocomplcache. vim auto-completion plug-in "------------------------------------ Let G: Drawing = 1let G: Drawing = 1let G: neocomplcache_smartcase = 1let G: Drawing = 1let G: neocomplcache_enableinfo = 1let G: Drawing = 1let G: Drawing = 3let G: neocomplcache_enableskipcompletion = 1let G: neocomplcache_skipinputtime = '0. 5 'let G: neocomp Lcache_snippetsdir = $ vimfiles. '/snippets' "<tab> completion." inoremap <expr> <tab> pumvisible ()? "/<C-N>": "/<tab>" "snippets expand keyimap <silent> <c-e> <plug> (neocomplcache_snippets_expand) SMAP <silent> <c-e> <plug> (neocomplcache_snippets_expand) "-------------------------------------------------------------" Plugin-matchit. vim expands the % command to redirect between nested labels and statements "% forward match g % reverse match" [% first part of positioning] % last part of positioning "plugin" plugin "Plugin-vcscommand. vim extends the % command so that the "SVN/git management tool" ----------------------------------------------------------------------- "plugin" Plugin-A can be redirected between nested labels and statements. vim "-----------------------------------------------------------------

Reference: http://blog.csdn.net/neighbor1000/article/details/8707450

Http://blog.sciencenet.cn/blog-683919-667321.html

This article from the "Idle pool small building" blog, please be sure to keep this source http://soarwilldo.blog.51cto.com/5520138/1541142

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.