vim 閰嶇疆鏂囦欢

灏嗕竴涓嬩唬鐮乧opy鍒� 鐢ㄦ埛鐩綍涓� 鏂板缓鏂囦欢涓郝� .vimrc

淇濆瓨鍗冲彲鐢熸晥锛� 濡傛灉鎯虫墍鏈夌敤鎴风敓鏁� 璇蜂慨鏀� /etc/vimrc (寤鸿鍏坈p涓�浠�)

"=========================================================================

" DesCRiption: 閫傚悎鑷繁浣跨敤鐨剉imrc鏂囦欢锛宖or Linux/Windows, GUI/Console

"

" Last Change: 2010骞�08鏈�02鏃� 15鏃�13鍒�

"

" Version: 1.80

"

"=========================================================================

set nocompatible " 鍏抽棴 vi 鍏煎妯″紡

syntax on " 鑷姩璇硶楂樹寒

colorscheme molokai " 璁惧畾閰嶈壊鏂规

set number " 鏄剧ず琛屽彿

set cursorline " 绐佸嚭鏄剧ず褰撳墠琛�

set ruler " 鎵撳紑鐘舵�佹爮鏍囧昂

set shiftwidth=4 " 璁惧畾 << 鍜� >> 鍛戒护绉诲姩鏃剁殑瀹藉害涓� 4

set softtabstop=4 " 浣垮緱鎸夐��鏍奸敭鏃跺彲浠ヤ竴娆″垹鎺� 4 涓┖鏍�

set tabstop=4 " 璁惧畾 tab 闀垮害涓� 4

set nobackup " 瑕嗙洊鏂囦欢鏃朵笉澶囦唤

set autochdir " 鑷姩鍒囨崲褰撳墠鐩綍涓哄綋鍓嶆枃浠舵墍鍦ㄧ殑鐩綍

filetype plugin indent on " 寮�鍚彃浠�

set backupcopy=yes " 璁剧疆澶囦唤鏃剁殑琛屼负涓鸿鐩�

set ignorecase smartcase " 鎼滅储鏃跺拷鐣ュぇ灏忓啓锛屼絾鍦ㄦ湁涓�涓垨浠ヤ笂澶у啓瀛楁瘝鏃朵粛淇濇寔瀵瑰ぇ灏忓啓鏁忔劅

set nowrapscan " 绂佹鍦ㄦ悳绱㈠埌鏂囦欢涓ょ鏃堕噸鏂版悳绱�

set incsearch " 杈撳叆鎼滅储鍐呭鏃跺氨鏄剧ず鎼滅储缁撴灉

set hlsearch " 鎼滅储鏃堕珮浜樉绀鸿鎵惧埌鐨勬枃鏈�

set noerrorbells " 鍏抽棴閿欒淇℃伅鍝嶉搩

set novisualbell " 鍏抽棴浣跨敤鍙鍝嶉搩浠f浛鍛煎彨

set t_vb= " 缃┖閿欒閾冨0鐨勭粓绔唬鐮�

" set showmatch " 鎻掑叆鎷彿鏃讹紝鐭殏鍦拌烦杞埌鍖归厤鐨勫搴旀嫭鍙�

" set matchtime=2 " 鐭殏璺宠浆鍒板尮閰嶆嫭鍙风殑鏃堕棿

set magic " 璁剧疆榄旀湳

set hidden " 鍏佽鍦ㄦ湁鏈繚瀛樼殑淇敼鏃跺垏鎹㈢紦鍐插尯锛屾鏃剁殑淇敼鐢� vim 璐熻矗淇濆瓨

set guioptions-=T " 闅愯棌宸ュ叿鏍�

set guioptions-=m " 闅愯棌鑿滃崟鏍�

set smartindent " 寮�鍚柊琛屾椂浣跨敤鏅鸿兘鑷姩缂╄繘

set backspace=indent,eol,start

" 涓嶈瀹氬湪鎻掑叆鐘舵�佹棤娉曠敤閫�鏍奸敭鍜� Delete 閿垹闄ゅ洖杞︾

set cmdheight=1 " 璁惧畾鍛戒护琛岀殑琛屾暟涓� 1

set laststatus=2 " 鏄剧ず鐘舵�佹爮 (榛樿鍊间负 1, 鏃犳硶鏄剧ず鐘舵�佹爮)

set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\

" 璁剧疆鍦ㄧ姸鎬佽鏄剧ず鐨勪俊鎭�

set foldenable " 寮�濮嬫姌鍙�

set foldmethod=syntax " 璁剧疆璇硶鎶樺彔

set foldcolumn=0 " 璁剧疆鎶樺彔鍖哄煙鐨勫搴�

setlocal foldlevel=1 " 璁剧疆鎶樺彔灞傛暟涓�

" set foldclose=all " 璁剧疆涓鸿嚜鍔ㄥ叧闂姌鍙�

" nnoremap @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')

" 鐢ㄧ┖鏍奸敭鏉ュ紑鍏虫姌鍙�

" return OS type, eg: windows, or linux, mac, et.st..

function! MySys()

if has("win16") || has("win32") || has("win64") || has("win95")

return "windows"

elseif has("unix")

return "linux"

endif

endfunction

" 鐢ㄦ埛鐩綍鍙橀噺$VIMFILES

if MySys() == "windows"

let $VIMFILES = $VIM.'/vimfiles'

elseif MySys() == "linux"

let $VIMFILES = $HOME.'/.vim'

endif

" 璁惧畾doc鏂囨。鐩綍

let helptags=$VIMFILES.'/doc'

" 璁剧疆瀛椾綋 浠ュ強涓枃鏀寔

if has("win32")

set guifont=Inconsolata:h12:cANSI

endif

" 閰嶇疆澶氳瑷�鐜

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

" Buffers鎿嶄綔蹇嵎鏂瑰紡!

nnoremap :bnext

nnoremap :bprevious

" Tab鎿嶄綔蹇嵎鏂瑰紡!

nnoremap :tabnext

nnoremap :tabprev

"鍏充簬tab鐨勫揩鎹烽敭

" map tn :tabnext

" map tp :tabprevious

" map td :tabnew .

" map te :tabedit

" map tc :tabclose

"绐楀彛鍒嗗壊鏃�,杩涜鍒囨崲鐨勬寜閿儹閿渶瑕佽繛鎺ヤ袱娆�,姣斿浠庝笅鏂圭獥鍙gЩ鍔�

"鍏夋爣鍒颁笂鏂圭獥鍙�,闇�瑕乲,闈炲父楹荤儲,鐜板湪閲嶆槧灏勪负,鍒囨崲鐨�

"鏃跺�欎細鍙樺緱闈炲父鏂逛究.

nnoremap h

nnoremap j

nnoremap k

nnoremap l

"涓�浜涗笉閿欑殑鏄犲皠杞崲璇硶锛堝鏋滃湪涓�涓枃浠朵腑娣峰悎浜嗕笉鍚岃瑷�鏃舵湁鐢級

nnoremap 1 :set filetype=xhtml

nnoremap 2 :set filetype=css

nnoremap 3 :set filetype=javascript

nnoremap 4 :set filetype=php

" set fileformats=unix,dos,mac

" nmap fd :se fileformat=dos

" nmap fu :se fileformat=unix

" use Ctrl+[l|n|p|cc] to list|next|previous|jump to count the result

" map l :cl

" map n :cn

" map p :cp

" map c :cc

" 璁� Tohtml 浜х敓鏈� CSS 璇硶鐨� html

" syntax/2html.vim锛屽彲浠ョ敤:runtime! syntax/2html.vim

let html_use_css=1

" Python 鏂囦欢鐨勪竴鑸缃紝姣斿涓嶈 tab 绛�

autocmd FileType python set tabstop=4 shiftwidth=4 expandtab

autocmd FileType python map :!python %

" 閫変腑鐘舵�佷笅 Ctrl+c 澶嶅埗

vmap "+y

" 鎵撳紑javascript鎶樺彔

let b:javascript_fold=1

" 鎵撳紑javascript瀵筪om銆乭tml鍜宑ss鐨勬敮鎸�

let javascript_enable_domhtmlcss=1

" 璁剧疆瀛楀吀 ~/.vim/dict/鏂囦欢鐨勮矾寰�

autocmd filetype javascript set dictionary=$VIMFILES/dict/javascript.dict

autocmd filetype css set dictionary=$VIMFILES/dict/css.dict

autocmd filetype php set dictionary=$VIMFILES/dict/php.dict

"-----------------------------------------------------------------

" plugin - bufexplorer.vim Buffers鍒囨崲

" \be 鍏ㄥ睆鏂瑰紡鏌ョ湅鍏ㄩ儴鎵撳紑鐨勬枃浠跺垪琛�

" \bv 宸﹀彸鏂瑰紡鏌ョ湅 \bs 涓婁笅鏂瑰紡鏌ョ湅

"-----------------------------------------------------------------

"-----------------------------------------------------------------

" plugin - taglist.vim 鏌ョ湅鍑芥暟鍒楄〃锛岄渶瑕乧tags绋嬪簭

" F4 鎵撳紑闅愯棌taglist绐楀彛

"-----------------------------------------------------------------

if MySys() == "windows" " 璁惧畾windows绯荤粺涓璫tags绋嬪簭鐨勪綅缃�

let Tlist_Ctags_Cmd = '"'.$VIMRUNTIME.'/ctags.exe"'

elseif MySys() == "linux" " 璁惧畾windows绯荤粺涓璫tags绋嬪簭鐨勪綅缃�

let Tlist_Ctags_Cmd = '/usr/bin/ctags'

endif

nnoremap :TlistToggle

let Tlist_Show_One_File = 1 " 涓嶅悓鏃舵樉绀哄涓枃浠剁殑tag锛屽彧鏄剧ず褰撳墠鏂囦欢鐨�

let Tlist_Exit_OnlyWindow = 1 " 濡傛灉taglist绐楀彛鏄渶鍚庝竴涓獥鍙o紝鍒欓��鍑簐im

let Tlist_Use_Right_Window = 1 " 鍦ㄥ彸渚х獥鍙d腑鏄剧ずtaglist绐楀彛

let Tlist_File_Fold_Auto_Close=1 " 鑷姩鎶樺彔褰撳墠闈炵紪杈戞枃浠剁殑鏂规硶鍒楄〃

let Tlist_Auto_Open = 0

let Tlist_Auto_Update = 1

let Tlist_Hightlight_Tag_On_BufEnter = 1

let Tlist_Enable_Fold_Column = 0

let Tlist_Process_File_Always = 1

let Tlist_Display_Prototype = 0

let Tlist_Compact_Format = 1

"-----------------------------------------------------------------

" plugin - mark.vim 缁欏悇绉峵ags鏍囪涓嶅悓鐨勯鑹诧紝渚夸簬瑙傜湅璋冨紡鐨勬彃浠躲��

" \m mark or unmark the word under (or before) the cursor

" \r manually input a regular expression. 鐢ㄤ簬鎼滅储.

" \n clear this mark (i.e. the mark under the cursor), or clear all highlighted marks .

" \* 褰撳墠MarkWord鐨勪笅涓�涓� \# 褰撳墠MarkWord鐨勪笂涓�涓�

" \/ 鎵�鏈塎arkWords鐨勪笅涓�涓� \? 鎵�鏈塎arkWords鐨勪笂涓�涓�

"-----------------------------------------------------------------

"-----------------------------------------------------------------

" plugin - NERD_tree.vim 浠ユ爲鐘舵柟寮忔祻瑙堢郴缁熶腑鐨勬枃浠跺拰鐩綍

" :ERDtree 鎵撳紑NERD_tree :NERDtreeClose 鍏抽棴NERD_tree

" o 鎵撳紑鍏抽棴鏂囦欢鎴栬�呯洰褰� t 鍦ㄦ爣绛鹃〉涓墦寮�

" T 鍦ㄥ悗鍙版爣绛鹃〉涓墦寮� ! 鎵ц姝ゆ枃浠�

" p 鍒颁笂灞傜洰褰� P 鍒版牴鐩綍

" K 鍒扮涓�涓妭鐐� J 鍒版渶鍚庝竴涓妭鐐�

" u 鎵撳紑涓婂眰鐩綍 m 鏄剧ず鏂囦欢绯荤粺鑿滃崟锛堟坊鍔犮�佸垹闄ゃ�佺Щ鍔ㄦ搷浣滐級

" r 閫掑綊鍒锋柊褰撳墠鐩綍 R 閫掑綊鍒锋柊褰撳墠鏍圭洰褰�

"-----------------------------------------------------------------

" F3 NERDTree 鍒囨崲

map :NERDTreeToggle

imap :NERDTreeToggle

"-----------------------------------------------------------------

" plugin - NERD_commenter.vim 娉ㄩ噴浠g爜鐢ㄧ殑锛�

" [count],cc 鍏夋爣浠ヤ笅count琛岄�愯娣诲姞娉ㄩ噴(7,cc)

" [count],cu 鍏夋爣浠ヤ笅count琛岄�愯鍙栨秷娉ㄩ噴(7,cu)

" [count],cm 鍏夋爣浠ヤ笅count琛屽皾璇曟坊鍔犲潡娉ㄩ噴(7,cm)

" ,cA 鍦ㄨ灏炬彃鍏� /* */,骞朵笖杩涘叆鎻掑叆妯″紡銆� 杩欎釜鍛戒护鏂逛究鍐欐敞閲娿��

" 娉細count鍙傛暟鍙�夛紝鏃犲垯榛樿涓洪�変腑琛屾垨褰撳墠琛�

"-----------------------------------------------------------------

let NERDSpaceDelims=1 " 璁╂敞閲婄涓庤鍙ヤ箣闂寸暀涓�涓┖鏍�

let NERDCompactSexyComs=1 " 澶氳娉ㄩ噴鏃舵牱瀛愭洿濂界湅

"-----------------------------------------------------------------

" plugin - DoxygenToolkit.vim 鐢辨敞閲婄敓鎴愭枃妗o紝骞朵笖鑳藉蹇�熺敓鎴愬嚱鏁版爣鍑嗘敞閲�

"-----------------------------------------------------------------

let g:DoxygenToolkit_authorName="Asins - asinsimple AT gmail DOT com"

let g:DoxygenToolkit_briefTag_funcName="yes"

map da :DoxAuthor

map df :Dox

map db :DoxBlock

map dc a /* */

"-----------------------------------------------------------------

" plugin 鈥� ZenCoding.vim 寰堥叿鐨勬彃浠讹紝HTML浠g爜鐢熸垚

" 鎻掍欢鏈�鏂扮増锛歨ttp://github.com/mattn/zencoding-vim

" 甯哥敤鍛戒护鍙湅锛歨ttp://nootn.com/blog/Tool/23/

"-----------------------------------------------------------------

"-----------------------------------------------------------------

" plugin 鈥� checksyntax.vim JavaScript甯歌璇硶閿欒妫�鏌�

" 榛樿蹇嵎鏂瑰紡涓� F5

"-----------------------------------------------------------------

let g:checksyntax_auto = 0 " 涓嶈嚜鍔ㄦ鏌�

"-----------------------------------------------------------------

" plugin - NeoComplCache.vim 鑷姩琛ュ叏鎻掍欢

"-----------------------------------------------------------------

let g:AutoComplPop_NotEnableAtStartup = 1

let g:NeoComplCache_EnableAtStartup = 1

let g:NeoComplCache_SmartCase = 1

let g:NeoComplCache_TagsAutoUpdate = 1

let g:NeoComplCache_EnableInfo = 1

let g:NeoComplCache_EnableCamelCaseCompletion = 1

let g:NeoComplCache_MinSyntaxLength = 3

let g:NeoComplCache_EnableSkipCompletion = 1

let g:NeoComplCache_SkipInputTime = '0.5'

let g:NeoComplCache_SnippetsDir = $VIMFILES.'/snippets'

" completion.

inoremap pumvisible() ? "\" : "\"

" snippets expand key

imap (neocomplcache_snippets_expand)

smap (neocomplcache_snippets_expand)

"-----------------------------------------------------------------

" plugin - matchit.vim 瀵�%鍛戒护杩涜鎵╁睍浣垮緱鑳藉湪宓屽鏍囩鍜岃鍙ヤ箣闂磋烦杞�

" % 姝e悜鍖归厤 g% 鍙嶅悜鍖归厤

" [% 瀹氫綅鍧楅 ]% 瀹氫綅鍧楀熬

"-----------------------------------------------------------------

"-----------------------------------------------------------------

" plugin - vcscommand.vim 瀵�%鍛戒护杩涜鎵╁睍浣垮緱鑳藉湪宓屽鏍囩鍜岃鍙ヤ箣闂磋烦杞�

" SVN/git绠$悊宸ュ叿

"-----------------------------------------------------------------

"-----------------------------------------------------------------

" plugin 鈥� a.vim

"-----------------------------------------------------------------

你可能感兴趣的:(vim 閰嶇疆鏂囦欢)