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

repl: substring based search history #28437

Closed
vapniks opened this issue Jun 26, 2019 · 11 comments
Closed

repl: substring based search history #28437

vapniks opened this issue Jun 26, 2019 · 11 comments
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@vapniks
Copy link

vapniks commented Jun 26, 2019

Most repl's I've used before allow you to quickly get a previous command back by using the Ctrl+r key to search the command history. It makes life so much easier when you're testing stuff out. Any chance this could be implemented for the nodejs repl?

@Trott Trott added feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem. labels Jun 26, 2019
@silverwind
Copy link
Contributor

I'd prefer something a bit more smart like https://github.com/zsh-users/zsh-history-substring-search.

Basically, it makes up arrows trigger a substring-based search with what is written on the command line and subsequently lets you use up/down arrows to flip through results. I think it's clearly superior to bash's CTRL-R.

@someone-1
Copy link

Hi
Anyone working on this?
Can I take it up?

@BridgeAR
Copy link
Member

BridgeAR commented Jul 5, 2019

@someone-1 there is a stalled PR by @antsmartian (#24335). @antsmartian do you have some time to have a look at that soon again? Otherwise @someone-1 could maybe go ahead and work on it?

@silverwind
Copy link
Contributor

I think we should decide whether it'll be CTRL-R or substring-based, or both. I guess substring shouldn't be too hard to implement. CTRL-R is more involved as you need to replace prompt etc.

@vapniks
Copy link
Author

vapniks commented Jul 6, 2019

I'm happy with either.

@antsmartian
Copy link
Contributor

@BridgeAR Yes, its stalled for sometime. Soon, will have a look at it.

@antsmartian
Copy link
Contributor

Taken care by: #31006

@BridgeAR
Copy link
Member

Reopened to keep the feature request for the substring-based search as suggested by @silverwind

@BridgeAR BridgeAR reopened this Dec 25, 2019
@antsmartian
Copy link
Contributor

@BridgeAR: I don't quite get what is meant by substring-based search.

@BridgeAR
Copy link
Member

BridgeAR commented Dec 25, 2019

@antsmartian if you press up or down in ZSH after writing a few characters triggers a history search that takes the already written part as start of the search string. So only history entries will come up that match the input.

@targos
Copy link
Member

targos commented Dec 25, 2019

We should probably rewrite the issue title if it's no longer about ctrl+r

@BridgeAR BridgeAR changed the title repl Ctrl-r keybinding to search history repl: substring based search history Dec 25, 2019
BridgeAR added a commit to BridgeAR/node that referenced this issue Jan 8, 2020
This improves the current history search feature by adding substring
based history search similar to ZSH. In case the `UP` or `DOWN`
buttons are pressed after writing a few characters, the start string
up to the current cursor is used to search the history.

All other history features work exactly as they used to.

Fixes: nodejs#28437
MylesBorins pushed a commit that referenced this issue Jan 16, 2020
This improves the current history search feature by adding substring
based history search similar to ZSH. In case the `UP` or `DOWN`
buttons are pressed after writing a few characters, the start string
up to the current cursor is used to search the history.

All other history features work exactly as they used to.

PR-URL: #31112
Fixes: #28437
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit to targos/node that referenced this issue Apr 25, 2020
This improves the current history search feature by adding substring
based history search similar to ZSH. In case the `UP` or `DOWN`
buttons are pressed after writing a few characters, the start string
up to the current cursor is used to search the history.

All other history features work exactly as they used to.

PR-URL: nodejs#31112
Fixes: nodejs#28437
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Apr 28, 2020
This improves the current history search feature by adding substring
based history search similar to ZSH. In case the `UP` or `DOWN`
buttons are pressed after writing a few characters, the start string
up to the current cursor is used to search the history.

All other history features work exactly as they used to.

PR-URL: #31112
Fixes: #28437
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants