12

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

Tarek Saied
  • 6,482
  • 20
  • 67
  • 111
  • 5
    Not sure why the down votes. This seems like a reasonable question to me. Perhaps it could be worded better, but what is being asked seems clear to me. Is there a plugin for the vim editor that will allow standard code completion commands to work with common Javascript keywords/jQuery functions? – Michael Mior Aug 09 '11 at 02:42

5 Answers5

4

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.

sa125
  • 28,121
  • 38
  • 111
  • 153
1

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.

alex.p
  • 2,627
  • 17
  • 28
0

Besides the YouCompleteMe Tern support there is also the Tern for Vim Vim plugin which could be found here: https://github.com/ternjs/tern_for_vim

jpoppe
  • 2,228
  • 24
  • 25
0

another way is coc-html with coc.nvim for html files, if you're editing javascript files there is no need, vim can auto complete jquery as long as it is npm/yarn installed in the project.

Shawn Shaw
  • 181
  • 3
  • 8
0

You could have a look at Snipmate. I recommend you to use this version instead of the one from vim.org which is no longer maintained (pay attention to the readme since this plugin requires some other). Then you should try something like this google search.

If you don't find snippet that fit your need, then you could consider creating your own snippet file while coding. The syntax is very simple and powerful!

Plouff
  • 3,290
  • 2
  • 27
  • 45