Vim:在空白行上进入插入模式时智能缩进吗? [英] Vim: Smart indent when entering insert mode on blank line?

查看:133
本文介绍了Vim:在空白行上进入插入模式时智能缩进吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开新行(通过'o')时,光标跳到下一行的正确缩进位置.另一方面,当光标在空白行上时进入插入模式不会将光标移动到正确的缩进位置.

When I open a new line (via 'o') my cursor jumps to a correctly indented position on the next line. On the other hand, entering insert mode while my cursor is on a blank line doesn't move my cursor to the correctly indented location.

在空白行(通过i)进入插入模式时,如何使vim正确缩进光标?

How do I make vim correctly indent my cursor when entering insert mode (via i) on a blank line?

推荐答案

cc将替换当前行的内容,并以正确的缩进方式进入插入模式-因此在空白行上将完全执行您要执行的操作

cc will replace the contents of the current line and enter insert mode at the correct indentation - so on a blank line will do exactly what you're after.

我相信您描述的i的行为是正确的,因为在许多用例中,您想要插入空白行中的特定位置,而不是跳转到vim猜测的位置您要插入.

I believe that the behaviour of i you describe is correct because there are many use cases where you want to insert at that specific location on a blank line, rather than jumping to wherever vim guesses you want to insert.

这篇关于Vim:在空白行上进入插入模式时智能缩进吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆