-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
shell: nushell integration scripts #4630
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
base: master
Are you sure you want to change the base?
Changes from 78 commits
5aa22d4
79eab96
64d5ace
6011574
785bc07
30d1d45
a4ef417
5236752
4b8fef0
3bd895c
15314f4
b2b25b2
e4ceecb
3e0d3a8
da97e61
20bb07c
c39e328
bde90bc
456cf2a
6289a28
77d0b56
d1a6120
1f66d6e
7ec4d98
95f636f
e9ac742
8c2183d
90d2331
ef66bd7
535ff16
581e2b3
5bee4c5
b3d751e
5ff54eb
40094b7
fc23c6e
f4f73a2
8c6c0e2
b0608cb
c834dd1
10bc522
7ab8d25
032bde7
5742835
55de1bf
4f10ad7
e3fa04b
2c9234c
a8aaf42
77f28e4
f624009
54aa577
bf9eb9e
c596a06
557e5e7
97529ab
03a14e1
828b782
a55fc6f
4012253
12aa334
0ad7787
969327b
1174f3d
58cce52
ed241f1
cea66b2
28d154b
3868e40
1761e10
f23d70f
df702d0
b2650de
5836bc6
3bf3bfc
5f68a8b
10787b8
2efe7b8
196a148
37c86f0
732c1e8
8d405a7
8963f38
17b194e
f3f904c
0ec52ca
452d42e
95a0ff5
691dfa3
305a650
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| BUNDLE_PATH: "vendor/bundle" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ Highlights | |
| - **Portable** -- Distributed as a single binary for easy installation | ||
| - **Fast** -- Optimized to process millions of items instantly | ||
| - **Versatile** -- Fully customizable through an event-action binding mechanism | ||
| - **All-inclusive** -- Comes with integrations for Bash, Zsh, Fish, Vim, and Neovim | ||
| - **All-inclusive** -- Comes with integrations for Bash, Zsh, Fish, Nushell, Vim, and Neovim | ||
|
|
||
| Table of Contents | ||
| ----------------- | ||
|
|
@@ -210,9 +210,17 @@ Add the following line to your shell configuration file. | |
| # Set up fzf key bindings | ||
| fzf --fish | source | ||
| ``` | ||
| * Nushell — Nushell does not support piping into `source`, so the install | ||
| script generates a file in the autoload directory. If you didn't use the | ||
| install script, you can manually set it up: | ||
| ```nu | ||
| # Generate the integration script | ||
| # (run this in your regular shell, not in Nushell) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already fixed in 691dfa3 — the instructions now use pure Nushell syntax with |
||
| fzf --nushell > ($nu.default-config-dir | path join "autoload" "fzf.nu") | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > `--bash`, `--zsh`, and `--fish` options are only available in fzf 0.48.0 or | ||
| > `--bash`, `--zsh`, `--fish`, and `--nushell` options are only available in fzf 0.48.0 or | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 305a650 — I removed |
||
| > later. If you have an older version of fzf, or want finer control, you can | ||
| > source individual script files in the [/shell](/shell) directory. The | ||
| > location of the files may vary depending on the package manager you use. | ||
|
|
@@ -506,7 +514,7 @@ Key bindings for command-line | |
| ----------------------------- | ||
|
|
||
| By [setting up shell integration](#setting-up-shell-integration), you can use | ||
| the following key bindings in bash, zsh, and fish. | ||
| the following key bindings in bash, zsh, fish, and Nushell. | ||
|
|
||
| - `CTRL-T` - Paste the selected files and directories onto the command-line | ||
| - The list is generated using `--walker file,dir,follow,hidden` option | ||
|
|
@@ -574,7 +582,7 @@ More tips can be found on [the wiki page](https://github.com/junegunn/fzf/wiki/C | |
| Fuzzy completion | ||
| ---------------- | ||
|
|
||
| Shell integration also provides fuzzy completion for bash, zsh, and fish. | ||
| Shell integration also provides fuzzy completion for bash, zsh, fish, and Nushell. | ||
|
|
||
| ### Files and directories | ||
|
|
||
|
|
@@ -635,6 +643,23 @@ unalias **<TAB> | |
| set <SHIFT-TAB> | ||
| ``` | ||
|
|
||
| ### Nushell notes | ||
|
|
||
| Fuzzy completion in Nushell works via the | ||
| [external completer](https://www.nushell.sh/cookbook/external_completers.html) | ||
| mechanism. There are some differences compared to bash and zsh: | ||
|
|
||
| - On Nushell >= 0.103.0, the external completer is no longer called for | ||
| built-in commands (e.g. `cd`, `ls`). Fuzzy completion with `**<TAB>` only | ||
| works for external commands. | ||
| - Custom completion extensibility (e.g. `_fzf_complete_COMMAND` in bash/zsh) | ||
| is not available. Custom completions are defined via a `match` statement | ||
| in `completion.nu`. | ||
| - The following environment variables are supported: | ||
| `FZF_COMPLETION_TRIGGER`, `FZF_COMPLETION_OPTS`, | ||
| `FZF_COMPLETION_PATH_OPTS`, `FZF_COMPLETION_DIR_OPTS`, | ||
| `FZF_COMPLETION_DIR_COMMANDS`. | ||
|
|
||
|
sim590 marked this conversation as resolved.
Outdated
|
||
| ### Customizing fuzzy completion for bash and zsh | ||
|
|
||
| #### Customizing fzf options for completion | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| require_relative 'test/lib/common' | ||
| tmux = Tmux.new(:nushell) | ||
| sleep 1 | ||
| # Simulate exactly what prepare() does, step by step | ||
| puts "=== Step 1: send ' ', C-u, Enter ===" | ||
| tmux.send_keys ' ', 'C-u', :Enter | ||
| sleep 1 | ||
| lines = tmux.capture | ||
| lines.each_with_index { |l, i| puts "#{i}: [#{l}]" } | ||
| puts "=== Step 2: send message, Left, Right ===" | ||
| tmux.send_keys 'Prepare[0]', :Left, :Right | ||
| sleep 1 | ||
| lines = tmux.capture | ||
| lines.each_with_index { |l, i| puts "#{i}: [#{l}]" } | ||
| puts "lines[-1] = [#{lines[-1]}]" | ||
| puts "match? #{lines[-1] == 'Prepare[0]'}" | ||
| puts "=== Step 3: C-u, C-l ===" | ||
| tmux.send_keys 'C-u', 'C-l' | ||
| sleep 1 | ||
| lines = tmux.capture | ||
| lines.each_with_index { |l, i| puts "#{i}: [#{l}]" } | ||
| puts "=== Step 4: second prepare cycle ===" | ||
| tmux.send_keys ' ', 'C-u', :Enter, 'Prepare[1]', :Left, :Right | ||
| sleep 1 | ||
| lines = tmux.capture | ||
| lines.each_with_index { |l, i| puts "#{i}: [#{l}]" } | ||
| puts "lines[-1] = [#{lines[-1]}]" | ||
| tmux.kill |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Care to explain what this means? What are the regular shells, anything but Nushell? Can they interpret this command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that was poorly worded. I've rewritten it to use pure Nushell syntax:
This can be run directly in Nushell — no need for another shell.