本文介绍了如何修复Vim中不正确的内联Javascript缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法在Vim中正确地进行内联Javascript缩进。请考虑以下事项:
I can't seem to get inline Javascript indenting properly in Vim. Consider the following:
$(document).ready(function() {
// Closing brace correctly indented
$("input").focus(function() {
$(this).closest("li").addClass("cur-focus");
}); // <-- I had to manually unindent this
// Closing brace incorrectly indented
$("input").blur(function() {
$(this).closest("li").removeClass("cur-focus");
}); // <-- This is what it does by default. Argh!
});
Vim似乎坚持自动缩进第二种情况下显示的右括号。如果我重新缩进整个文件,它也会这样做。如何使用第一种情况下看到的更标准的JS缩进样式自动缩进?
Vim seems to insist on automatically indenting the closing brace shown in the second case there. It does the same if I re-indent the whole file. How do I get it to automatically indent using the more standard JS indenting style seen in the first case?
推荐答案
使用。感谢来自 - 给他一个投票。
Use JavaScript Indent: Javascript indenter (HTML indent is included) by Preston Koprivica. Thanks for the heads-up from oligofren - give him an up-vote.
这篇关于如何修复Vim中不正确的内联Javascript缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!