📅 2010-Dec-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ deletion, netrw ⬩ 📚 Archive
[ Files matched for the pattern
Log_*
]
The NetRW plugin is a pretty full-fledged file explorer that ships with ViM. Other than opening files and directories, for me the most frequent operation in NetRW is to delete files.
Deleting a File
The command to delete is D
. Move the cursor to the file to be deleted and press D
. You will be prompted in the ViM command line, choose y
to confirm the deletion.
Deleting by Visually Highlighting
When deleting a set of files that are adjacent, it is easier to visually highlight them together and delete them. Place the cursor on the first or last of the files to be deleted. Enter V
to enter Visual Mode. Use the j
and k
keys to move up or down, visually highlighting the files in the process. Press D
to delete the highlighted files.
Deleting by Marking
This trick is useful to delete a few files that are scattered around. Move to each of the files and press mf
to mark each of them. The marking is displayed visually with a different color. Press D
to delete all the marked files.
Deleting by Matching a Pattern
A final trick I find useful is to be able to delete all the files that match a certain pattern. This is especially useful when the files are too numerous to delete by marking them individually or visually.
Type mr
and NetRW will prompt for a regular expression. Enter the pattern to match. All the files that match the pattern are marked (with a different color). Press D
to delete.
Unmarking
If you marked one or more files by mistake, type mu
to unmark all the files that were marked.
For more info type :help netrw
in ViM.