gpt4 book ai didi

c++ - 如何将 Emacs 24 配置为 K&R(或 Stroutrup)风格?

转载 作者:太空宇宙 更新时间:2023-11-04 14:01:59 25 4
gpt4 key购买 nike

我想要这样的代码。


对于 (;;) {



}

但是 YASnippet 总是输出这个。

for (;;){}

有没有办法改变C++风格?

这是我的 .emacs 文件。


(setq c-default-style "stroustrup")



(add-to-list 'load-path
“~/emacs/yasnippet/”)
(需要'yasnippet)
(yas-全局模式 1)

最佳答案

您只需自己编辑代码段。它位于 snippets/cc-mode/for 中。这是我的样子:

# -*- mode: snippet -*-
#name : for (...; ...; ...) { ... }
# --
for (unsigned int ${1:i}=0; $1<${2:N}; ++$1)$0

我使用来自 here 的函数分别插入大括号,因为有时您需要牙套,有时不需要。

关于c++ - 如何将 Emacs 24 配置为 K&R(或 Stroutrup)风格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18943167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com