现在的位置: 首页 > 综合 > 正文

vim配置

2013年11月26日 ⁄ 综合 ⁄ 共 4610字 ⁄ 字号 评论关闭

".vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" "For ctags, then it can find the 'tags' file even not in current directory
set tags=tags;/
"
"Get out of VI's compatible mode..
set nocompatible

"Sets how many lines of history VIM har to remember
set history=400
"Set to auto read when a file is changed from the outside
set autoread
"Have the mouse enabled all the time:
"when you need to copy from vim, maybe you have to ':set mouse=' first
set mouse=a

"""""""""""""""""""""""""""""""""""""
" Colors and Fonts
"""""""""""""""""""""""""""""""""""""
"Enable syntax highlight
syntax enable

"set colorscheme
colorscheme elflord
"endif

"""""""""""""""""""""""""""""""""""""
" VIM userinterface
"""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors away from the border- when moving vertical..
set so=7

"Turn on WiLd menu
set wildmenu

"Always show current position
set ruler

"The commandbar is 2 high
set cmdheight=2

"Show line number
set nu

"Set backspace
set backspace=eol,start,indent

"Bbackspace and cursor keys wrap to
set whichwrap+=<,>,h,l

"show matching bracets
set showmatch

"How many tenths of a second to blink
set mat=2

"Highlight search things
set hlsearch
"imediately show the search result
set is

"""""""""""""""""""""""""""""""""""""
" Folding
"""""""""""""""""""""""""""""""""""""
"Enable folding, I find it very useful
set nofen
set fdl=0

"""""""""""""""""""""""""""""""""""""
" Text options
"""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=2
set ambiwidth=double
set smarttab
"Set Tab=4 spaces
set ts=4
set lbr
set tw=500
set selection=inclusive
   """"""""""""""""""""""""""""""
   " Indent
   """"""""""""""""""""""""""""""
   "Auto indent
   set ai
   "Set auto indent width = 4 spaces
   set sw=4

   "Smart indet
   set si

   "C-style indenting
   set cindent "usage: select codes, press '=' key, the codes will autoindenting

   "Wrap lines
   set wrap

"Encoding settings
if has("multi_byte")
    " Set fileencoding priority
    if getfsize(expand("%")) > 0
        set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
    else
        set fileencodings=cp936,big5,euc-jp,euc-kr,latin1
    endif

    " CJK environment detection and corresponding setting
    if v:lang =~ "^zh_CN"
        " Use cp936 to support GBK, euc-cn == gb2312
        set encoding=cp936
        set termencoding=cp936
        set fileencoding=cp936
    elseif v:lang =~ "^zh_TW"
        " cp950, big5 or euc-tw
        " Are they equal to each other?
        set encoding=big5
        set termencoding=big5
        set fileencoding=big5
    elseif v:lang =~ "^ko"
        " Copied from someone's dotfile, untested
        set encoding=euc-kr
        set termencoding=euc-kr
        set fileencoding=euc-kr
    elseif v:lang =~ "^ja_JP"
        " Copied from someone's dotfile, unteste
        set encoding=euc-jp
        set termencoding=euc-jp
        set fileencoding=euc-jp
    endif
    " Detect UTF-8 locale, and replace CJK setting if needed
    if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
        set encoding=utf-8
        set termencoding=utf-8
        set fileencoding=utf-8
    endif
else
    echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif

set cscopequickfix=s-,c-,d-,i-,t-,e-

"--MiniBufferExplorer--"
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 0
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1
let g:netrw_winsize=30

let g:bufExplorerDfaultHelp=0
let g:bufExplorerShowRelativePath=1
let g:bufExplorerSortBy='mru'
let g:bufExplorerSplitRight=0
let g:bufExplorerSplitVertical=1
let g:bufExplorerSplitVertSize=30
let g:bufExplorerUseCurrentWindow=0
autocmd BufWinEnter \[Buf\ List\] setl nonumber

"""""""""""""""""""""""""""""""""""""
"plugins

"""""""""""""""""""""""""""""""""""""
" Tlist
if &diff
let Tlist_Auto_Open=0 "don't auto pen when compare two files
else
let Tlist_Auto_Open=1 "auto pen Tlist when open a file
endif

"set taglist window in right, delete the following line if you don't like
let Tlist_Use_Right_Window=0
let Tlist_Auto_Update=1
let Tlist_Show_One_File=1
let Tlist_File_Fold_Auto_Close=1
"auto close Tlist when exiting file.
let Tlist_Exit_OnlyWindow = 1
let Tlist_Inc_Windwidth=0

nmap <F7> :copen<CR>
nmap <F6> :cclose<CR>
nmap <F8> :cn<CR>
nmap <F9> :cp<CR>
let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWidth = 30
let g:defaultExplorer = 0
nmap <F5> :WMToggle<CR>
"nmap wm:WMToggle<CR>

let g:DoxygenToolkit_paramTag_pre="@Param "
let g:DoxygenToolkit_returnTag="@Returns "
let g:DoxygenToolkit_authorName="devilcash "
let g:DoxygenToolkit_licenseTag="ABC"
let g:DoxygenToolkit_versionString="1.1.0"
let g:DoxygenToolkit_briefTag_funcName="yes"

map <F3>a :DoxAuthor<Enter>
map <F3>f :Dox<Enter>
map <F3>b :DoxBlock
map <F3>1 O/** */<Left><Left>
map <F3>2 O/**+------------------------ ------------------------+*/<Left><Left>
map <F3>3 O/**< */<Right><Right>
map <F3>4 O///<Right><Right>

let proj_flags="imstcg"

set encoding=utf-8
set termencoding=utf-8,gbk,ucs-bom,cp936
set fileencodings=utf-8,gbk,ucs-bom,cp936

let g:SuperTabMappingForward="<tab>"

抱歉!评论已关闭.