Skip to content

Conversation

@sim590
Copy link

@sim590 sim590 commented Dec 9, 2025

  • Keybindings alt_c, ctrl_r and ctrl_t
  • Completion functions:
    • base implementation for ** completion
    • extra completion functionalities for programs such as:
      • pass
      • ssh, scp, sftp, telnet
      • kill
      • cd, pushd, rmdir

Closes: #4122

imsys and others added 30 commits May 4, 2025 04:58
Fixes some path issues. There are still some other things to fix
Pass~[1] is a command line password storage utility. Possible queries
are deduced from the file GPG hierarchy under ~/.password-store.

[1]: https://www.passwordstore.org/
Not sure why it doesn't work in this context, but if those are not
removed, the completion process doesn't substitute the selected value
to '**'.
…typo

fix typo  shell/key-bindinds.nu → shell/key-bindings.nu
imsys and others added 14 commits December 7, 2025 23:01
…alls

shell/completion-external.nu: remove bad "return" calls
…y-closure

shell/completion-external.nu: use command flag for optional closure
shell/completion-external.nu: add pass completion
…gnment

shell/completion-external.nu: just some alignment
* remove preview, which is not useful for command history
* maximum height 40%
* separate all commandlines by \0 char and use --read0 with fzf
I'm not even sure how to use those and they miserably fail.
@sim590
Copy link
Author

sim590 commented Dec 9, 2025

@imsys: just letting you know that I disabled some of the completion cases (in 5742835) as they don't work for me and produce bad output:

image

So, I decided it was best to just comment them out. I left the implementations untouched if anybody wants to fix them at some point. I frankly was not sure how to use those either, so I didn't bother fixing them.

@sim590
Copy link
Author

sim590 commented Dec 9, 2025

I'm going to put this in draft because I just realized something else is broken.

@sim590 sim590 marked this pull request as draft December 9, 2025 06:09
@sim590
Copy link
Author

sim590 commented Dec 9, 2025

I just fixed a major bug in 55de1bf. Then, 4f10ad7 fixes a minor thing. And finally, I added support for completing Archlinux pacman packages.

I think this is ready. I could indeed add more programs for which to provide completion, but I'm going to stop there.

@sim590 sim590 marked this pull request as ready for review December 9, 2025 06:52
@jochumdev
Copy link

You guys might be interested into that:

https://git.sr.ht/~jochumdev/gists/tree/main/item/nu/show/README.md

export-env {
$env.FZF_TMUX_OPTS = $env.FZF_TMUX_OPTS? | default "--height 40%"
$env.FZF_CTRL_T_COMMAND = $env.FZF_CTRL_T_COMMAND? | default "fd --type file --hidden"
$env.FZF_CTRL_T_OPTS = $env.FZF_CTRL_T_OPTS? | default "--preview 'bat --color=always --style=full --line-range=:500 {}' "
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jochumdev are you suggesting to integrate this as the preview program for the FZF view? Like, for the CTRL-T binding, here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, now that I'm thinking about it, I don't know why we'd use bat or any other external program as default since there's a builtin command in nushell that does a good job just like bat: the command open... I think I'm going to change bat to open here.

As for the script you linked, I'm not sure about using it as a default for the same reason as bat. I think that best is built-in first for compatibility sake.

Please, tell me if I'm missing the point of the suggestion.

Copy link
Author

@sim590 sim590 Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is true though that open doesn't actually give the same output. I thought for a second that it did something similar, but it doesn't (excuse my noobness).

I'm not sure anymore I want open as a default. I like the argument of "built-in is best", but at the same time, this is an opt-in script... And bat does a way better job.

So, may be we could consider your script after all!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, based on your comment here, I guess that you're suggesting to merge show.nu as fzf-preview.nu may be under bin/ directory? Anyway, I'll stop trying to figure out, and just wait on your answer. 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey :)

First: I integrated your work into my nushell, you did a wonderful job.
Second: I refactored my "show" script. For now I think the best is to link it somewhere as an alternative to the bat usage, I don't know how you wanna let people install your "nu" integration, yet.

Third:

I did some work based on yours, I added support for "sudo" , having no trigger at all and preview of pacman packages, are you interested in a follow up PR on your repo?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some work based on yours, I added support for "sudo" , having no trigger at all and preview of pacman packages, are you interested in a follow up PR on your repo?

That's awesome. I also noticed today that it didn't work correctly with sudo. Please, make a PR and I'll pull your commits on this one!

New findings :)

Use open with https://git.sr.ht/~jochumdev/gists/blob/main/nu/show/hook.nu

The link is broken. 😕

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome. I also noticed today that it didn't work correctly with sudo. Please, make a PR and I'll pull your commits on this one!

Coming.

The link is broken. 😕

Removed hook.nu it messes with open --raw ,if you still want it:

https://git.sr.ht/~jochumdev/gists/tree/71d7cdad2d137b36637e54069879ca6eac2c06a2/item/nu/show/hook.nu

Please also revisit show it got major new features:

@junegunn
Copy link
Owner

junegunn commented Dec 14, 2025

Hi, this is interesting. I don't use nushell and have no experience with it, so it will take me some time to get started on reviewing this.

Also, to incorporate this to the project, we need to address a few more things:

  • Documentation
  • Alignment with other implementations (bash, zsh, and fish) in terms of functionality and customizability
  • Tests
  • Updates to the install and uninstall scripts

There is ongoing work to add fish fuzzy completion in #4605. You might want to take a look at the discussion there.

@jochumdev
Copy link

Hey @junegunn

Many, many thanks for fzf, I use it a lot!

For nushell there's a plugin https://github.com/idanarye/nu_plugin_skim which adds deep integration into the shell (structured data in -> structured data out).

I'll switch to that for my use with nushell.

Thank you again!

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

Successfully merging this pull request may close these issues.

[Feature Request] nushell integration

5 participants