VIM7.3 settings (for Windows)

Source: Internet
Author: User
Tags php tutorial
The solution of Gvim garbled problem

Vim has four options related to character encoding: encoding, fileencoding, Fileencodings, termencoding (the possible values for these options are referenced in the VIM online Help: Encoding-names), their respective meanings: The character encoding used internally by the
* Encoding:vim, including the buffer of Vim, menu text, message text, and so on. The user manual recommends changing its value only in. VIMRC, which in fact seems to only make sense if you change its value in. vimrc.
* The character encoding of the file currently being edited in the Fileencoding:vim, and Vim saves the file as a character encoding (regardless of whether the new file is the same).
* Fileencodings:vim starts by detecting the character encoding of the file to be opened by the character encoding it lists, and fileencoding is set to the final detected character encoding. It is therefore best to place Unicode encoding at the top of this list, Latin1 Latin encoding to the last side.
* The character encoding of the terminal (or the Console window of Windows) that the Termencoding:vim is working on. This option is not valid for the gVim of our common GUI mode under Windows, and for Vim of the console mode is the code page of the Windows console, and usually we do not need to change it.
Because Unicode can contain characters in almost all languages, Unicode's UTF-8 encoding is a very cost-effective way to encode, so the value of encoding is set to Utf-8. When encoding is set to Utf-8 at the same time, the Vim automatic detection file is encoded in a more accurate manner. In the Chinese Windows editing files, in order to take into account the compatibility with other software, file encoding or set to GB2312/GBK more appropriate, so fileencoding recommended set to Chinese (Chinese is an individual name, in Unix gb2312, CP936 is represented in Windows, which is the GBK code page.
finally for the file display garbled, menu garbled, right-click menu garbled and conlse output garbled problem solution, modify the Vim editor corresponding to the configuration file _VIMRC, add the following configuration:

"Close the upper side toolbar
Set go-=t
"Close the right scroll bar
The Set Go-=r

"Always show labels. 0: not displayed; 1: More than 1 display
Set showtabline=2

"Turn on line numbers
Set number
"Turn on auto indent, version 7.3 is automatically turned on
The Set Autoindent
"Indent width is 4 characters
Set shiftwidth=4
"tab width is 4 characters
Set tabstop=4
"Replace all tabs with spaces when editing
Set ET
"Delete 4 spaces at once backspace
Set Smarttab
The color scheme
Colo Desert
"Turn on syntax highlighting, version 7.3 is automatically turned on
"Syntax on
The font settings
Set Guifont=courier_new:h10
"Turn off compatibility mode
Set nocompatible
"The following three lines simulate Windows operations, such as CTRL-C replication
SOURCE $VIMRUNTIME/vimrc_example.vim
SOURCE $VIMRUNTIME/mswin.vim
Behave Mswin
"Do not generate backup files, the following sentence to write under the behave mswin, otherwise it will generate a backup, do not know why ~
Set Nobackup
"Gvim Internal code
Set Encoding=utf-8
The currently edited file encoding
Set Fileencoding=utf-8
"Gvim supports open file encoding
Set Fileencodings=utf-8,gbk,gb2312,big5,latin1
"Fix menu and right-click menu garbled
SOURCE $VIMRUNTIME/delmenu.vim
SOURCE $VIMRUNTIME/menu.vim
"Resolving Consle output garbled
Language Messages Zh_cn.utf-8
"Set Linux terminal to Gvim internal encoding, Windows can not set
Let &termencoding=&encoding
"Prevents special symbols from appearing properly, such as Pentagram
Set ambiwidth=double
Set Diffexpr=mydiff ()
function Mydiff ()
Let opt = '-a--binary '
If &diffopt =~ ' icase ' | Let opt = opt. '-I ' | endif
If &diffopt =~ ' Iwhite ' | Let opt = opt. '-B ' | endif
Let arg1 = v:fname_in
If Arg1 =~ ' | Let arg1 = ' "'. Arg1. '"' | endif
Let arg2 = V:fname_new
If Arg2 =~ ' | Let arg2 = ' "'. Arg2. '"' | endif
Let Arg3 = V:fname_out
If Arg3 =~ ' | Let Arg3 = ' "'. Arg3. '"' | endif
Let eq = '
If $VIMRUNTIME =~ '
If &sh =~ ' \ <>
Let cmd = ' "". $VIMRUNTIME. ' \diff '
Let eq = ' "'
Else
Let cmd = substitute ($VIMRUNTIME, "', '" ', '). ' \diff "'
endif
Else
Let cmd = $VIMRUNTIME. ' \diff '
endif
Silent execute '! '. Cmd. ' ' . Opt. Arg1. ' ' . Arg2. ' > '. Arg3. eq
Endfunction

Auto-complete, version 7.3 is automatically turned on
Autocmd FileType JavaScript Set Omnifunc=javascriptcomplete#completejs
Autocmd FileType HTML Set omnifunc=htmlcomplete#completetags
Autocmd FileType CSS Set omnifunc=csscomplete#completecss
Autocmd FileType XML Set Omnifunc=xmlcomplete#completetags
Autocmd FileType PHP Set omnifunc=phpcomplete#completephp
Autocmd FileType C Set Omnifunc=ccomplete#complete

The above describes the VIM7.3 settings (for Windows), including aspects of the content, you want to be interested in PHP tutorial friends helpful.

  • 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.