最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - vim javascript omnicomplete - Stack Overflow

programmeradmin2浏览0评论

I'm trying to get vim to provide some form of jQuery Omnicomplete. I have used ctags to generate tags based ont he jquery js file. After which I have turned on omnicompletion for javascript using

autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

after which I set the tags variable to the tag file I created

set tags+=~/.vim/tags/jquery

When I open a js file, and use :ta I'm able to find the function I want, but when I try to use omnicompletion, it just doesn't turn up. For example, I took this code from the net to test:

$("input").has(".email").addClass("email_icon");    

In VIM, after typing $("input")., I hit tab(with supertab set up) and has does not turn up, even though I can find it through fuzzy finder or :ta

Any suggestions as to what I can do to resolve this? Thanks!:)

I'm trying to get vim to provide some form of jQuery Omnicomplete. I have used ctags to generate tags based ont he jquery js file. After which I have turned on omnicompletion for javascript using

autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

after which I set the tags variable to the tag file I created

set tags+=~/.vim/tags/jquery

When I open a js file, and use :ta I'm able to find the function I want, but when I try to use omnicompletion, it just doesn't turn up. For example, I took this code from the net to test:

$("input").has(".email").addClass("email_icon");    

In VIM, after typing $("input")., I hit tab(with supertab set up) and has does not turn up, even though I can find it through fuzzy finder or :ta

Any suggestions as to what I can do to resolve this? Thanks!:)

Share Improve this question edited Nov 2, 2010 at 8:08 Junxuan Ng asked Nov 1, 2010 at 16:27 Junxuan NgJunxuan Ng 7091 gold badge6 silver badges7 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 7

Use Mozilla's DoctorJS (formerly jsctags), which is also used in Cloud9 IDE's Ace online editor.

See my answers for this question and this question for more info (install, config, etc.).

javascriptcomplete#CompleteJS does not use the ctags file for completion.

What you can do is, you can write your own omni-complete function for jQuery, or even better, expand the javascriptcomplete#CompleteJS function defined in /usr/share/vim/vim72/autoload/javascriptcomplete.vim to suit your needs.

Another way to get javascript autocompletion would be to use mozilla's 'jsctags' project. It generates better tags for javascript than 'exuberant ctags'. Hopefully you'll see more when you use supertab & taglist-plus.

For more info: http://www.discontinuously.com/2011/03/vim-support-javascript-taglist-plus/

发布评论

评论列表(0)

  1. 暂无评论