The command to cut (kill) an entire line in Emacs is:
- Move the cursor to the beginning of the line and press
C-k
twice. The firstC-k
kills from the cursor to the end of the line, and the secondC-k
kills the newline character, effectively cutting the whole line
Alternatively:
- Use the command
kill-whole-line
, which kills the entire line including the newline regardless of the cursor position. By default, this is bound toC-S-Backspace
(Control + Shift + Backspace)
Summary:
C-k C-k
at the start of the line cuts the entire line.C-S-Backspace
cuts the entire line from anywhere on the line.
If you want to configure cutting the whole line with a single key or make
C-w
cut the current line when no region is selected, you can customize Emacs
accordingly
. Thus, the simplest built-in ways are:
C-k
twice at the line startC-S-Backspace
anywhere on the line (kill-whole-line command)