Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get vim to autocomplete my jQuery code?

I'm using vim to write my jQuery code. Is there a plugin that I can use to autocomplete parts of the code?

Edit

i found this Snippet for jquery javascript-jquery Snippet

like image 245
Tarek Saied Avatar asked Aug 09 '11 01:08

Tarek Saied


2 Answers

Javascript is supported as part of vim's omni-completion languages. You can activate this completion via Ctrl-x + Ctrl-o when working inside a javascript buffer. For more info, type :help new-omni-completion in the status bar.

I don't know of a plugin that specifically handles jQuery, but there are a few that trigger omni-completion as you type so it feels fairly native. Hope this helps.

like image 86
sa125 Avatar answered Sep 28 '22 03:09

sa125


Have you tried YouCompleteMe combined with Tern for Vim? These work together to give you autocompletion but to get external library autocompletion you need to enable eagerLoading on new libs by setting the eagerLoading property within the .tern-project file.

A step by step guide on how to set this up can be found here.

like image 27
alex.p Avatar answered Sep 28 '22 03:09

alex.p