Custom File Order
Take control of your file explorer! This lightweight VS Code extension allows you to manually reorder files and folders to suit your workflow.
Make your important files stand out by moving them to the top, regardless of their alphabetical order.

Features
Drag & Drop
Drag items into folders just like the built-in Explorer. Press Shift+Alt+O (⇧⌥O on Mac), or
click the list button in the view's title bar, to switch to drag to reorder: dropping onto a
sibling then takes its place, as in the clip above.
Move Up, Down, to the Top or Bottom
Move any file or folder one step up or down, or straight to the top or bottom, from the
right-click menu or with the keyboard.

Multi-Select Moves
Select several items and they move together as a block, keeping their relative order.

Works in the Built-in Explorer Too
Optional: turn on customFileOrder.nativeExplorer and the same order shows in VS Code's own
Explorer, with a Custom Order right-click menu there. See
Native Explorer mode.

More
- Reset & Restore:
- Restore Item Position: Reset a single file to its default alphabetical position within your custom list.
- Reset to Default Order: Clear all custom ordering for a folder to revert to standard VS Code sorting.
- Smart Sorting: Keeps your projects organized exactly how you want them, with digit-aware
names so
file2 sorts before file10.
- Folder Rules: Global "Folders First" support to match your VS Code settings.
- Respects
files.exclude: The view hides what the Explorer hides, plus anything in
customFileOrder.exclude.
- Familiar Context Menu and Keys: New File, New Folder, Open to the Side, Reveal in File
Explorer (Finder on Mac), Open in Integrated Terminal, Cut/Copy/Paste, Copy Path, Copy Relative
Path, Rename, Duplicate and Delete — on both files and folders, with the same shortcuts as the
built-in Explorer on Windows, Mac and Linux.
Usage
- Open the View: Look for the "Custom File Order" view in the Explorer sidebar.
- Reorder:
- Press
Shift+Alt+O (⇧⌥O on Mac), or click the list button in the view's title bar, to
turn on drag to reorder; the view's header then reads Drag to reorder. Now drag an
item onto one of its siblings to take that sibling's place. Press it again to go back to
normal dragging.
- Or use the keyboard (
Shift+Alt+Up / Shift+Alt+Down), or
right-click any item and pick Move Up, Move Down, Move to Top or
Move to Bottom.
- Select several items first and they move together as a block, keeping their relative
order. Only items in the same folder move against each other.
- The folder will automatically switch to "Custom Order" mode.
- Move between folders by dragging, as in the built-in Explorer:
- Onto a folder: the item moves into that folder.
- Onto a file: the item moves into that file's folder.
- Onto empty space: the item moves to the workspace root.
- Moves go through VS Code, so open editors follow the file and language servers can offer
to update imports. A name that is already taken is left alone, never overwritten.
- In drag to reorder mode, dropping onto something in the same folder reorders instead,
and dropping onto a file elsewhere puts the item just above that file.
- Resetting:
- To fix a single item: Right-click -> "Restore Item Position".
- To clear a whole folder: Right-click -> "Reset to Default Order".
Keyboard Shortcuts
These work while the Custom File Order view has focus, but never while you are typing in
its find box. Plain arrow keys navigate as usual.
| Action |
Windows / Linux |
Mac |
| Move the selected item(s) up / down |
Shift+Alt+↑ / Shift+Alt+↓ |
⇧⌥↑ / ⇧⌥↓ |
| Move the selected item(s) to the top / bottom |
Shift+Alt+Home / Shift+Alt+End |
⇧⌥⌘↑ / ⇧⌥⌘↓ |
| Turn drag to reorder on / off |
Shift+Alt+O |
⇧⌥O |
| Rename |
F2 |
Enter |
| Delete (to the Recycle Bin / Trash) |
Delete |
⌘⌫ |
| Cut / Copy / Paste |
Ctrl+X / Ctrl+C / Ctrl+V |
⌘X / ⌘C / ⌘V |
As in Finder and VS Code's own Explorer, Enter renames on a Mac; open a file with ⌘↓ or a
click. Every shortcut can be changed under Keyboard Shortcuts by searching for
"Custom File Order".
Paste goes into the selected folder, or the selected file's folder. Cut and paste is a move,
exactly like dragging, so nothing is copied and deleted behind your back and nothing is ever
overwritten; a copy pasted next to its original is named name copy.ext. Paste only appears
once something has been cut or copied.
Acting on the workspace root
VS Code does not let extensions add a menu to the blank area below a view's items
(microsoft/vscode#188259), so right-clicking
empty space cannot work the way it does in the built-in Explorer. The same actions live in the
view's toolbar instead: New File and New Folder are icons in the view header, and
Open in Integrated Terminal and Paste are in its ... menu. All four act on the
workspace root.
Native Explorer mode
Prefer VS Code's own Explorer? Run Custom File Order: Toggle Custom Order in Native Explorer
from the Command Palette (or the ... menu of the Custom File Order view), or set
customFileOrder.nativeExplorer to true. Your folders then show in the custom order in the
built-in Explorer, and right-clicking there offers Custom Order → Move Up / Move Down / Move to
Top / Move to Bottom / Restore Item Position / Reset to Default Order.
Both views read the same customFileOrder.rules, so anything you reorder in one shows up in the
other, and you can switch back any time.
How it works, and what it changes. VS Code has no API for extensions to sort its Explorer,
so this mode:
- sets
explorer.sortOrder to modified (newest first) for the workspace, and puts your
previous value back when you turn the mode off;
- rewrites the modification times of entries in folders that have a custom order, so that
newest-first matches your order, and keeps them that way as files are saved, added or
removed.
Times only ever move forward and file contents are never touched, so build tools that compare
modification times may rebuild more, but never skip a change. Tools that sync or back up by
modification time may re-upload those files. VS Code asks before turning the mode on.
Reset to Default Order puts a folder back in name order, and it stays that way as files
change. Limits of the Explorer itself: in this mode it always lists folders before files, and
folders that never had a custom order sort by date modified rather than by name. Keyboard shortcuts only work
in the Custom File Order view, because VS Code does not tell extensions which Explorer item a key
was pressed on; use the right-click menu in the Explorer.
Turn the mode off before uninstalling the extension, so your previous sort order comes back. If
you only use the built-in Explorer, you can hide the Custom File Order view by right-clicking
its header.
Configuration
Ordering is stored in your workspace settings under customFileOrder.rules. Each key is a
folder path relative to the workspace root (using /), or . for the root itself. Entries
can be exact names or globs, and anything you do not list is appended in the default order.
{
"customFileOrder.rules": {
".": { "order": ["package.json", "README.md", "src"] },
"src/components": { "order": ["index.ts", "*.tsx", "*.css"] }
}
}
| Setting |
Default |
Description |
customFileOrder.defaultFoldersFirst |
true |
Show folders before files where no custom order applies. |
customFileOrder.showCustomOrderIndicator |
true |
Label folders that carry their own ordering rule. |
customFileOrder.enableAutoRefresh |
true |
Refresh the view when files are created or deleted. |
customFileOrder.dragToReorder |
false |
Dropping onto a sibling reorders instead of moving into folders. Toggle with Shift+Alt+O. |
customFileOrder.nativeExplorer |
false |
Also show the custom order in the built-in Explorer (see above). |
customFileOrder.useFilesExclude |
true |
Hide whatever files.exclude hides, as the Explorer does. |
customFileOrder.exclude |
.git, node_modules |
More globs to hide, in the files.exclude format. Set one to false to show something files.exclude hides. |
Anything a folder's order names explicitly is always shown, even if a pattern would hide it.
License
This project is open source and available under the MIT License.