如何修复Vim中不正确的内联JavaScript缩进?
发布时间:2020-12-15 16:42:00 所属栏目:安全 来源:网络整理
导读:我似乎不能在Vim中正确插入JavaScript。考虑以下: $(document).ready(function() { // Closing brace correctly indented $("input").focus(function() { $(this).closest("li").addClass("cur-focus"); }); // -- I had to manually unindent this // Clos
我似乎不能在Vim中正确插入JavaScript。考虑以下:
$(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缩进风格在第一种情况下看到?
最全面和无错误的JavaScript缩进脚本是
the one by Preston Koprivica.在所提出的答案中所谓的OOP脚本有严重的错误,并没有缩进代码正确的方括号。
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |