简体   繁体   English

Emacs C ++模式构造函数初始化不正确的缩进

[英]Emacs C++ mode Constructor initialize incorrect indent

My emacs default indent like this: 我的emacs默认缩进像这样:

FileChannel::FileChannel(const std::string &file_path) :
file_path_(file_path), fd_(0)
{  
}

but I want it like that: 但我想要这样:

FileChannel::FileChannel(const std::string &file_path) :
    file_path_(file_path), fd_(0)
{  
}

or: 要么:

FileChannel::FileChannel(const std::string &file_path)
    : file_path_(file_path), fd_(0)
{  
}

How should I change my config? 我应该如何更改我的配置?

You can add this to your .emacs: 您可以将其添加到您的.emacs中:

(defun my-c-c++-mode-init ()
  (setq c-basic-offset 4)
  (c-set-offset 'member-init-intro '+))

(add-hook 'c-mode-common-hook 'my-c-c++-mode-init)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM