开发者

vim formatting JS wrong

I've been using vim for a year or so now (on Ubuntu 10.04) and normally it's awesome. A few days back I added another plugin and suddenly all of my js indentation was wrong. HTML fine, XML fine, but any JS file, when I enter gg=G, it formats closed functions like below. Yikes!

I removed .vimrc from my home dir, added a different one, removed the new plugins, restarted several times, etc. Then I removed .vimrc and .vim from user's home dir and reinstalled using Sy开发者_StackOverflownaptic. No change! I just want my old wonderful vim back... what can I do? Why does it persist beyond deletion and reinstall?

// Comment comment
$('#likeonfb .clickicon').click(function(e) {
                window.open('http://www.url.com','width=400,height=600');
                });


Well, it "persists" because it's a default setting. Vim right out of the box is missing most of what you want. Anyway, it should work fine if you add this to your .vimrc:

filetype plugin indent on

Of course, this assumes your filetype is set correctly. :set filetype? does return filetype=javascript, right?

If your original indent files were somehow corrupted, of course, you can always install the Javascript/HTML indentation plugin.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜