评论块与emacs中的明星

ajm*_*tin 6 emacs comments

需要执行哪些设置和命令才能在emacs中执行此类注释:

  /**
   * 
   * something here
   */
Run Code Online (Sandbox Code Playgroud)

谢谢.

Ral*_*lph 5

一种简单的方法是定义自己的命令以插入此注释。将此添加到您的.emacs文件:

(defun insert-doc-comment () (interactive)
   (insert "/**\n * Brief description. Long description. \n * @param \n * @return \n * @exception \n * @see \n * @author \n */"))
Run Code Online (Sandbox Code Playgroud)

然后将新命令绑定到您喜欢的键上:

(define-key global-map [(S-f1)] 'insert-doc-comment)
Run Code Online (Sandbox Code Playgroud)

现在按下Shift-F1将插入一个注释块,如下所示:

/**
 * Brief description. Long description. 
 * @param 
 * @return 
 * @exception 
 * @see 
 * @author 
 */
Run Code Online (Sandbox Code Playgroud)

  • 也许您所处的终端无法识别Shift +功能键。按“ Ch k”,然后按“ S-f1”,以查看Emacs是否将这些键识别为“ S-f1”。 (2认同)