vim 自動補全(autocomplete)

在vim7 後有Omni completion這個功能….
星期五在看othree blog
看到他寫的vim 自動補全

之前看的時後一直沒有太大的衝勁驅始我去用這個功能,也就不放在心上..

而星期五不知道怎麼樣心血來潮..
就仔細看了一下他寫的部份..自已try 了一下………

所以稍為筆記一下….

目前看來是須要裝…
supertab, 和抓phpcomplete.vim(for php)這個檔案來用

supertab 就是用tab 來觸發omni 的自動完成
phpcomplete.vim 就是for php 的自動完成的範本….(不知道這樣形容對不對) PS:這個在$VIMRUNTIME/autoload 下就有了…….

我在vimrc 加入了以下設定

"這是我設定自動完成的選項...基本上有四種...可以看一下vim doc 的options 有寫到..
set completeopt=longest,menu
"這是快捷鍵.....不然每次按^x ^o 很麻煩..
imap <c -L> </c><c -x></c><c -o>

使用方法就是….
開xxx.php後
先^L 然後就會啟動omni 了
接下來按tab 就會自動補齊了…..

REF:

http://wiki.geckos.cn/index.php/Vim%E4%B8%AD%E7%9A%84%E4%BB%A3%E7%A0%81%E8%A1%A5%E5%85%A8

http://blog.othree.net/log/vim/

About johnpupu

..........
This entry was posted in 有的沒的 and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word