Vim config file, highlight + auto indent + line number + collapse + optimize

Source: Internet
Author: User
Tags imap win32

Vim profile, highlight + auto indent + line number + collapse + optimize add a copy of the code to the user directory to create a new file for. VIMRC
Save to take effect; If you want all users to take effect please modify/ETC/VIMRC (CP is recommended first)
"=========================================================================
"DesCRiption: VIMRC file for your own use, for Linux/windows, Gui/console
"
"Last change:2010 August 02 15:13
"
"version:1.80
"
"=========================================================================

Set nocompatible "Turn off VI compatibility mode
Syntax on "Automatic syntax highlighting
ColorScheme Molokai "Set color scheme
Set number "Displays line numbers
Set Cursorline "highlight when moving forward
Set ruler "Open the status bar ruler
Set shiftwidth=4 "Settings << and >> command width of 4 when moving
Set Softtabstop=4 "allows you to delete 4 spaces at a time by pressing BACKSPACE
Set tabstop=4 "Set tab length to 4
Set Nobackup "Overwrite file without backup
Set Autochdir "Automatically switches the current directory to the directory where the current file is located
FileType plugin indent on "Open plugin
Set Backupcopy=yes "The behavior when setting up a backup is overwrite
Set ignorecase smartcase "ignores case when searching, but remains case sensitive when one or more uppercase letters are available
Set Nowrapscan "Prohibit re-searching when searching to both ends of a file
Set Incsearch "Search results are displayed when you enter search content
Set Hlsearch "Highlight found text when searching
Set Noerrorbells "Shutdown error message ring
Set Novisualbell "off using visual bells instead of calls
Set t_vb= "Empty error ringtone terminal code
"Set Showmatch" when inserting parentheses, briefly jumps to matching corresponding parentheses
"Set matchtime=2" briefly jumps to the time of matching parentheses
Set Magic
Set hidden "allows the buffer to be toggled when there are unsaved modifications, where the modification is saved by vim
Set Guioptions-=t "Hide the toolbar
Set guioptions-=m "Hide Menu bar
Set smartindent "Use Smart Auto indent when new rows are turned on
Set Backspace=indent,eol,start
"No setting in Insert State cannot remove carriage return with backspace and delete keys
Set Cmdheight=1 "Sets the number of lines on the command line to 1
Set laststatus=2 "Show status bar (default = 1, cannot display status bar)
Set statusline=\%<%f[%1*%m%*%n%r%h]%=\%y\%0 (%{&fileformat}\%{&encoding}\%c:%l/%L%) \
"Sets the information displayed in the status line
Set foldenable "Start folding
Set Foldmethod=syntax "Setting syntax folding
Set foldcolumn=0 "Sets the width of the collapsed area
Setlocal foldlevel=1 "Sets the number of collapsed layers to
Set Foldclose=all to automatically turn off folding
"Nnoremap <space> @= (foldclosed (Line (')) < 0)? ' Zc ': ' zo ') <CR>
"Use the SPACEBAR to switch folding


"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"
endif
Endfunction

"User Directory variable $vimfiles
If Mysys () = = "Windows"
Let $VIMFILES = $VIM. ' /vimfiles '
ElseIf Mysys () = = "Linux"
Let $VIMFILES = $HOME. ' /.vim '
endif

"Set Doc document directory
Let helptags= $VIMFILES. ' /doc '

"Set fonts and Chinese support
If has ("Win32")
Set Guifont=inconsolata:h12:cansi
endif

The Configure multi-lingual environment
If has ("Multi_byte")
"UTF-8 Code
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 is not compiled with +multi_byte"
endif

"Buffers Action Shortcut!
Nnoremap <C-RETURN>:bnext<cr>
Nnoremap <C-S-RETURN>:bprevious<cr>

"TAB Action Shortcut!
Nnoremap <C-TAB>:tabnext<cr>
Nnoremap <C-S-TAB>:tabprev<cr>

"About tab shortcut keys
"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 key hotkeys for the switch need to be connected two times, such as moving from the lower window
"Cursor to the top window, need <c-w><c-w>k, very troublesome, now remap to <c-k>
"The time will be very convenient.
Nnoremap <C-h> <c-w>h
Nnoremap <C-j> <c-w>j
Nnoremap <C-k> <c-w>k
Nnoremap <C-l> <c-w>l

"Some good mapping conversion syntax (useful if a different language is mixed in a file)
Nnoremap <leader>1:set filetype=xhtml<cr>
Nnoremap <leader>2:set filetype=css<cr>
Nnoremap <leader>3:set filetype=javascript<cr>
Nnoremap <leader>4:set filetype=php<cr>

The 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>


"Let Tohtml produce HTML with CSS syntax
"Syntax/2html.vim, can be used: runtime! Syntax/2html.vim
Let Html_use_css=1

"Python file general settings, such as do not tab
Autocmd FileType python set tabstop=4 shiftwidth=4 expandtab
Autocmd FileType python map <F12>:!python%<cr>

"CTRL + C copy in selected state
Vmap <C-c> "+y

"Open JavaScript Folding
Let B:javascript_fold=1
"Open JavaScript support for DOM, HTML, and CSS
Let Javascript_enable_domhtmlcss=1
"Set the path to the dictionary ~/.vim/dict/file
Autocmd filetype JavaScript set dictionary= $VIMFILES/dict/javascript.dict
Autocmd filetype CSS set dictionary= $VIMFILES/dict/css.dict
Autocmd filetype php set dictionary= $VIMFILES/dict/php.dict

"-----------------------------------------------------------------
"Plugin-bufexplorer.vim buffers Switch
"\be Full screen View list of all open files
"\BV view \bs up and down mode view
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin-taglist.vim view function list, need Ctags program
"F4 Open hidden taglist window
"-----------------------------------------------------------------
If Mysys () = = "Windows" sets the location of the Ctags program in the Windows system
Let Tlist_ctags_cmd = ' "'. $VIMRUNTIME. ' /ctags.exe "'
ElseIf Mysys () = = "Linux" to set the location of Ctags programs in the Windows system
Let Tlist_ctags_cmd = '/usr/bin/ctags '
endif
Nnoremap <silent><F4>:tlisttoggle<cr>
Let Tlist_show_one_file = 1 "does not display the tag of multiple files at the same time, only displays the current file's
Let Tlist_exit_onlywindow = 1 "If the TagList window is the last window, exit vim
Let Tlist_use_right_window = 1 "Displays the TagList window in the right window
Let tlist_file_fold_auto_close=1 "automatically collapses the list of currently non-edited files
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_process_file_always = 1
Let Tlist_display_prototype = 0
Let Tlist_compact_format = 1


"-----------------------------------------------------------------
"Plugin-mark.vim to various tags tag different colors, easy to watch the mode of plug-ins.
"\m mark or unmark the word under (or before) the cursor
"\ r manually input a regular expression. For search.
"\ n Clear this mark (i.e. the under the cursor), or clear all highlighted marks.
"\* the next \# of the current Markword Markword the previous
"\ \ All markwords the next \?" All Markwords's previous
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin-nerd_tree.vim Browse files and directories in the system in a tree-like way
": Erdtree open Nerd_tree:nerdtreeclose Close Nerd_tree
"O Open closed file or directory T open in tab
"T Open in the Background tab! Execute this file
"p to upper directory p to root directory
"K to the first node J to the last node
"U open upper directory m display file system menu (add, delete, move operation)
"R recursively refreshes the current directory R recursively refreshes the current root directory
"-----------------------------------------------------------------
"F3 Nerdtree switch
Map <F3>:nerdtreetoggle<cr>
IMAP <F3> <ESC>:NERDTreeToggle<CR>


"-----------------------------------------------------------------
"Plugin-nerd_commenter.vim Comment Code,
The [COUNT],CC cursor follows the count line to add a note line by row (7,CC)
"[COUNT],CU cursor the following count line uncomment each line (7,CU)
"[COUNT],CM cursor the following count line tries to add a block comment (7,cm)
, the CA inserts */* At the end of the line and enters insert mode. This command makes it easy to write comments.
Note: The count parameter is optional and none defaults to the selected line or the forward
"-----------------------------------------------------------------
Let Nerdspacedelims=1 "leave a space between the comment and the statement
Let Nerdcompactsexycoms=1 "multi-line comments look better


"-----------------------------------------------------------------
"Plugin-doxygentoolkit.vim generates documents from annotations and is able to quickly generate function standard annotations
"-----------------------------------------------------------------
Let g:doxygentoolkit_authorname= "asins-asinsimple at gmail DOT com"
Let g:doxygentoolkit_brieftag_funcname= "yes"
Map <leader>da:D oxauthor<cr>
Map &LT;LEADER&GT;DF:D ox<cr>
Map <leader>db:D oxblock<cr>
Map &LT;LEADER&GT;DC A/* */<left><left><left>


"-----------------------------------------------------------------
"Plugin–zencoding.vim cool plugin, HTML code generation
"Plugin Latest Version: Http://github.com/mattn/zencoding-vim
"Common commands to see: http://nootn.com/blog/Tool/23/
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin–checksyntax.vim JavaScript common syntax error checking
The default shortcut is F5
"-----------------------------------------------------------------
Let G:checksyntax_auto = 0 "does not check automatically


"-----------------------------------------------------------------
"Plugin-neocomplcache.vim Auto-complete plug-in
"-----------------------------------------------------------------
Let G:autocomplpop_notenableatstartup = 1
Let G:neocomplcache_enableatstartup = 1
Let G:neocomplcache_smartcase = 1
Let G:neocomplcache_tagsautoupdate = 1
Let G:neocomplcache_enableinfo = 1
Let g:neocomplcache_enablecamelcasecompletion = 1
Let G:neocomplcache_minsyntaxlength = 3
Let g:neocomplcache_enableskipcompletion = 1
Let G:neocomplcache_skipinputtime = ' 0.5 '
Let G:neocomplcache_snippetsdir = $VIMFILES. ' /snippets '
"<TAB> completion.
Inoremap <expr><TAB> pumvisible ()? "\<c-n>": "\<tab>"
"Snippets Expand Key
IMAP <silent> <C-e> <Plug> (Neocomplcache_snippets_expand)
SMAP <silent> <C-e> <Plug> (Neocomplcache_snippets_expand)


"-----------------------------------------------------------------
"Plugin-matchit.vim expands the% command to jump between nested tags and statements
"% forward matching g% reverse matching
"[% locating block first]% locating block tail
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin-vcscommand.vim expands the% command to jump between nested tags and statements
The Svn/git management tool
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin–a.vim
"-----------------------------------------------------------------

Vim config file, highlight + auto indent + line number + collapse + optimize

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.