您的位置:首页 > 编程语言 > C语言/C++

emacs常用配置-注释/反注释C++代码

2012-10-06 23:26 323 查看
.emacs配置如下:

(defun qiang-comment-dwim-line (&optional arg)
"Replacement for the comment-dwim command."
(interactive "*P")
(comment-normalize-vars)
(if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
(comment-dwim arg)))
(global-set-key (kbd "C-;") 'qiang-comment-dwim-line)


备注:

使用Ctrl+; 组合键,当光标放在行的始端,或者行的中间位置,即为注释该行代码

当光标放在行的末端,即为给该行代码添加注释。

效果如下图:





参考链接:

http://cmdblock.blog.51cto.com/415170/557978
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  emacs c++