-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
nushell: atuin should not always trigger on ⬆️ #1025
Comments
hmmm... i think that might be a nushell bug. I think nushell should be overriding global keybinds like "up arrow" with local keybinds but isn't doing that. Have you opened an issue in the nushell repo? if so, can you link to it here? |
This issue leads to a pretty terrible experience, should we disable the up arrow by default for Nushell until this can be fixed? |
I think that would probably be best, though hopefully their keybindings become more flexible soon 🙏 Are you happy to make the PR? |
The up-arrow keybinding triggers anytime the key is pressed, including in menus or multiline commands. Disabling it by default for new users. See atuinsh#1025
Welcome to the club! However, after several hours of setup. Nushell is not ready for daily usage. - [nushell: atuin should not always trigger on ⬆️ · Issue #1025 · atuinsh/atuin](atuinsh/atuin#1025) - [`column_not_found` in Nushell · sxyazi/yazi · Discussion #501](sxyazi/yazi#501) - [Generated .zoxide.nu has incorrect syntax · Issue #661 · ajeetdsouza/zoxide](ajeetdsouza/zoxide#661) - [Nushell support · Issue #463 · Schniz/fnm](Schniz/fnm#463) - Syntax highlighting still requires manual setup. - https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md#manual-installation - nufmt is still very much in beta.
Welcome to the club! However, after several hours of setup. Nushell is not ready for daily usage. - [nushell: atuin should not always trigger on ⬆️ · Issue #1025 · atuinsh/atuin](atuinsh/atuin#1025) - [`column_not_found` in Nushell · sxyazi/yazi · Discussion #501](sxyazi/yazi#501) - [Generated .zoxide.nu has incorrect syntax · Issue #661 · ajeetdsouza/zoxide](ajeetdsouza/zoxide#661) - [Nushell support · Issue #463 · Schniz/fnm](Schniz/fnm#463) - Syntax highlighting still requires manual setup. - https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md#manual-installation - nufmt is still very much in beta.
FYI the default keybinding in nu is this {
name: move_up
modifier: none
keycode: up
mode: [emacs, vi_normal, vi_insert]
event: {
until: [
{send: historyhintcomplete }
{send: menuup}
{send: up}
]
}
} I think the "until" is how you leverage "doing the right thing at the right time". I don't know any more details than that. |
I'm not sure where you copied this from, but the default config seems to be this and hasn't changed in a while, except for formatting: {
name: move_up
modifier: none
keycode: up
mode: [emacs, vi_normal, vi_insert]
event: {
until: [
{send: menuup}
{send: up}
]
}
} You can find the Based on this, I modified the commented out part in the init script $env.config = (
$env.config | upsert keybindings (
$env.config.keybindings
| append {
name: atuin
modifier: none
keycode: up
mode: [emacs, vi_normal, vi_insert]
event: {
until: [
{send: menuup}
{send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') }
]
}
}
)
) This seems to work! I can navigate through menus and when not in one I'm opening atuin. Basically it first tries to do the I was thinking to add a And yeah, when I modify the command to produce a positive exit code, the current behaviour seems to be that it just silently stops or crashes in some way, and nu gives me a new line. Instead of going to the next action in the array (what I thought might happen). |
That's great I will probably test drive this on Monday. -------- Original Message --------On 2/25/24 11:39 AM, Remmy Cat Stock wrote:
I'm not sure where you copied this from, but the default config seems to be this and hasn't changed in a while, except for formatting:
{
name: move_up
modifier: none
keycode: up
mode: [emacs, vi_normal, vi_insert]
event: {
until: [
{send: menuup}
{send: up}
]
}
}
You can find the until reference here: https://www.nushell.sh/book/line_editor.html#until-type
Based on this, I modified the commented out part in the init script
$env.config = (
$env.config | upsert keybindings (
$env.config.keybindings
| append {
name: atuin
modifier: none
keycode: up
mode: [emacs, vi_normal, vi_insert]
event: {
until: [
{send: menuup}
{send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') }
{send: up}
]
}
}
)
)
This seems to work! I can navigate through menus and when not in one I'm opening atuin.
Maybe I'm missing something but I think this might be the fix.
Basically it first tries to do the menuup action, if that fails (because we're not in a menu), it tries atuin.
I think the last line with {send: up} can maybe also be removed?
The docs make it sound like currently only the menu actions can fail in a way that makes the next "until" item fire. When I modify the command to produce a positive exit code, the current behaviour seems to be that it just stops or crashes in some way silently and nu gives me a new line, instead of going to the next action in the array.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#1025 (comment)",
"url": "#1025 (comment)",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
Awesome - I went ahead and created a PR before I forget - let me know if the fix works for you! |
Oh, and just for the next person being confused, the original issue description is probably meant to say At least that is how I could reproduce the behaviour in menus. |
I copied the snippet from your comment and that seems to be working!
Jordan Davidson
…On Sunday, February 25th, 2024 at 12:16 PM, Remmy Cat Stock ***@***.***> wrote:
Oh, and just for the next person being confused, the original issue description is probably meant to say `Type "math" and press tab.` since the default tab-autocompletion opens as a menu with options.
At least that is how I could reproduce the behaviour in menus.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
This updates the docs in case atuinsh/atuin#1770 lands, which fixes the referenced issue atuinsh/atuin#1025 Since this hasn't happened yet I created this as a draft - feel free to un-draft it!
Even though this PR is merged the init file has commented code for the binding with a link to this PR. Is that expected?
|
@msminhas93 The text should indeed not be generated anymore, no. Make sure that you have version 18.1.0 installed (or a newer commit). Since the fix is part of what the init script outputs, you will not get the new version of the init file unless you manually recreate it after updating to the latest version. Note that this will overwrite manual changes you might have made to the init file. As per the script in the Readme, assuming you haven't changed the paths:
|
Thanks that was it! |
With the nushell integration the "Arrow up" key is used to browse the history with
atuin
.However, I don't always want that. For example when I'm in "picker mode" of nushell.
Example:
Type "math" and press . A menu with available math commands is shown that (normally) can be navigated with ⬆/⬇. However with the
atuin
integration, the ⬆ key closes the pick menu and shows the history withatuin
.The history should only show up when in normal prompt mode. Not when a menu is shown.
The text was updated successfully, but these errors were encountered: