避免 C++ 中的标签缩进

发布于 2024-11-17 01:58:47 字数 388 浏览 5 评论 0原文

我想这个问题以前有人问过,但我找不到任何类似的问题。

当用 C++ 编写部分作用域运算符时,Vim 猜测它将是一个标签 (在第一个 : 上),然后自动缩进,这非常烦人。示例:

#1 - 初始输入

{
    std

#2 - 添加 :

{
std:

#3 - 添加 :

{
    std::

当然,最后是正确的,但是有没有办法禁用自动缩进对于标签?我很少使用它们,在这些情况下手动缩进也没什么大不了的。

I guess this was asked before, but I could not find any similar question.

When writing part of the scope operator in C++, Vim guesses that it's going to be a label (on the first :) and then indents it automatically, which is pretty annoying. Example:

#1 - initial typing

{
    std

#2 - added :

{
std:

#3 - added :

{
    std::

Of course, it's correct at the end, but is there any way to disable the automatic indent for labels? I rarely use them, and it wouldn't be a great deal to indent manually in those cases.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

欢烬 2024-11-24 01:58:47

只需告诉 vim 不要使用以下命令取消缩进标签:

:set cinoptions+=L0

作为参考,如果“可见性”修饰符指的是访问说明符,则可以将它们设置为不缩进:

:set cinoptions+=g0

Just tell vim not to de-indent labels with:

:set cinoptions+=L0

For reference, if by "visibility" modifiers you mean access specifiers, these can be set to not indent with:

:set cinoptions+=g0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文