How can I delete the current line in Emacs?

后端 未结 5 1012
别那么骄傲
别那么骄傲 2021-01-29 18:42

What is the emacs equivalent of vi\'s dd? I want to delete the current line. Tried CTRL + k but it only deletes from current position.

5条回答
  •  悲哀的现实
    2021-01-29 19:11

    In case you don't want to kill the line (which would put it into the OS clipboard and kill ring) but simply delete it:

    (defun delete-current-line ()
      "Delete (not kill) the current line."
      (interactive)
      (save-excursion
        (delete-region
         (progn (forward-visible-line 0) (point))
         (progn (forward-visible-line 1) (point)))))
    

提交回复
热议问题