VIM配置文件

来源:互联网 发布:宜州市一中网络硬盘 编辑:程序博客网 时间:2024/05/29 17:14

 我的vim配置文件,放这里保存一下,防止某一天重装系统忘记备份没了。


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" DesCRiption: for Linux" Last Change: 2012-11-4 " Author:      linzhi"" Sections:"    -> General"    -> VIM user interface"    -> Files, backups and undo"    -> Text, tab and indent related"    -> Multi-lingual environment"    -> Colors and Fonts"    -> Spell checking"    -> Compiling && Running"    -> Plugin - ctags.vim"    -> Plugin - taglist.vim """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => General"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" close vi compatibility modeset nocompatible" Enable filetype pluginsfiletype onfiletype plugin on" Sets how many lines of history VIM has to rememberset history=200         " auto indentset cindentset smartindentset autoindent" fold settingsset foldcolumn=2set foldmethod=indentset foldlevel=3"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => VIM user interface"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" highlight current lineset cursorline" display line numbersset number" mouseset mouse=a" Configure backspace so it acts as it should act" set backspace=2set backspace=eol,start,indentset whichwrap+=<,>,h,l" Highlight search resultsset hlsearch" Makes search act like search in modern browsersset incsearch" Don't redraw while executing macros (good performance config)set lazyredraw" For regular expressions turn magic onset magic" Show matching brackets when text indicator is over themset showmatch" How many tenths of a second to blink when matching bracketsset mat=2"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Files, backups and undo"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Turn backup off, since most stuff is in SVN, git et.c anyway...set nobackupset nowbset noswapfile"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Text, tab and indent related"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Use spaces instead of tabsset expandtab" Be smart when using tabs ;)set smarttab" 1 tab == 4 spacesset shiftwidth=4set tabstop=4" Linebreak on 500 charactersset lbrset tw=500set ai "Auto indentset si "Smart indentset wrap "Wrap lines"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Multi-lingual environment"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""if has("multi_byte")    " UTF-8    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"endifif has("win32")    set guifont=Inconsolata:h12:cANSIendif"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Colors and Fonts"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Enable syntax highlightingsyntax oncolorscheme desert" Set utf8 as standard encoding and en_US as the standard languageset encoding=utf-8set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936" Use Unix as the standard file typeset ffs=unix,dos,mac"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Spell checking"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Pressing ,ss will toggle and untoggle spell checkingmap <leader>ss :setlocal spell!<cr>" Shortcuts using <leader>map <leader>sn ]smap <leader>sp [smap <leader>sa zgmap <leader>s? z="""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Compiling && Running""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""compile Cfunc! CompileGcc()    exec "w"    let compilecmd="!gcc -Wall -pedantic -std=c99 "    let compileflag="-o %<"    exec compilecmd." % ".compileflagendfunc"compile C++func! CompileCpp()    exec "w"    let compilecmd="!g++ -Wall -pedantic -std=c++98 "    let compileflag="-o %<"    exec compilecmd." % ".compileflagendfunc"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" => Plugin - ctags.vim"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""set tags=tagsset autochdir""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugin - taglist.vim """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""if has("win32")   let Tlist_Ctags_Cmd = $VIMFILES.'/ctags.exe' " location of ctags tool else   let Tlist_Ctags_Cmd = '/usr/bin/ctags' endif let Tlist_Show_One_File=1let Tlist_OnlyWindow=1let Tlist_Use_Right_Window=0let Tlist_Sort_Type='name'let Tlist_Exit_OnlyWindow=1let Tlist_Show_Menu=1let Tlist_Max_Submenu_Items=10let Tlist_Max_Tag_length=20let Tlist_Use_SingleClick=0let Tlist_Auto_Open=0let Tlist_Close_On_Select=0let Tlist_File_Fold_Auto_Close=1let Tlist_GainFocus_On_ToggleOpen=0let Tlist_Process_File_Always=1let Tlist_WinHeight=10let Tlist_WinWidth=18let Tlist_Use_Horiz_Window=0