Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim javascript omnicomplete

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!:)

like image 911
Junxuan Ng Avatar asked Nov 01 '10 16:11

Junxuan Ng


People also ask

What is Omnicomplete in Vim?

Omnicomplete. Vim offers a number of different ways to complete text (read :help ins-completion for an overview). Most are fairly simple, but the most powerful of them is "omnicomplete" which lets you call a custom Vimscript function to determine completions in just about any way you could possibly think of.

What is Omni complete?

Omni completion provides smart autocompletion for programs. When invoked, the text before the cursor is inspected to guess what might follow.


1 Answers

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.).

like image 62
Ory Band Avatar answered Oct 19 '22 06:10

Ory Band