-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
What would you like to see added?
Feature Request: Right-Aligned Timestamp Printed After Command Execution (Post-Command, Scrollback-Persistent)
Summary
I'd like to request a feature that enables a timestamp to be printed right-aligned on the same line as the just-executed command, immediately after the command runs and before the next prompt is drawn.
This is not a traditional right_prompt
or transient_prompt
feature request. Instead, it's a proposal for a behavior where the timestamp is written directly to the terminal output, simulating a right-aligned transient prompt enhancement, without modifying the user’s actual prompt configuration or affecting long command lines.
What I’m Looking For
Visual Example
When I run a command like:
❯ cd ~/projects
The terminal would immediately display something like:
❯ cd ~/projects Sep 21 02:45
Then the next prompt appears as usual.
This printed timestamp becomes part of the scrollback and looks like it was “always there”; creating a persistent log of command execution times.
Why This Matters
When I work in long terminal sessions (often for hours), I frequently want to:
- See when each command was run
- Understand the timing between events
- Troubleshoot or track workflow history visually
Currently, prompts disappear via transient_prompt
, and right_prompt
is not scrollback-persistent, so I lose all temporal context once the prompt collapses.
This feature would:
- Add meaningful context to every command line
- Help users analyze terminal sessions over time
- Enable better debugging, journaling, and situational awareness
- Complement (not replace) existing transient prompt behavior
Why Not Use right_prompt
or transient_prompt
?
right_prompt
only renders visually, and disappears when a new command is run; not helpful for scrollback.transient_prompt
collapses the prompt (which I want), but currently doesn’t support right-aligned content.- Even if it did, long commands would collide with any right-aligned segment placed in the template.
This request avoids all of that by treating the timestamp as a post-command echo, written after the command runs, using actual output (not a prompt template).
Technical Proposal (Rough Idea)
This could be implemented using a post-command hook (like precmd
) that:
- Captures the cursor position
- Calculates terminal width
- Prints a timestamp right-aligned on the same line as the previous command
- Respects prompt length, possibly only activating if the command was short enough
- Does not affect the actual prompt rendering
This would be completely optional and opt-in.
Edge Case Considerations
- Commands that span multiple lines (or have long arguments) might not leave room for a timestamp, this could be detected and skipped.
- Users should be able to configure:
- Time format
- Minimum space required
- Enable/disable logic
Final Thoughts
This idea blends the best of both worlds:
- The clean UI and collapsing behavior of transient prompts
- The persistent, useful context of timestamped command logs
It doesn’t clutter the prompt itself, and it doesn’t rely on template hacks or risky terminal overlays. It's simply a post-execution write that feels like part of the prompt, but isn’t; which makes it reliable and flexible.
Thanks for considering this. I’d love to see this make its way into Oh My Posh. It would be a powerful yet minimal enhancement for users who care about long-session context without sacrificing terminal clarity.