Since my last warehouse stock system project in Korea almost 1 years ago, I have been idle because no projects comes in. Lot of self learning, administration, attend training and etc to kill the time. So this means, I have been a while seriously work with VIM.
Maybe some of you don’t know what is vim. In short this is text editor on your terminal (unix-terminal) and capable to do lot of thing if you know how to use.
In this episode, I want to share how I deleting every lines on current existing file via vim and it works for me ( Thank to Alvin Alexander for tips). To delete all lines in vim, insert this command:
This vim “delete all lines” command can be read like this:
: character starts vim’s “last line mode.”
1 means, “starting at line 1”
,$ means, “until the end of the file”
d means, “delete”
After typing the command, you need to hit the
[enter] key, and when you do so, all lines in the file will be deleted.
Well i just re-post the same thing from Alvin Alexander. All creadit goes to him.
For your information, I have 3 trick how to wipe up all lines inside text file. One is what i share above and the other 2 techniques is using pressing
gg and then
dG but it not always for for every version of vim editor. The last one is nullify the file using
cat /dev/null > target_file but this command is dangerous if mistake happen, it much better to use first technique so I will open, view and comfirm what inside my text file and nuke…bomb… remove all lines.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.