我的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 mode
set nocompatible
" Enable filetype plugins
filetype on
filetype plugin on
" Sets how many lines of history VIM has to remember
set history=200
" auto indent
set cindent
set smartindent
set autoindent
" fold settings
set foldcolumn=2
set foldmethod=indent
set foldlevel=3
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" highlight current line
set cursorline
" display line numbers
set number
" mouse
set mouse=a
" Configure backspace so it acts as it should act
" set backspace=2
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set 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
endif
else
echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte"
endif
if has("win32")
set guifont=Inconsolata:h12:cANSI
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax on
colorscheme desert
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
" Use Unix as the standard file type
set ffs=unix,dos,mac
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
" Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Compiling && Running
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"compile C
func! CompileGcc()
exec "w"
let compilecmd="!gcc -Wall -pedantic -std=c99 "
let compileflag="-o %<"
exec compilecmd." % ".compileflag
endfunc
"compile C++
func! CompileCpp()
exec "w"
let compilecmd="!g++ -Wall -pedantic -std=c++98 "
let compileflag="-o %<"
exec compilecmd." % ".compileflag
endfunc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugin - ctags.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tags=tags
set 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=1
let Tlist_OnlyWindow=1
let Tlist_Use_Right_Window=0
let Tlist_Sort_Type='name'
let Tlist_Exit_OnlyWindow=1
let Tlist_Show_Menu=1
let Tlist_Max_Submenu_Items=10
let Tlist_Max_Tag_length=20
let Tlist_Use_SingleClick=0
let Tlist_Auto_Open=0
let Tlist_Close_On_Select=0
let Tlist_File_Fold_Auto_Close=1
let Tlist_GainFocus_On_ToggleOpen=0
let Tlist_Process_File_Always=1
let Tlist_WinHeight=10
let Tlist_WinWidth=18
let Tlist_Use_Horiz_Window=0