How do I mark and delete multiple files at once from within Vim's built-in file explorer netrw?
Answer
mf and D (in netrw)
Explanation
Vim's built-in file browser netrw (opened with :Explore or :Ex) supports a full file management workflow beyond simple navigation. Most users only know d (create directory) and D (delete under cursor), but netrw has a mark system that lets you batch-operate on multiple files at once.
How it works
Open netrw with :Explore (or press - if your config maps it), then:
mf— mark the file or directory under the cursor (a flag appears next to it)mF— unmark the file under the cursormu— unmark all marked filesD— delete all marked files (prompts for confirmation); deletes the file under cursor if none are markedmt— set a target directory for copy/move operationsmc— copy marked files to the target directorymm— move marked files to the target directory
Example
Delete several old log files in one pass:
1. :Explore /var/log/myapp
2. Navigate to error.log, press mf
3. Navigate to debug.log, press mf
4. Navigate to trace.log, press mf
5. Press D — all three are deleted after confirmation
Tips
mr— mark files using a regexp (prompts for pattern, marks all matches)i— cycle netrw's listing style: thin → long → wide → tree (tree mode is especially useful for project browsing):Vexploreand:Sexploreopen netrw in vertical or horizontal splits- Set
let g:netrw_banner=0in your vimrc to hide the header for a cleaner look