Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command history based on current folder #13366

Closed
Liero opened this issue Jun 23, 2022 · 2 comments
Closed

Add command history based on current folder #13366

Liero opened this issue Jun 23, 2022 · 2 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@Liero
Copy link

Liero commented Jun 23, 2022

Currently, when I press Up/Down arrow keys, the Terminal suggest previously entered commands.

I want to traverse only previously entered commands in current folder.

Example:

After following sequence of commands:

C:\repo> git commit
C:\repo> cd src\app
C:\repo\src\app> git rm file1.txt
C:\repo\src\app> cd ..\..
C:\repo>

a new keyboard shorcut like PageUp or Ctrl+Up would suggest cd src\app and then git commit, because they were the last commands executed in the directory.

@Liero Liero added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jun 23, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 23, 2022
@zadjii-msft
Copy link
Member

This is a really interesting idea - probably not one that's immediately viable, but an interesting idea nonetheless.

I started typing up a response here and realized I just had a lot of thoughts here, probably more than I had time to type. So my apologies for the kinda random collection of thoughts here

The history is actually provided by the shell, not the Terminal[1]. This would be a really good request for PowerShell / PSReadline, since that's actively maintained and has all sorts of fancy completions. The intelligent auto-complete that they shipped recently might actually just do this. I'm not as familiar with pwsh as I should be.

This does have interesting ties though to #1595, #12863. cd src/app is maybe a bit trivial compared to what I expected for that, but it still counts. Is there a good way for us to stash that relative to the CWD, so that it's a quickly accessible command? Probably not as easy as just up.

[1]: technically, cmd.exe's history actually is powered by conhost. But conhost has no idea what the CWD of a process is. I suppose it could theoretically be told what the CWD is, in the same way the Terminal is, and if it is told the CWD, stash history as a map of dir -> [history]. But there's no good way to pass settings to conhost for something like that.

We theoretically wouldn't really need to worry about back-compat on this one, cause you've already opt'd in to telling us the CWD, no legacy app is gonna accidentally set that.

@zadjii-msft zadjii-msft added the Issue-Question For questions or discussion label Jun 23, 2022
@carlos-zamora
Copy link
Member

Hi @Liero. As Mike said, (with the exception of CMD) shells are the ones responsible for the command history, not the Terminal. We discussed this feature more as a team today, and adding that kind of responsibility to Terminal further complicates the relationship between Terminal and the attached shell, which could be a problem for new users, especially if they switch between different terminal emulators. This might be a better suggestion for "Clink" or "Yori".

@carlos-zamora carlos-zamora closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants