[英]How to configure Emacs 24 to K&R(or Stroutrup) style?
I want the code like this. 我想要这样的代码。
for (;;) {
}
But YASnippet always output this. 但是YASnippet总是输出此。
for (;;) { }
Is there a way to change the C++ style? 有没有办法改变C ++风格?
This is my .emacs file. 这是我的.emacs文件。
(setq c-default-style "stroustrup")
(add-to-list 'load-path "~/emacs/yasnippet/") (require 'yasnippet) (yas-global-mode 1)
You'd just have to edit the snippet for yourself. 您只需要自己编辑代码段即可。 It's located in snippets/cc-mode/for
. 它位于snippets/cc-mode/for
。 Here's how mine looks like: 这是我的样子:
# -*- mode: snippet -*-
#name : for (...; ...; ...) { ... }
# --
for (unsigned int ${1:i}=0; $1<${2:N}; ++$1)$0
I insert the braces separately with a function from here , since sometimes you need braces and sometimes not. 我从此处单独插入带有函数的括号,因为有时您需要括号,有时则不需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.