我正在处理 JS 文件,当我输入时:
function() {
some_code // it correctly indents this line
但是当我遇到这样的事情时:
productEditModal: function(product, i) {
some_code // new line starts from here
我想要的是:
productEditModal: function(product, i) {
some_code // new line should start from here
我尝试了几个 js-indent 插件但没有成功。我的 JS 代码写在 .vue 组件文件中,所以也许这就是插件对我来说不正确的原因。任何建议都会有所帮助。
最佳答案
尝试将文件类型设置为 javascript。在你的文件里面写:
:set autoindent
:set filetype=javascript
与 .vue 文件关联的插件可能无法工作,但值得一试。
关于javascript - Vim:如何从行首计算缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34335840/