smartindent 不允许手动缩进以“#”开头的行
当设置 smartindent
时,快捷方式 >>
不会在 C 或 Python 中缩进以 #
开头的行。
如果有人有解决方法,那就太酷了;我还发布了这个让人们知道的信息(为什么该键不起作用是相当令人困惑和令人沮丧的)。
The shortcut >>
doesn't indent lines that start with #
for me in either C or Python when smartindent
is set.
If anyone has a workaround, that would be cool; I'm also posting this let people know (it was rather confusing and frustrating why that key wasn't working).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这在 SO 的相关帖子中进行了讨论,该帖子引用
:h smartindent
并建议设置 nosmartindent 作为解决方法。您是否使用filetype indent on
来获得完整的与语言相关的缩进?:Vim 自动删除 Python 注释上的缩进
This is discussed in a related post on SO, which refers to
:h smartindent
and recommends setting nosmartindent as a workaround. Are you usingfiletype indent on
to get the full language-dependent indenting?:Vim automatically removes indentation on Python comments
是的,预期行为
>>
不适用于#
,如:help smartindent
中所述。该文档还提供了一个解决方法:其中 ^H 输入为 Ctrl + V Ctrl + H
Yes, the behavior is expected
>>
does not work with#
as documented in:help smartindent
. The doc also has a work around given:where ^H is entered as Ctrl + V Ctrl + H