我的vim windows下配置

來源:互聯網
上載者:User
"*******************************************"全域條件"*******************************************"設定作業系統if has("win32") || has("win64") || has("win32unix")    let g:isWin = 1else    let g:isWin = 0endif
"*******************************************"end全域條件 "*******************************************

"*******************************************"常規"*******************************************
"檔案編碼"set encoding=utf-8set fileencodings=ucs-bom,utf-8,gbkset fileencoding=utf-8"檔案類型識別,添加相互關聯類型的外掛程式和縮排指令碼"filetype on"filetype plugin onfiletype plugin indent on"設定檔案格式set fileformat=unixset fileformats=unix"設定shellif g:isWin == 0    set shell=bashendif"會話設定set sessionoptions+=slash,unix "關閉相容模式set nocompatible"外部修改時自動讀取set autoread"設定滑鼠set mouse=a"設定曆史set history=400"文法高亮syntax enable"尋找結果高亮set hlsearch" 超過當前行長度的行會迴繞set wrap
"行號設定set nu"智慧縮排,ts tabstop 轉換tab鍵為空白格來顯示,主要用於螢幕顯示和列印, "如果頁面全部用的tab,在tabstop=4和tabstop=8的地方頁面顯示的寬度是不同的"sts softtabstop 在編輯的時候轉換tab為空白格的數量,需要和expandtab一起用"et expandtab 在插入模式裡插入tab時使用合適數量的空格代替"sw shiftwidth 自動縮排每一步時使用的空白數目set ai ts=4 sts=4 et sw=4"設定色彩方案colorscheme desert
"自動儲存檔案 autowriteset aw
"搜尋時忽略大小寫set ignorecase"set ic
"增強命令列補全set wildmenu
"載入系統特定的指令碼"source $VIMRUNTIME/vimrc_example.vimif g:isWin == 1    source $VIMRUNTIME/mswin.vim    behave mswinendif
set ambiwidth=doubleset smarttabset backspace=2set textwidth=0
set mouse=a
"設定不備份set nobackup"設定開啟檔案的編碼"設定檔案開啟時的編碼猜測列表set fencs=utf-8,gb18030,utf-16,big5"設定大於603版本時的協助語言if version >= 603    set helplang=cnendif
"*******************************************"end常規 "*******************************************
"*******************************"設定Tlist"*******************************
let Tlist_Show_One_File=1" 如果 taglist 視窗是最後一個視窗,則退出 vimlet Tlist_Exit_OnlyWindow=1let Tlist_Show_Menu=1let Tlist_WinHeight=25let Tlist_Use_Right_Window=1"tasklist"map T :TaskList<CR>nmap <silent> <F4> :TlistToggle<CR>

"*******************************" end設定Tlist"*******************************
"*******************************" 設定Winmanager"*******************************
"WinManager"let g:winManagerWindowLayout='NERDTree|TagList'"let g:winManagerWindowLayout = 'NERDTree'""設定winmanager的寬度,預設為25"let g:winManagerWidth = 30"nmap <F8> :WMToggle<cr>"let g:AutoOpenWinManager = 1 
"*******************************" end 設定Winmanager"*******************************
"*******************************"  設定MiniBufExplorer"*******************************let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1map! <Silent> <C-Tab> :bn<cr>" miniBuf always show"let g:miniBufExplorerMoreThanOne=0
"*******************************" end  設定MiniBufExplorer"*******************************
"*****************************" BufExplorer"*****************************
"let g:bufExplorerDefaultHelp=0       " Do not show default help."let g:bufExplorerShowRelativePath=1  " Show relative paths."let g:bufExplorerSortBy='mru'        " Sort by most recently used."let g:bufExplorerSplitRight=0        " Split left."let g:bufExplorerSplitVertical=1     " Split vertically."let g:bufExplorerSplitVertSize = 30  " Split width"let g:bufExplorerUseCurrentWindow=1  " Open in new window."autocmd BufWinEnter \[Buf\ List\] setl nonumber "*****************************" end BufExplorer"*****************************
"*****************************" set Grep"*****************************let Grep_Path = 'D:/GnuWin32/bin/grep.exe'let FGrep_Path = 'D:/GnuWin32/bin/fgrep.exe'let EGrep_Path = 'D:/GnuWin32/bin/egrep.exe'nnoremap <silent> <F3> :Grep<cr>
"*****************************" end Grep"*****************************
" *******************" NERDTree set" *******************
" set NERDTree curent dirif g:isWin == 1    cd d:\else    cd /home/zhaoyongendif
let g:NERDTree_title = "[NERD Tree]"let NERDTreeShowBookmarks=1 "一直顯示書籤let NERDTreeChDirMode=2 "開啟書籤時,自動將Vim的pwd設為開啟的目錄,如果你的項目有tags檔案,你會發現這個命令很有協助
function! NERDTree_Start()    exe 'NERDTree'endfunction
function! NERDTree_IsValid()    return 1endfunction 
nmap <silent> <F2> :NERDTreeToggle<CR>
" *******************" end NERDTree set" *******************


"nmap <F4> :NERDTree  <CR>
" *******************" php languange set "" *******************
" set php documentset runtimepath+=d:\program\ Files\Vim\php_docif g:isWin == 1    map <C-J> :!php -l %<CR>else    map <C-J> :!php -l %<CR>endif 
" *******************" end php language set end" *******************

" *******************" python language set " *******************"" set python documentlet g:pyref_python = 'D:\program files\Vim\python-html'" tagsset tags=d:\code\python\tags" exec pythonmap <F6> :!python %
"Pydictionlet g:pydiction_location='D:\Program Files\Vim\vim73\ftplugin\pydiction\complete-dict'"colorscheme my-molokai"" *******************" end python language set " *******************
" syntax highlight functionfunction! ToggleSyntax()    if exists("g:syntax_on")        syntax off    else        syntax enable    endifendfunction

" 快速編輯vimrc檔案的快速鍵map <silent> ee :e d:\program files\Vim\_vimrc<cr>" 當vimrc已經儲存後重載vimrcautocmd! bufwritepost *_vimrc source d:\program\ files\Vim\_vimrcautocmd! VimEnter * exec 'source' . " d:/program\ files/Vim/session.vim"
autocmd! VimLeave * <Leader>mbtautocmd! VimLeave * :TlistClose<cr>autocmd! VimLeave * :NERDTreeClose<cr>autocmd! VimLeave * exec 'mksession!' . " d:/program\ files/Vim/session.vim"
" 使用CTRL+w 關閉當前緩衝"map <silent> <C-W> <C-k> d <cr> <C-j>" 建立一個標籤map <silent> <C-N> :enew<cr>
" 啟動時已最大化的視窗au GUIEnter * simalt ~x
" 關閉當前的bufmap <silent> qq :bd<cr>
" 清理搜尋高亮map <silent> nhl /axkexiej<cr>
" 注釋的映射鍵let mapleader=","map <silent> <leader>l :call NERDComment(0, "toggle")<cr> map <silent> <leader>k :call NERDComment(0, "sexy")<cr> 
" 括弧自動補全" map auto complete"inoremap ( ()<esc>:let leavechar=")"<cr>iinoremap [ []<esc>:let leavechar="]"<cr>iinoremap { {<esc>o}<esc>:let leavechar="}"<cr>O"inoremap { {}<esc>:let leavechar="}"<cr>i"inoremap ' ''<esc>:let leavechar="'"<cr>i"inoremap " ""<esc>:let leavechar='"'<cr>i"au BufNewFile,BufRead *.\(vim\)\@! inoremap " ""<esc>:let leavechar='"'<cr>i"au BufNewFile,BufRead *.\(txt\)\@! inoremap ' ''<esc>:let leavechar="'"<cr>i"imap <m-l> <esc>:exec "normal f" . leavechar<cr>a"imap <d-l> <esc>:exec "normal f" . leavechar<cr>
" 設定狀態行set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v]\ [%p%%]\ [LEN=%L]set laststatus=2
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.