Many people facing an issue and some error when they opening Vim editor or Vi editors. So also you are one who facing the same errors so this is so simple to fix this type of error and use Vim editor or Vi editors easily.

So it’s easy to fix but many people are new they don’t know about this error how to fix this small error. So this is easy to delete all lines from a file you already open the file. Follow our steps to empty a file. this step is so simple.

Simply go to a command file editor and then press the ESC button & then press gg two times. So after doing this you will go to the first line of the page So then press the dg button from your keyword after implementing this command from the first line to the last line all of your files will clear.

So this is simple to delete command or empty the editor, So also another alternative method is available if you want to apply this method so simply apply this command Vi/Vim. Simply visit the command page and run this command.

cat /dev/null > file

:1,$d

Keep in mind both are diffirent commands. i mean this command is two.

So I hope this article is helpful for you, we explain you how to fix error, delete or clear all lines while when you are using Vim/Vi editor. So if you still facing any issue please drop a comment below we try our best to solve your problem.

Previous articleUsing Sed Command to Remove or Delete Lines in File
Next article400+ Best Tinder Bio For Boys & Girls
Hi, i am Haider Jamal Abbasi and founder of iamhja.com. I start my blog journey in 2018 and i love writing on trending topics people love to read. Any Question? and Issue! Contact me
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments