Mass refactoring file and directory names across a large project can be a real headache. When you need to rename dozens, or even hundreds of files consistently, the usual tools like oil.nvim or neo-tree.nvim just don’t cut it. That’s exactly the problem I ran into, and it’s what inspired foil.nvim.
Foil.nvim is heavily inspired by Oil.nvim and feels familiar if you’ve used Oil, but it removes the single directory limitation. With foil.nvim, you can perform bulk renaming of files and directories across multiple roots, making large-scale refactoring much more manageable.
# A practical example
Recently, I had to migrate all index-transform.ts files in an NX monorepo to JavaScript to skip the ts-node transpilation step. With more than 30 apps, this meant touching dozens of files across different directories:
apps
- app1
- index-transform.ts
- app2
- index-transform.ts
- app3
- index-transform.ts
...
- app30
- index-transform.ts
# Update the file contents
To replace the ESM export default
with CJS module.exports
, I used the quickfix list and :cdo. You can check out my previous post where I explain this workflow in detail.
# Rename all files from .ts to .cjs
- 1. Open all the files you want to rename in a quickfix list.
-
2. Execute
:FoilQuickfix
to open all entries in foil. -
3. Use the
:substitute
command to rename .ts to .cjs - 4. Save the buffer


Foil.nvim handles the rest, deleting, renaming, and moving files and directories automatically. This makes mass refactoring of file and directory names across large projects quick, reliable, and much less painful.