Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 emacs 上,当我将“//”放在 C 代码行的开头时,我想激活注释
把这个放在你的~/.emacs
~/.emacs
(require 'cc-mode) (define-key c-mode-map "/" (lambda () (interactive) (if (not (looking-back "^/")) (self-insert-command 1) (insert "* */") (backward-char 3))))
仅当您处于 C 代码行的实际开头时,这才有效,即没有缩进。如果要缩进,请将正则表达式更改为"^[ \t]*/".
"^[ \t]*/"