@kyanny's blog

My thoughts, my life. Views/opinions are my own.

M-x comment-line (C-x C-;)

カーソル行をコメント・アンコメントしてくれる。リージョンが選択されているときはリージョン範囲の行全てが対象。

知らなかった...。これまでずっと

  • 行頭に移動 C-a
  • マークをセット C-SPC
  • 行末に移動 C-e
  • リージョンをコメント M-;

していた。

キーストロークが半分になるので、ぜひ指に覚えさせたい。

comment-line is an interactive compiled Lisp function in `newcomment.el'.

It is bound to C-x C-;.

(comment-line N)

For more information check the manuals.

Comment or uncomment current line and leave point after it. With positive prefix, apply to N lines including current one. With negative prefix, apply to -N lines above. Also, further consecutive invocations of this command will inherit the negative argument.

If region is active, comment lines in active region instead. Unlike ‘comment-dwim’, this always comments whole lines.

[back]