I use Vim 7.4.2149 and the plugin pangloss/vim-javascript for js indentation. I need to get comments like:


But instead I get:


I'm not really interested in syntax so I use:

syntax off

and I tried these settings:


What should I do to get the comment formatting I'm looking for.

  • When default indentation is used ie without plugin, I get the comment formatting I'm looking for. – user101285 Aug 5 '16 at 8:35
  • You don't need a plugin to indent and fold JavaScript. :set autoindent, and ^T and ^D works well for most languages. Or :set softtabstop=4 backspace+=indent if you don't like ^T and ^D. :set foldmethod=marker foldmarker={,} works well enough for folding (template literals aren't really a big deal). If you don't want syntax, job done. – Antony Aug 5 '16 at 9:26
  • Not the answer but autoindent is not that good. – user101285 Aug 5 '16 at 9:31
  • vim-javascript has so far had 149 issues relating to indentation. 150 if you count this one. I'll stick with 'autoindent'. – Antony Aug 5 '16 at 10:39
  • It looks like there was a fix for this just a few days ago. At least, that's what I think from the commit message. Make sure you've got the latest version of vim-javascript. You can also make sure this problem isn't caused by something in your vimrc. If that doesn't fix the problem I suggest you open an issue on their bug tracker, as this is obviously a bug. – Martin Tournoij Aug 8 '16 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.