vim 很好的插件

以下是滇狐收集和整理的一些有用的 VIM 插件, 大部分插件都有自己詳細的說明書, 因此這裏就不詳細介紹每個插件的安裝和使用方法了。 通過這些插件, VIM 能夠變成一個非常強大的平臺, Happy VIMming! 如果想詳細瞭解默認的插件插件安裝路徑, 請看這裏

1 程序設計

1.1 Tag List

下載地址: 官方站點

官方描述: The “Tag List” plugin is a source code browser plugin for Vim and provides an overview of the structure of source code files and allows you to efficiently browse through source code files for different programming languages.

滇狐評價: 這是一個非常非常非常非常重要的插件, 有了它, 我們才能夠在 VIM 中查看一個文件中包含的函數列表, 或是一個類包含的方法列表, 爲編程人員提供了極大方便。 推薦大家一定要安裝!

安裝注意事項: 有的系統內置的 ctags 功能太弱, 推薦大家安裝 EXUBERANT CTAGS , 這個東西功能比較強大, 居然連 HTML 裏面內嵌的 Java Script 都能夠支持, 實在是匪疑所思!

滇狐個人習慣: 滇狐習慣把方法列表放在屏幕的右側, 於是在 .vimrc 中設置了

let  Tlist_Use_Right_Window= 1

另外, 滇狐習慣讓當前不被編輯的文件的方法列表自動摺疊起來, 這樣可以節約一些屏幕空間, 於是在 .vimrc 中設置了

let  Tlist_File_Fold_Auto_Close= 1

1.2 A

下載地址: 官方站點

官方描述:

A few of quick commands to swtich between source files and header files quickly.

:A switches to the header file corresponding to the current file being edited (or vise versa)

:AS splits and switches

:AV vertical splits and switches

E.g. if you are editing foo.c and need to edit foo.h simply execute :A and you will be editting foo.h, to switch back to foo.c execute :A again.

滇狐評價: 第一眼看到這個東西時, 總覺得它功能太簡單, 似乎沒有什麼用處。 用過之後, 才發現這項功能對於一個程序員來說是如何重要!

1.3 Win Manager

下載地址: 官方站點

官方描述: 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 Vim 6.0 and a Buffer Explorer written by Jeff Lanzarotta into one package.

滇狐評價: 非常好用的東西, 在屏幕上打開一個文件瀏覽器, 這樣就可以方便地選擇要編輯的文件了。

默認情況下, winmanager 依賴於 bufexplorer, 到這裏 下載。 如果你不喜歡 bufexplorer 插件的話 可以在你的 .vimrc 中添加這條命令禁用它:

let  g:winManagerWindowLayout =  "FileExplorer"

這樣就不需要下載該插件了。

滇狐爲 winfileexplorer.vim 加了一個補丁, 提供了使用系統默認打開方式打開選中文件的功能, 只要把光標放在想要打開的文件上, 然後按“S”就可以了 (注意是大寫)。 這樣以後就可以直接在 gvim 裏打開 Noatun 或別的播放器, 不用再切換出來找 konqueror 了。

1.4 echofunc

下載地址: 官方站點

官方描述: When you type ‘(‘ after a function name in insert mode, the function declaration will be displayed in the command line automatically. Then use Alt+-, Alt+= to cycle between function declarations (if exists).

滇狐評價: 一個非常好用的插件, 雖然很小巧, 功能也很簡單, 但非常實用, 強烈推薦。 除此之外, 安裝了這個插件後, 當鼠標移到一個標誌符之上時, 還會出現一個氣球顯示該標誌符的定義, 如圖:

vim_echofunc

安裝注意事項: 該插件需要安裝 EXUBERANT CTAGS , 不支持古老版本的標準 ctags。 建議創建一個這樣的腳本:

#!/bin/sh
# Filename: omnictags

ctags --c++-kinds=+p  --fields=+iaS  --extra=+q  " $@ "

然後使用 omnictags 來運行 ctags 生成 tags 文件, 保證 tags 文件中含有所需的信息。

1.5 omnicppcomplete

下載地址: 官方站點

官方描述: This script is for vim 7.0 or higher it provides an omnifunc cppcomplete function. You can use the omni completion (intellisense) in c++ files.

This is a full vim script and you only need a ctags database.

滇狐評價: 雖然滇狐幾乎不依賴 IDE 的自動完成, 因此也很少使用這個插件, 但總的說來, 這仍然是個很棒的插件。

安裝注意事項: 該插件需要安裝 EXUBERANT CTAGS , 不支持古老版本的標準 ctags。 建議創建一個和前面的 echofunc 中給出個腳本, 使用那個腳本來生成 tags 文件。

1.6 clewn

下載地址: 官方站點

官方描述: Clewn implements full gdb support in the vim editor: breakpoints, watch variables, gdb command completion, assembly windows, etc.

滇狐評價: Vim 從一開始的設計哲學就是要保持簡單, 不要把太多的東西整合在 Vim 中。 Clewn 在保持了 Vim 簡單的原則下, 將集成調試所需的一部分功能引入到了 GVim 中, 支持設置斷點、 查看變量的值等許多操作, 非常方便。

1.7 jad

下載地址: 無。 自己將代碼複製粘貼回去, 保存爲 $HOME/.vim/plugins/jad.vim:

augr  class
au !
au  bufreadpost ,filereadpost  *.class %!jad -noctor -ff -i -p %
au  bufreadpost ,filereadpost  *.class set  readonly
au  bufreadpost ,filereadpost  *.class set  ft =java
au  bufreadpost ,filereadpost  *.class normal gg= G
au  bufreadpost ,filereadpost  *.class set  nomodified
au  bufreadpost ,filereadpost  *.class set  nomodifiable
augr  END

官方描述: (無)

滇狐評價: 挺好玩的插件, 不過似乎也只是好玩而已。 安裝了之後可以直接雙擊打開 .class 文件, VIM 會自動調用 jad 把文件反編譯了。

安裝注意事項:需要先安裝一份 jad

1.8 cscope_maps

下載地址: 官方站點

官方描述: Cscope is a very handy tool, but it’s even better when you don’t ever have to leave the comfort of your favorite editor (i.e. Vim) to use it. Fortunately, Cscope support has been built into Vim.

滇狐評價: 滇狐目前 cscope 用得不如 ctags 多, 許多功能都不大熟。 不過既然大家都說好, 那還是裝着玩玩吧。

安裝注意事項: 需要安裝 cscope

1.9 project

下載地址: 官方站點

官方描述: You can use this plugin’s basic functionality to set up a list of frequently-accessed files for easy navigation. The list of files will be displayed in a window on the left side of the Vim window, and you can press <Return> or double-click on filenames in the list to open the files. This is similar to how some IDEs I’ve used work. I find this easier to use than having to navigate a directory hierarchy with the file-explorer. It also obviates the need for a buffer explorer because you have your list of files on the left of the Vim Window.

滇狐評價: 食之無肉,棄之有味。

安裝注意事項: 幾乎沒怎麼用過, 所以暫時沒有發現需要注意的地方。

2 文檔編寫

2.1 fencview

下載地址: 官方站點

官方描述: View a multi-byte encoded file in different encodings.

滇狐評價: 對於亞洲用戶, 尤其是中國用戶而言, 這是一個非常重要的插件! 它能自動識別文本文件的編碼, 給需要編輯各種不同編碼的人員提供了極大方便。

2.2 VIM LaTeX Suite

下載地址: 官方站點

官方描述:

Vim is undoubtedly one of the best editors ever made. LaTeX is an extremely powerful, intelligent typesetter. Vim-LaTeX aims at bringing together the best of both these worlds.

We attempt to provide a comprehensive set of tools to view, edit and compile LaTeX documents without needing to ever quit Vim. Together, they provide tools starting from macros to speed up editing LaTeX documents to compiling tex files to forward searching .dvi documents.

See the features page for a brief tour of the various features in LaTeX-suite. All these features can be tuned extensively using the included texrc file. The screenshots page shows you how a typical working session with LaTeX-suite might progress.

LaTeX-suite is made for Vim versions 6.0 and above. Installation instructions are given in the download page.

滇狐評價: 實在是非常非常非常非常好的一個插件! 用 VIM 寫 LaTeX 的朋友無論如何都要試一試, 不用 VIM 寫 LaTeX 的朋友也要試一試, 說不定你會改變你的主意, 改用 VIM 寫 LaTeX。

安裝注意事項: 如果使用 gvim 的話, 需要注意 scim 可能會和 LaTeX Suite 有衝突。 解決方法是要麼把 scim 的 on the spot 功能去掉, 或者把 gtk_im_module 設爲 scim。 (較新版本 scim 建議第二種方案)。

另外, 爲了提高工作效率, 強烈建議配置 VIM 的LaTeX 正向、反向搜索 功能。

2.3 sketch

下載地址: 官方站點

官方描述: Sketch.vim – Line drawing/painting using the mouse. Based on an idea by Morris.

滇狐評價: 很好玩, 雖然用到的時候不多, 但真一旦用到了, 還是會覺得這個東西很有用的。

安裝注意事項: 建議在 .vimrc 中把 call ToggleSketch() 映射爲命令,方便一些:

command  - nargs = 0  ToggleSketch call  ToggleSketch()

3 日常生活

3.1 Calendar

下載地址: 官方站點

官方描述: This script create calender window. This don’t use the external program (cal).

滇狐評價: 安裝完畢後使用 :Calendar 命令打開一個垂直的日曆窗口, 使用 :CalendarH 命令打開水平的日曆窗口。 應該還是比較有用的。

安裝注意事項: 滇狐個人喜歡把日記的擴展名改成 .txt, 默認的是 .cal。 在 calendar.vim 裏面查找替換一下就可以了。 另外, 可以在 .vimrc 裏面修改日記所在的路徑, 默認是 ~/diary。

let  g:calendar_diary=< PATH>

3.2 vimtips

下載地址: 官方站點

官方描述:

Whenever you start Vim (but no more than daily) the script will open a help window with a Vim tip. You must download the tips separately, from 官方站點

After installation, you can get the next tip with

:TipOfTheDay

滇狐評價: 每天看一條,慢慢就變成 VIM 牛了。

安裝注意事項: 暫時沒發現。

3.3 vimball

下載地址: 官方站點

官方描述: The vimball plugin facilitates creating, extracting , and listing the contents of “vimball” archives (*.vba).

滇狐評價:

非常棒的一個插件, 專門用來安裝其它插件的。 Vimball 格式的插件安裝方便, 只需用 Vim 打開, 執行一下 :so % 即可, 無須用戶自己滿世界找插件的安裝路徑, 更無須整天想着更新 helptags。 滇狐已經決定將所有自己編寫或修改的插件改爲 Vimball 格式了, 而且目前有越來越多的插件使用 Vimball 的格式發佈, 因此大家手頭上一定要備有一份 Vimball 插件! 雖然 Vim 內置了一份 Vimball 插件, 但版本太低, 許多 Vimball 無法通過它正常安裝, 因此還是建議大家到 Vim 網站上下載一份最新版的 Vimball 插件。

3.4 GetLatestScript

下載地址: 官方站點

官方描述: GetLatestVimScripts is a plugin that automates retrieval of the latest versions of the scripts that you yourself use!

滇狐評價:

非常有用的一個插件, 有了它, 滇狐就可以時刻使用上最新鮮的插件, 而不用不停地到 Vim 主頁上去看插件的更新情況了。

安裝注意事項:

安裝完畢後, 創建文件 ~/.vim/GetLatest/GetLatestVimScripts.dat , 按照這樣的格式編寫你的自動下載配置文件:

ScriptID SourceID Filename
--------------------------
<插件 id> 0 [:AutoInstall:] <插件文件名>
<插件 id> 0 [:AutoInstall:] <插件文件名>
...

每行寫一個插件的下載信息。 插件 id 就是在 Vim 主頁下載插件時 URL 中的 script_id= 後面的那個數字。 第二個參數是前一次成功下載到的插件文件編號, 第一次使用的時候該參數寫 0, 成功使用一次後會自動被修改爲該插件最新版本的文件編號。 第三個參數是該插件下載成功後是否自動安裝, 如果要自動安裝的話就寫上 :AutoInstall: 。 滇狐不建議使用自動安裝, 因此第三個參數建議省略不要寫。 第四個參數是插件的名稱, 一般和下載到的插件的文件名相同, 當然即使不同也不會造成太大影響, 這個參數主要用於防止某些插件自動將自己加入到這張列表, 並非用於指定插件的下載文件名, 更詳細情況請參看該插件的文檔。 以下是滇狐自己的 GetLatestVimScripts.dat , 供大家參考:

ScriptID SourceID Filename
--------------------------
1066 0 cecutil.vba
1066 0 cecutil.vim
1066 7618 cecutil.vba.gz
1075 0 netrw.vba
1075 0 netrw.vim
1075 9816 netrw.vba.gz
1440 7151 winmanager.vba.gz
1502 8743 vimball.vim
1520 7722 omnicppcomplete-0.41.zip
1708 9649 fencview.vim
1735 10501 echofunc.vim
1863 0 tlib.vim
1863 10035 tlib.vba.gz
1926 9111 bbs.vba.gz
2037 0 hookcursormoved.vim
2037 8926 hookcursormoved.vba.gz
273 7701 taglist_45.zip
31 7218 a.vim
42 9524 bufexplorer.zip
642 0 GetLatestVimScripts.vim
642 0 getscript.vim
642 8136 getscript.vba.gz
705 2667 sketch.zip
861 0 viki.vim
861 10254 Viki.vba.gz

編寫好 GetLatestVimScripts.dat 後, 打開 Vim, 運行 :GetLatestVimScripts , 即可自動下載最新的插件。 插件下載後存放在 ~/.vim/GetLatest/ 中, 可以到那裏找到後安裝, 安裝完畢後安裝文件可以刪除。

3.5 ViKi

你現在看到的這張網頁就是使用 ViKi 製作的。 也許它不漂亮, 但是很清秀, 而且添加信息非常方便。 是 ViKi 將滇狐從繁重的 Html 編輯工作中解放出來, 使滇狐有足夠的勇氣重新開始製作個人主頁。 爲了更好地說明 ViKi , 滇狐將該插件的使用單獨放到另一張網頁 中。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章