vimrc.docx
《vimrc.docx》由会员分享,可在线阅读,更多相关《vimrc.docx(13页珍藏版)》请在冰豆网上搜索。
vimrc
"modeline:
jumptoKeymapsettingwhenopenthisfile
"/usr/share/vim/vimcurrent/debian.vim)andsourcedbythecallto:
runtime
"youcanfindbelow.Ifyouwishtochangeanyofthosesettings,youshould
"doitinthisfile(/etc/vim/vimrc),sincedebian.vimwillbeoverwritten
"everytimeanupgradeofthevimpackagesisperformed.Itisrecommendedto
"makechangesaftersourcingdebian.vimsinceitaltersthevalueofthe
"'compatible'option.
"Thislineshouldnotberemovedasitensuresthatvariousoptionsare
"properlysettoworkwiththeVim-relatedpackagesavailableinDebian.
runtime!
debian.vim
"UncommentthenextlinetomakeVimmoreVi-compatible
"NOTE:
debian.vimsets'nocompatible'.Setting'compatible'changesnumerous
"options,soanyotheroptionsshouldbesetAFTERsetting'compatible'.
"setcompatible
"Vim5andlaterversionssupportsyntaxhighlighting.Uncommentingthe
"followingenablessyntaxhighlightingbydefault.
ifhas("syntax")
syntaxon
endif
"Ifusingadarkbackgroundwithintheeditingareaandsyntaxhighlighting
"turnonthisoptionaswell
"setbackground=dark
"UncommentthefollowingtohaveVimjumptothelastpositionwhen
"reopeningafile
"ifhas("autocmd")
"auBufReadPost*ifline("'\"")>1&&line("'\"")<=line("$")|exe"normal!
g'\""|endif
"endif
"UncommentthefollowingtohaveVimloadindentationrulesandplugins
"accordingtothedetectedfiletype.
"ifhas("autocmd")
"filetypepluginindenton
"endif
"Thefollowingarecommentedoutastheycausevimtobehavealot
"differentlyfromregularVi.Theyarehighlyrecommendedthough.
"setshowcmd"Show(partial)commandinstatusline.
"setshowmatch"Showmatchingbrackets.
"setignorecase"Docaseinsensitivematching
"setsmartcase"Dosmartcasematching
"setincsearch"Incrementalsearch
"setautowrite"Automaticallysavebeforecommandslike:
nextand:
make
"sethidden"Hidebufferswhentheyareabandoned
"setmouse=a"Enablemouseusage(allmodes)
"Sourceaglobalconfigurationfileifavailable
iffilereadable("/etc/vim/vimrc.local")
source/etc/vim/vimrc.local
endif
"Thelinesbelowaresetting'smadebyCarl!
!
!
!
!
!
!
!
!
!
!
syntaxenable
syntaxon
"usetheunixfileformat
setfileformat=unix
"theworkingPATH
setpath+=~/.vim,/usr/share/vim/vim73
setnocompatible
setbackspace=2
setexpandtab
settabstop=4
setsofttabstop=4
setshiftwidth=4
setautoindent
setcindent
setsmartindent
setshowcmd
setshowmode
setcinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:
1s
setnumber
setnumberwidth=2
setshowmatch
setruler
if&term=="xterm"
sett_Co=8
sett_Sb=^[[4%dm
sett_Sf=^[[3%dm
endif
setfileencodings=utf-8,gbk,ucs-bom,cp936
setencoding=utf-8
filetypepluginindenton
sethistory=1000
sethlsearch
setincsearch
"==================================================================================
"SETTINGSLEARNEDFORMCVIM
"==================================================================================
"-------------------------------------------------------------------------------
"Wheneditingafile,alwaysjumptothelastknowncursorposition.
"Don'tdoitwhenthepositionisinvalidorwheninsideaneventhandler
"(happenswhendroppingafileongvim).
"-------------------------------------------------------------------------------
ifhas("autocmd")
autocmdBufReadPost*
\ifline("'\"")>0&&line("'\"")<=line("$")|
\exe"normal!
g`\""|
\endif
endif"has("autocmd")
"-------------------------------------------------------------------------------
"Thecurrentdirectoryisthedirectoryofthefileinthecurrentwindow.
"-------------------------------------------------------------------------------
ifhas("autocmd")
autocmdBufEnter*:
lchdir%:
p:
h
endif
"==================================================================================
"===================================================================================
"autobackuptheorginalfile
"setpatchmode=.orig
"setmapleaderto','
letmapleader=","
"usemymouse'sallfunctions
setmouse=a
"setthetagsfile
settags+=~/.vim/systags,../tags,../../tags,../../../tags
"setguimenu
""ToggleMenuandToolbar
"setguioptions-=m
setguioptions-=T
"setguioptions-=r
setguioptions-=L
setguioptions-=e
mapmn:
if&guioptions=~#'T'
\setguioptions-=T
\setguioptions-=m
\setguioptions-=r
\setguioptions-=L
\setguioptions-=e
\else
\setguioptions+=T
\setguioptions+=m
\setguioptions+=r
\setguioptions+=L
\setguioptions+=e
\endif
"usemyowncolorscheme
ifhas("gui_running")
:
colorschemewombat
else
:
colorschememine
endif
"scrolloff2lines
setscrolloff=2
"enablehelpmenuwhentapeTAB
setwildmenu
"disbletheautocommentwhenhitCRoro
autocmdFileType*setlocalformatoptions-=cformatoptions-=rformatoptions-=o
"setfoldmethodsyntax
autocmdFileTypec,cpp,hsetlfoldmethod=syntax
autocmdFileTypec,cpp,hexe"normalzR"
"setfoldlevelstart=99
setfoldcolumn=2
"setgccforapue
"setmakeprg=gcc\-Wall\-o%<\%\-lapue\-g\-I~/unpv13e_src/include
"setgccforunp
"setmakeprg=gcc\-I/home/carl/unpv13e_src/lib\-g\-O2\-D_REENTRANT\-Wall\-o%<\%\-lunp\-lpthread
mapgd:
setmakeprg+=\-g
"####################PLUGINS###############################
"#########################################################"
"enabletaglist
letTlist_Show_One_File=1
letTlist_Exit_OnlyWindow=1
letTlist_Show_Menu=1
"winManagersetting
letg:
winManagerWindowLayout="NERDTree|TagList"
letg:
winManagerWidth=30
letg:
defaultExplorer=0
nmapmm:
ifIsWinManagerVisible()WMToggleelseWMToggle:
qendif
"enableTHENERDTREE"
letg:
NERDTree_title="[NERDTree]"
function!
NERDTree_Start()
exec'NERDTree'
endfunction
function!
NERDTree_IsValid()
return1
endfunction
letg:
NERDChristmasTree=1
"setNERDTREECWDchangable
letg:
NERDTreeChDirMode=2
"shortcuttogeneratetags
map:
!
ctags-R--c++-kinds=+p--fields=+iaS--extra=+q.
"===========COMPLETE===============================================
inoremap
inoremappumvisible()?
"\":
"\"
"useOmniCppcompletetoperformOmniComplete
inoremap
letOmniCpp_SelectFirstItem=1
letOmniCpp_MayCompleteScope=1
setcompleteopt=menu
"enableNeocomplcache
"letg:
neocomplcache_enable_at_startup=0
"letg:
neocomplcache_disable_auto_complete=1
"letg:
neocomplcache_enable_auto_select=1
"functionnamecompletion
"inoremapneocomplcache#manual_filename_complete()
"smartcolsepopupcompletemenu
imappumvisible()?
"\":
"\"
"mapbelowhasbeenoverlappedbyAutoClose
"imapneocomplcache#close_popup()."\"
imapneocomplcache#close_popup()."\"
"autoclose{
"inoremap{{o}:
letleavechar="}"O
"std_Csyntax
"letc_syntax_for_h=1
letc_C94=1
"letc_C99_warn=1
letc_cpp_warn=1
letc_warn_8bitchars=1
letc_warn_multichar=1
letc_warn_digraph=1
letc_warn_trigraph=1
"letc_no_octal=1
letc_cpp_comments=0
"letc_comment_strings=1
letc_comment_numbers=1
"letc_comment_types=1
letc_comment_date_time=1
letc_no_utf=1
"==========================================================================
"enableminibufexp"
"letg:
miniBufExplMapWindowNavVim=1
"letg:
miniBufExplMapWindowNavArrows=1
"letg:
miniBufExplMapCTabSwitchBufs=1
"letg:
miniBufExplModSelTarget=1
"===================settingsforcvim===================================
"letg:
C_Ctrl_j='off'
"=======================================================================
"####################################################################
"###################################################################
"####################KEYMAPS########################################
"############################################################################
setcpo&vim
"disbletheALTmenu
setwinaltkeys=no
"set'selection','selectmode','mousemodel'and'keymodel'forMS-Windows
behavemswin
"-------------------------------------------------------------------------------
"someadditionalhotkeys
"-------------------------------------------------------------------------------
"F3-callfileexplorerEx
"F4-showtagundercurserinthepreviewwindow(tagfilemustexist!
)
"F5-openquickfixerrorwindow
"F6-closequickfixerrorwindow
"F7-displaypreviouserror
"F8-displaynexterror
"-------------------------------------------------------------------------------
"
map:
Explore
nmap:
exe":
ptag".expand("")
map:
copen
map:
cclose
map:
cp
map:
cn
"
imap:
Explore
imap:
exe":
ptag".expand("")
imap:
copen
imap:
cclose
imap:
cp
imap:
cn"-------------------------------------------------------------------------------
"commaalwaysfollowedbyaspace
"-------------------------------------------------------------------------------
inoremap,,
"-------------------------------------------------------------------------------
"autocompleteparenthesis,bracketsandbraces
"-------------------------------------------------------------------------------
inoremap(()
inoremap[[]
inoremap{{}
"
vnoremap(s()P%
vnoremap[s[]P%
vnoremap{s{}