Answers for "vim delete all lines"

10

vim select all and delete

Press "esc" button;
Type: ggdG
Posted by: Guest on June-15-2020
22

vim delete line

# Basic syntax:
dd

# Note, add a number in from of dd to delete that many lines, e.g.:
5dd # Delete the next 5 lines
Posted by: Guest on October-10-2020
5

vim delete all lines

:1,$d
Posted by: Guest on March-27-2021
1

vim delete from delimeter to end of line for all lines

# Basic syntax:
:%norm $T<delimiter>D
# Where:
#	- % indicates that the command should be applied on all lines
#	- norm indicates that the command is to be run in normal mode
#	- $T - not sure - probably something like "to end of line"
#	- D indicates delete
Posted by: Guest on July-22-2021
1

vim select lines and delete

# Press v and you are in visual mode
# Select the lines
# Press x
Posted by: Guest on March-31-2021
0

delete all lines in vi

#in command mode
gg #takes you to the first line
dG #deletes all
Posted by: Guest on June-14-2021

Browse Popular Code Answers by Language