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

Mention !... history shortcuts in "coming from..." pages #1072

Open
BatmanAoD opened this issue Sep 21, 2023 · 8 comments
Open

Mention !... history shortcuts in "coming from..." pages #1072

BatmanAoD opened this issue Sep 21, 2023 · 8 comments

Comments

@BatmanAoD
Copy link
Contributor

The !!, !$, !<number>, !-<number>, and possibly other history shortcuts work in Reedline roughly the way they do in Bash (though Bash's behavior is complicated and it seems some features are not supported, such as substitutions with s^...^...). This is probably worth mentioning in the "coming from ... " pages for different shells.

PowerShell's equivalent for !$ is $$; I'm not sure if it has an equivalent for the others. I don't think cmd.exe supports this feature at all.

@fdncred
Copy link
Collaborator

fdncred commented Sep 21, 2023

Good idea. They should be mentioned.

@BatmanAoD
Copy link
Contributor Author

BatmanAoD commented Sep 21, 2023

One major difference is that by default, Enter performs the substitution rather than running the command as usual. In a recent-enough Bash, you can configure Space to do this (see this blog post).

@fdncred
Copy link
Collaborator

fdncred commented Sep 21, 2023

ya, that would be cool to have space expand it. i really wish we could combine this stuff with an fish abbrev-like functionality. they're very similar, one gets that last commands and one just expands aliases.

@orr721
Copy link

orr721 commented Sep 21, 2023

Is it possible to map !$ to some other key combination? Unfortunately on my keyboard layout to execute !$<Enter> requires 5 key presses (shift to get !, alt to get $). I am longing for bash <Esc>. all the time (2 key presses). A user defined combination would be great..

@sholderbach
Copy link
Member

I am longing for bash <Esc>. all the time (2 key presses). A user defined combination would be great..

Worth checking the https://github.com/nushell/reedline/issues and adding a feature request there, maybe someone is interested in figuring this out :)

@fdncred
Copy link
Collaborator

fdncred commented Sep 21, 2023

@orr721 I believe this works

  {
    name: insert_last_token
    modifier: alt
    keycode: char_.
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: InsertString, value: " !$" }
      { send: Enter }
    ]
  }

@orr721
Copy link

orr721 commented Sep 22, 2023

yes! I'm on a mac though, so I had to change the modifier to control and keycode to other key. but finally it works, thank you!👍

@fdncred
Copy link
Collaborator

fdncred commented Sep 22, 2023

yes! I'm on a mac though, so I had to change the modifier to control and keycode to other key. but finally it works, thank you!👍

been there. done that. i use a mac too during the evenings and weekends. keybindings are sometimes hard to get recognized. it's why i wrote keybindings listen and someone else wrote input listen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants