将以下内容加入~/.vimrc中,记得先备份
ifv:progname=~?"evim"
finish
endif
"UseVimsettings,ratherthenVisettings(muchbetter!).
"Thismustbefirst,becauseitchangesotheroptionsasasideeffect.
setnocompatible
"allowbackspacingovereverythingininsertmode
setbackspace=indent,eol,start
ifhas("vms")
setnobackup"donotkeepabackupfile,useversionsinstead
else
setbackup"keepabackupfile
endif
sethistory=50"keep50linesofcommandlinehistory
setruler"showthecursorpositionallthetime
setshowcmd"displayincompletecommands
setincsearch"doincrementalsearching
"ForWin32GUI:remove't'flagfrom'guioptions':notearoffmenuentries
"let&guioptions=substitute(&guioptions,"t","","g")
"Don'tuseExmode,useQforformatting
mapQgq
"Thisisanalternativethatalsoworksinblockmode,butthedeleted
"textislostanditonlyworksforputtingthecurrentregister.
"vnoremapp"_dp
"Switchsyntaxhighlightingon,whentheterminalhascolors
"Alsoswitchonhighlightingthelastusedsearchpattern.
if&t_Co>2||has("gui_running")
syntaxon
sethlsearch
endif
"Onlydothispartwhencompiledwithsupportforautocommands.
ifhas("autocmd")
"Enablefiletypedetection.
"Usethedefaultfiletypesettings,sothatmailgets'tw'setto72,
"'cindent'isoninCfiles,etc.
"Alsoloadindentfiles,toautomaticallydolanguage-dependentindenting.
filetypepluginindenton
"Puttheseinanautocmdgroup,sothatwecandeletethemeasily.
augroupvimrcEx
au!
"Foralltextfilesset'textwidth'to78characters.
autocmdFileTypetextsetlocaltextwidth=78
"Wheneditingafile,alwaysjumptothelastknowncursorposition.
"Don'tdoitwhenthepositionisinvalidorwheninsideaneventhandler
"(happenswhendroppingafileongvim).
autocmdBufReadPost*
/ifline("'/"")>0&&line("'/"")<=line("$")|
/exe"normalg`/""|
/endif
augroupEND
else
setautoindent"alwayssetautoindentingon
endif"has("autocmd")