The command to cut (delete) an entire line in the Vim or Vi text editor is:
dd
This command cuts the line where the cursor is currently located, removing it from the text and placing it in the buffer for pasting elsewhere if desired
. Additional relevant commands related to cutting lines in Vim/Vi:
3dd
cuts three lines starting from the current line
dG
deletes from the current line to the end of the file
- To paste the cut line(s), use
p
to paste after the cursor orP
to paste before the cursor
In summary, to cut an entire line, position the cursor on that line in normal mode and type:
vim
dd
This is the standard and most straightforward way to cut a line in Vim/Vi