singularitopian363 downloadsDrag & drop to reorder files and folders in the File explorer, with context-menu and command-palette controls.
Plugin for Obsidian to provide custom drag & drop reordering in the File explorer.
Drag and Drop Sort adds custom drag-and-drop ordering to Obsidian's File explorer. Files and folders can be freely interspersed, like in OneNote.
Open Settings → Community plugins → Browse, search for Drag and Drop Sort, then select Install and Enable.
cd src
npm install
npm run build
Copy src/dist/main.js, manifest.json, and src/styles.css into .obsidian/plugins/drag-drop-sort/.
Enable Drag and Drop Sort under Settings > Community plugins.
Drag any file or folder in the File explorer. A blue drop indicator shows where the item will land; release to commit the new order. Dropping between rows in another folder moves the item into that folder at that position. Hover over a closed non-empty folder for two seconds to expand it and reveal its child rows.
You can also right-click an item and use Drag and Drop Sort commands to move it up, down, to the top, or to the bottom. Right-click a folder and choose Reset sort to remove that folder's saved order, or Reset sort (all descendants) to remove the folder's order and all custom orders below it.
The plugin patches getSortedFolderItems() on the internal File explorer view, makes visible tree items draggable, and saves each changed folder's order to data.json. When a folder has no saved custom order, its currently rendered DOM order is captured when dragging starts before the new position is applied. Hovering over a closed non-empty folder for two seconds expands it through Obsidian's collapse control, then refreshes the visible order snapshot so positional drops remain consistent. Dropping across folders also moves the item through Obsidian's file manager. Hidden rows and unsupported file types are excluded from positional calculations so the drop position matches what is visible.
The plugin stores one simple object in .obsidian/plugins/drag-drop-sort/data.json:
{
"orders": {
"Personal": ["Home", "Career", "Health", "Travel", "Finances"],
"Personal/Home": ["Furniture.md", "Plants.md", "Kitties.md", "Assets"]
}
}
Only folders you've actually reordered appear in this file. The order array contains item names (not full paths), and files and folders are freely mixed together.
This plugin is built and released using the repository's release.yml workflow. It is versioned using Semantic Versioning.
It is published as a community plugin, with release assets published to a corresponding GitHub Release:
The TypeScript source lives in src/. Run the plugin in watch mode while developing:
cd src
npm install
npm run dev
Run npm run build for a production build.
To inspect the plugin in Obsidian's live renderer, close any running Obsidian instance and start it with remote debugging enabled:
& "C:\Program Files\Obsidian\Obsidian.exe" --remote-debugging-port=9222
webSocketDebuggerUrl returned for the renderer target.The --remote-debugging-port switch is documented in Electron's command-line switch reference, and the /json/list endpoint and webSocketDebuggerUrl are part of the Chrome DevTools Protocol.
Contributions are welcome. Please fork the repository, create a focused branch for your change, and open a pull request with a clear description of what changed and why; issues are also welcome for bug reports and feature ideas.
We welcome responsible security reports. Please contact the repository owner privately with the details rather than opening a public issue, so the problem can be investigated and addressed before it is disclosed.
Drag and Drop Sort is an independent implementation based on the architecture and patterns of Folder Sort Rules by Adam. The getSortedFolderItems monkey-patch and per-item drag handler pattern are adapted from that MIT-licensed codebase.
This project is licensed under the MIT License - see the LICENSE.md file for details.