Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://www.vim.org/scripts/script.php?script_id=2540" rel="noreferrer">snipMate</a> emulates TextMate's <kbd>⇥</kbd> insertion system and comes with a bunch of useful JS snippets (among others) by default. It's extremely easy to add your own.</p> <p><a href="http://www.vim.org/scripts/script.php?script_id=2578" rel="noreferrer">javaScriptLint</a> allows you to validate your code against <a href="http://www.javascriptlint.com" rel="noreferrer">jsl.</a></p> <p>Also you can find a variety of <a href="http://www.vim.org/scripts/script_search_results.php?keywords=javascript&amp;script_type=syntax&amp;order_by=rating&amp;direction=descending&amp;search=search" rel="noreferrer">JavaScript syntax files</a> on vim.org. Try them and see which one works best for you and your coding style.</p> <p>The native omnicomplete (<kbd>ctrl</kbd><kbd>x</kbd>-<kbd>ctrl</kbd><kbd>o</kbd>) works very well for me. You can make it more dynamic with <a href="http://www.vim.org/scripts/script.php?script_id=1879" rel="noreferrer">autoComplPop</a>, but it can be annoying sometimes.</p> <p><strong>edit, in response to tarek11011's comment:</strong></p> <p>acp doesn't work for JavaScript by default, you have to tweak it a little. Here is how I did it (dirty hack, I'm still a Vim noob):</p> <p>In vim-autocomplpop/plugin/acp.vim I've added <code>php</code> and <code>javascript</code> (and <code>actionscript</code>) to <code>behavs</code> so that it looks like that :</p> <pre><code>let behavs = { \ '*' : [], \ 'ruby' : [], \ 'python' : [], \ 'perl' : [], \ 'xml' : [], \ 'html' : [], \ 'xhtml' : [], \ 'css' : [], \ 'javascript' : [], \ 'actionscript' : [], \ 'php' : [], \ } </code></pre> <p>A little below, there is a series of code blocks that look like that :</p> <pre><code>"--------------------------------------------------------------------------- call add(behavs.ruby, { \ 'command' : "\&lt;C-x&gt;\&lt;C-o&gt;", \ 'meets' : 'acp#meetsForRubyOmni', \ 'repeat' : 0, \ }) </code></pre> <p>I've duplicated this one and edited it a little bit to look like that:</p> <pre><code>"--------------------------------------------------------------------------- call add(behavs.javascript, { \ 'command' : "\&lt;C-x&gt;\&lt;C-o&gt;", \ 'meets' : 'acp#meetsForRubyOmni', \ 'repeat' : 0, \ }) </code></pre> <p>and did the same for actionscript and php.</p> <p>If you want to edit JS/CSS within a HTML document you can do :set ft=html.css.javascript in Vim's command line to make <kbd>ctrl</kbd><kbd>x</kbd>-<kbd>ctrl</kbd><kbd>o</kbd> work as expected on method/properties names in JS blocks and properties/values in CSS blocks. However this approach has its drawbacks, too (weird indentation…).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload