gpt4 book ai didi

c++ - 如何在 emacs C++ 模式下到达行尾但在注释开始之前?

转载 作者:太空狗 更新时间:2023-10-29 21:20:29 25 4
gpt4 key购买 nike

在实践中我经常遇到以下情况:

statement_line /*..some comments..*/

有时我需要跳转到 just pass the end of the statement_line to: add some code, or delete the entire comment region.

有键盘快捷键吗? (我知道 C-s ; Ret 适用于以“;”结尾的语句行,但并非所有情况都是如此。例如 if(...)/*...comments...*/)

提前致谢。

最佳答案

试试这段代码:

(defun end-of-statement ()
(interactive)
(beginning-of-line)
(if (comment-search-forward (line-end-position) t)
(re-search-backward "//\\|/\\*")
(end-of-line))
(skip-chars-backward " \t"))

我刚写的,所以可能需要一些调整,但看起来目前还好。

关于c++ - 如何在 emacs C++ 模式下到达行尾但在注释开始之前?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24468965/

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