winmanager插件安裝
• 插件簡介
winmanager is a plugin which implements a classical windows type IDE in Vim-6.0. Basically, you have the directory tree and the buffer list as 2 windows which stay on the left and the editing is done in a seperate area on the left. People have already made excellent File and Buffer explorers seperately and I thought that it might be a cool idea to combine them both. winmanager.vim combines the standard File Explorer which ships with Vim6.0 and a Buffer Explorer written by Jeff Lanzarotta into one package. It has the following features:
winmanager是一款在Vim-6.0中實現經典窗形IDE的插件。總的來說,用戶可以在Vim編輯器左邊擁有目錄樹和緩沖列表,同時在右邊擁有一塊獨立的區域來完成編輯。已經有人單獨編寫出優秀的文件瀏覽器和緩沖瀏覽器插件,因此我認為結合二者將是一個很不錯的想法。winmanager.vim包含了一個基於Vim6.0的標准文件瀏覽器和一個由Jeff Lanzarotta編寫的緩沖瀏覽器。它擁有以下特性:
1. the buffer listing is dynamic: i.e as you keep changing windows, editing new files, etc, the buffer list changes dynamically. the window also resizes dynamically, i.e it tries to occupy the minimum possible space to display all the currently listed windows. also, only the filename (i.e without path) is displayed in this window. however, the full path name is echoed on the command line as one moves around.
1. 緩沖列表是動態的:譬如你一直在進行改變窗口、編輯新文件等諸如此類的操作,緩沖列表將動態隨之改變。窗口大小也會動態進行調整,譬如它將嘗試占用盡可能小的空間來顯示當前窗口條目。因此,只有文件名才會在該窗口顯示。當一個文件移動時,全路徑名將在命令行處顯示。
2. the file explorer window doesn't actually edit a directory. It's a new empty file with modifiable off, etc. so that it doesnt eat up buffer numbers as you roam around the directory tree. I found the original behaviour slightly annoying... Also, I didnt find a way to change drives i.e go from c:/ to h:/ in the original explorer.vim. therefore i have added a tiny new mapping 'C' which changes the currently displayed directory to pwd.
• 安裝方法
▶ 下載winmanager,下載地址:http://www.vim.org/scripts/script.php?script_id=95;
▶ 存放路徑,在Windows系統下路徑為:vim安裝路徑\vimXX\,在Linux系統下安裝路徑為:/usr/share/vim/vimXX/;
▶ 將下載的解壓包解壓,將包中的doc、plugin目錄覆蓋到存放路徑下。
• .vimrc文件配置
winmanager的配置:
" winmanager配置 let g:NERDTree_title='NERD Tree' let g:winManagerWindowLayout='NERDTree|TagList' function! NERDTree_Start() exec 'NERDTree' endfunction function! NERDTree_IsValid() return 1 endfunction
" 綁定F2到winmanager
nmap <silent> <F2> :WMToggle<CR>
taglist相關配置的修改:
" 綁定F8快捷鍵 " 使用winmanager時,不使用快捷鍵 " nnoremap <silent> <F8> :TlistToggle<CR> " 啟動Vim后,自動打開taglist窗口。 " 使用winmanager時,將自動打開窗口關閉 let Tlist_Auto_Open = 0
NERD tree相關配置的修改:
" 綁定F2到NERDTreeToggle
" 使用winmanager時,不使用快捷鍵
" map <F2> :NERDTreeToggle<CR>
另外,在windows下使用時,打開winmanager時會出現一個空buff,如果想在打開時候自動關閉這個buff,這里有兩種方法:
▶ 修改開關快捷鍵
" 綁定F2到winmanager nmap <silent> <F2> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR>
▶ 修改winmanager.vim
" toggle showing the explorer plugins. function! <SID>ToggleWindowsManager() if IsWinManagerVisible() call s:CloseWindowsManager() else call s:StartWindowsManager() " 增加啟動時候關閉空buff代碼 exe 'q' end endfunction
修改完畢,按下F2都可以方便地開關winmanager了: