feat: add configurable file metadata column#54
feat: add configurable file metadata column#54Goutham-AR wants to merge 9 commits intocorwinm:mainfrom
Conversation
- Add MetadataColumn type and FileMetadata interface to constants.ts. - Extend OilState with a metadataCache field. Add metadataUtils.ts with fixed-width formatting helpers (formatSize, formatMtime, formatPermissions, formatMetadataColumns) and populateMetadataCache. - Add getColumnsSettings() to settings.ts. - Add peekOilState() to oilState.ts for use in the decoration layer. - Initialize metadataCache in both OilState init functions.
- Call populateMetadataCache at the end of getDirectoryListing when at least one non-icon column is configured. Clear the cache entry for the current directory on refresh, alongside visitedPaths. - Add oil-code.columns setting (array, default ["icon"]) with enum values icon/permissions/size/mtime. Register oil-code.toggleDetails command and alt+shift+d keybinding.
…mand Add columnState.ts with session-level getDetailsVisible/toggleDetailsVisible. - Add toggleDetails command that flips the flag and redraws all visible oil editors. - Update updateDecorations to inject metadata as before: virtual text at the filename start position when non-icon columns are configured and details are visible. Metadata is never written to buffer text, so the /NNN filename format and the save/diff pipeline are entirely unaffected. - Register oil-code.toggleDetails in extension.ts.
- Map <C-d> to oil-code.toggleDetails in both the neovim Lua autocmd block and the VSCodeVim normal-mode keymap registration. - Add three tests: toggleDetails executes without error, rename with metadata columns enabled does not corrupt file operations, and buffer text always stays in /NNN filename format regardless of columns setting.
corwinm
left a comment
There was a problem hiding this comment.
This looks really great so far, thank you! I added some comments for some improvements and I want to align the default keymaps so they don't conflict with the existing "" keymap.
Once those keymap changes are in place, we should update the README.md and help.ts content to include the new keymaps.
Thanks again! Overall this is really great work 😃
| case "mtime": | ||
| parts.push(meta.mtime); // always 12 chars | ||
| break; | ||
| // "icon" is not a metadata column — silently ignored |
There was a problem hiding this comment.
I think I will want to consolidate the two but that might have to be a follow up refactor unless you want to make that update.
There was a problem hiding this comment.
Thanks, Could you clarify what you mean by "consolidate the two"? Happy to do this now, I just want to make sure I target the right thing.
There was a problem hiding this comment.
I mean to consolidate the column configuration into one. Right now we have icons as its own unique thing and metadata as another. They should be consolidated to simplify the code. I haven't looked at this too deeply so I don't know if their is a downside or any breaking changes that would need to be considered to do this but that would clean things up if icons and the other columns were configured the same way oil.nvim has them configured.
There was a problem hiding this comment.
Unifying the rendering implementations for metadata and icons is not trivial due to the below reasons:
- Icons need per-icon colors, In VSCode, it is set at
TextEditorDecorationTypecreation time and cannot vary per range. This means we need oneTextEditorDecorationTypeper icon key, stored in a Map.
Metadata is all the same muted color, so it only needs a single TextEditorDecorationType with dynamic contentText per line via renderOptions.before.
Happy to get your input on whether you'd prefer a different approach here.
There was a problem hiding this comment.
I think we can leave it for now and just acknowledge the limitation with how it is implemented. I think the implementation still fits the most common use case and we don't need to make it more complicated.

feat: add configurable file metadata column
📝 Description
Adds opt-in file metadata columns to the oil directory listing, displayed as
virtual text decorations to the left of each filename — similar to Emacs Dired
and oil.nvim's column system.
The buffer text format (
/NNN filename) is never modified, so thesave/diff pipeline is completely unaffected. Metadata is rendered purely via
VSCode
before:decorations and never written into the document.New setting
oil-code.columns(default["icon"]— no breaking change):iconpermissions-rw-r--r--size12KmtimeMar 14 14:23New command
oil-code.toggleDetails— toggles metadata display on/off forthe current session without changing the setting.
Alt+Shift+D<C-d>oilfiletype<C-d>🔧 Type of Change
🔗 Related Issues
Testing
Screenshots (if applicable)
Checklist
Additional Notes
None