atuin icon indicating copy to clipboard operation
atuin copied to clipboard

NuShell support

Open ellie opened this issue 2 years ago • 9 comments

We investigated doing this a while ago: https://github.com/ellie/atuin/pull/182

At the time, NuShell did not have the hooks we needed. But it sounds like now it does!

https://twitter.com/jntrnr/status/1622274570651865090?s=20

ellie avatar Feb 05 '23 16:02 ellie

Thank you for this very cool tool. How can we configure atuin for the nushell?

alloc33 avatar Feb 19 '23 09:02 alloc33

I don't think we can yet. We're still waiting on Nushell to implement https://github.com/nushell/nushell/issues/6264, @stevenxxiu is currently working on a precursor PR. But maybe @ellie got a different answer from talking with them.

I think it can also be done with a code change to Atuin to take the command in atuin history end instead of atuin history start, but I'm not sure if that would cause any problems. Might be worth implementing that for better compatibility with Nushell (or future shells).

If @ellie or @conradludgate think that making the change to Atuin is a good idea I may have time to work on it.

arcuru avatar Mar 06 '23 21:03 arcuru

Sounds ok to me

conradludgate avatar Mar 06 '23 21:03 conradludgate

I'd rather stick to having the command put in the start by default, though I'm open to filling it in as part of end. My concern there is just that if we have a start that never calls end, we end up with a bunch of empty history.

If there's no other way, then it would be acceptable! I'll jump on their Discord and see if we can push on it a little more

ellie avatar Mar 06 '23 21:03 ellie

Turns out @stevenxxiu has been working on that feature for NuShell! https://github.com/nushell/nushell/pull/8207

Thank you so much - can't wait to get that support out!

ellie avatar Mar 06 '23 21:03 ellie

Oh! I thought https://github.com/nushell/nushell/pull/8207 was just some early work, but it looks farther along. Awesome :)

Probably not worth it to implement my proposed hacky workaround unless something else needs it in the future.

arcuru avatar Mar 06 '23 21:03 arcuru

Let's wait - worst case we can fallback on your workaround!

ellie avatar Mar 06 '23 21:03 ellie

Cool tool -- found it yesterday when I was looking to replace fzf-in-zsh for command history. I recently started using nushell, so followed the instructions to integrate. I'm new to nushell as well, but apparently the syntax for ranges has changed/is changing? I'm running nushell 0.78.1, built from source, and when I select an item in atuin I get:

Error: nu::shell::cant_convert

  × Can't convert to range.
   ╭─[entry #1:1:1]
 1 │ # 9f6f3001-2271-4a1e-bd21-8707aeda4a23
 2 │ commandline (RUST_LOG=error run-external --redirect-stderr atuin search "--shell-up-key-binding" "--interactive" "--" (commandline) | complete | $in.stderr | str substring ',-1')
   ·                                                                                                                                                                             ──┬──
   ·                                                                                                                                                                               ╰── can't convert string to range
   ╰────

If I change that part in line 33 of the generated init.nu to str substring ..-1 then it works.

Great tool -- thanks for your work!

hoop33 avatar Apr 13 '23 18:04 hoop33

Cool tool -- found it yesterday when I was looking to replace fzf-in-zsh for command history. I recently started using nushell, so followed the instructions to integrate. I'm new to nushell as well, but apparently the syntax for ranges has changed/is changing? I'm running nushell 0.78.1, built from source, and when I select an item in atuin I get:


Error: nu::shell::cant_convert



  × Can't convert to range.

   ╭─[entry #1:1:1]

 1 │ # 9f6f3001-2271-4a1e-bd21-8707aeda4a23

 2 │ commandline (RUST_LOG=error run-external --redirect-stderr atuin search "--shell-up-key-binding" "--interactive" "--" (commandline) | complete | $in.stderr | str substring ',-1')

   ·                                                                                                                                                                             ──┬──

   ·                                                                                                                                                                               ╰── can't convert string to range

   ╰────

If I change that part in line 33 of the generated init.nu to str substring ..-1 then it works.

Great tool -- thanks for your work!

This should already be fixed in #840

YummyOreo avatar Apr 13 '23 18:04 YummyOreo