I can\'t seem to get inline Javascript indenting properly in Vim. Consider the following:
$(document).ready(function() {
// Closing brace correctly inde
You don't have to install plugins specialised for Javascript, you can learn the built-in Vim options for indentation. Vim has quite a few options, and some of the indenting styles like cindent, smartindent and indentexpr have options of their own.
To check whether you are using cindent or smartindent or indentexpr, run:
:set cindent?
:set smartindent?
:set indentexpr?
Despite the name, cindent doesn't just apply to C programs, it can apply to a bunch of programming languages that share roughly the same syntax, including Javascript. Have a look at :help C-indenting for documentation about this. You can adjust the settings particularly with a line like this one, see :help 'cinoptions' and :help cinoptions-values. Here's an example configuration:
:au FileType js,javascript setlocal shiftwidth=2 softtabstop=2 cinoptions=j1,J1,(1s " see help cino-j cino-J cino-(