Optionally limit command history to individual tabs #18019

Closed
opened 2026-01-31 06:01:23 +00:00 by claunia · 3 comments
Owner

Originally created by @vertigo220 on GitHub (Jul 23, 2022).

Description of the new feature/enhancement

It's really cool that the up/down command history is remembered across tabs, sessions, and, it appears, even from the standard PowerShell terminal, and that's something I know will be tremendously useful. However, it's also something that could get in the way. Often, I will open multiple windows (or, with Terminal, I can just use tabs) and use each one for different things. For example, I'll use one for looking at help on commands and testing things out, while I use another to do commands to get info, e.g. from files, and possibly another for running my script I'm working on. With the combined history, the various commands I run in each window will pollute the history of the others, making it harder to quickly repeat commands in each window/tab.

Proposed technical implementation details (optional)

Definitely keep the current combined history, but add an option to use a modifier key either to enable or disable it. For example, for someone that mainly prefers using it, they could do so as it currently is, but if they want to limit the history to that of the current tab, they could press Ctrl+Up/Down (or, better yet, double-tapping Ctrl or whatever key is chosen would toggle it). Conversely, I would set the option to use the current tab history by default and require enabling the global history via the modifier key or toggle.

Originally created by @vertigo220 on GitHub (Jul 23, 2022). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> It's really cool that the up/down command history is remembered across tabs, sessions, and, it appears, even from the standard PowerShell terminal, and that's something I know will be tremendously useful. However, it's also something that could get in the way. Often, I will open multiple windows (or, with Terminal, I can just use tabs) and use each one for different things. For example, I'll use one for looking at help on commands and testing things out, while I use another to do commands to get info, e.g. from files, and possibly another for running my script I'm working on. With the combined history, the various commands I run in each window will pollute the history of the others, making it harder to quickly repeat commands in each window/tab. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. --> Definitely keep the current combined history, but add an option to use a modifier key either to enable or disable it. For example, for someone that mainly prefers using it, they could do so as it currently is, but if they want to limit the history to that of the current tab, they could press Ctrl+Up/Down (or, better yet, double-tapping Ctrl or whatever key is chosen would toggle it). Conversely, I would set the option to use the current tab history by default and require enabling the global history via the modifier key or toggle.
Author
Owner

@xtremevipper commented on GitHub (Jul 23, 2022):

👍👍good

@xtremevipper commented on GitHub (Jul 23, 2022): 👍👍good
Author
Owner

@237dmitry commented on GitHub (Jul 23, 2022):

This is PSReadline module option. Session history (Get-History) is new for new session.

(Get-PSReadLineOption).MaximumHistoryCount    # 4096 by default
@237dmitry commented on GitHub (Jul 23, 2022): This is `PSReadline` module option. Session history (`Get-History`) is new for new session. ``` (Get-PSReadLineOption).MaximumHistoryCount # 4096 by default ```
Author
Owner

@zadjii-msft commented on GitHub (Jul 25, 2022):

I honestly have no idea if this is remotely possible. There's not a lot of tight integration between the Terminal and PowerShell / PSReadline. I suspect this request would fit better over at https://github.com/PowerShell/PSReadLine (they might be able to use WT_SESSION to create separate sets of histories? But that's also an implementation detail of the Terminal that I wouldn't want folks to rely on heavily).

@zadjii-msft commented on GitHub (Jul 25, 2022): I honestly have no idea if this is remotely possible. There's not a lot of tight integration between the Terminal and PowerShell / PSReadline. I suspect this request would fit better over at https://github.com/PowerShell/PSReadLine (they might be able to use `WT_SESSION` to create separate sets of histories? But that's also an implementation detail of the Terminal that I wouldn't want folks to rely on heavily).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18019