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

cli/sql: trigger history search by typing a prefix + up arrow #21825

Closed
andreimatei opened this issue Jan 26, 2018 · 4 comments
Closed

cli/sql: trigger history search by typing a prefix + up arrow #21825

andreimatei opened this issue Jan 26, 2018 · 4 comments
Labels
A-cli-client CLI commands that pertain to using SQL features C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) no-issue-activity X-stale

Comments

@andreimatei
Copy link
Contributor

andreimatei commented Jan 26, 2018

I want the history search to be activated when I press the up arrow after typing a statement prefix. The search should be initialized with that prefix. So, if I type "alt" then up arrow, I want to search for the last statement that started with "alt". And then up arrow and down arrow would cycle through commands with that prefix.

You get that in bash with this:

bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

I think it's inspired by Matlab's console, and it's so good! I never want to use a terminal without it again.

Jira issue: CRDB-5874

@andreimatei
Copy link
Contributor Author

cc @knz

@knz knz added this to the Later milestone Jan 26, 2018
@knz
Copy link
Contributor

knz commented Jan 26, 2018

You can customize bindings with libedit in your ~/.inputrc. Feel free to dig into libedit and figure out what's the equivalent way to do this.

Offhand remark: we've made the choice to rely on a 3rd party moderately standard library precisely because we don't want to be baking custom code around an area of unix which is extremely hard to get right. I am not keen to go and tweak that code to address every need under the sun. In my opinion: if libedit supports this with a custom inputrc, then use that. If it doesn't, tough luck.

If it works in bash and not in libedit, that's just a sign that GNU readline is better. But we knew that already. If it was not for licensing, we'd use GNU readline too.

@knz knz changed the title cli: trigger history search by typing a prefix + up arrow cli/sql: trigger history search by typing a prefix + up arrow Apr 11, 2018
@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) and removed feature labels Apr 24, 2018
@petermattis petermattis removed this from the Later milestone Oct 5, 2018
@github-actions
Copy link

github-actions bot commented Jun 8, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added A-cli-client CLI commands that pertain to using SQL features and removed no-issue-activity labels Jun 8, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-client CLI commands that pertain to using SQL features C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) no-issue-activity X-stale
Projects
No open projects
Development

No branches or pull requests

3 participants