-
-
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
Open
sim590
wants to merge
129
commits into
junegunn:master
Choose a base branch
from
sim590:nushell-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
129 commits
Select commit
Hold shift + click to select a range
5aa22d4
A Nushell partial support test
imsys 79eab96
Some efforts to get it working
imsys 64d5ace
Almost working
imsys 6011574
somewhat working
imsys 785bc07
seems to be working
imsys 30d1d45
lower case tab
imsys a4ef417
different implementation approach: External Completers
imsys 5236752
fixes fzf custom height
imsys 4b8fef0
Nushell - fzf uses realative path
imsys 3bd895c
nushell - layout reverse
imsys 15314f4
nushell: fixes ssh completion
imsys b2b25b2
Nushell: refactoring
imsys e4ceecb
Nushell: makes the code of both options similar.
imsys 3e0d3a8
removing debug print
imsys da97e61
Nushell: seems to be the final fix for path issues
imsys 20bb07c
cleanup and kill completion
imsys c39e328
Nushell: prepend binding instead of appending
imsys bde90bc
Nushell: Another alternative implementation, but using nushell menu
imsys 456cf2a
Nushell: notes
imsys 6289a28
renames completion.nu to completion-bind.nu
imsys 77d0b56
Nushell: notes
imsys d1a6120
Nushell: minor grammar/spelling
imsys 1f66d6e
fix typo
zalewskigrzegorz 7ec4d98
completion-external: add pass completion
sim590 95f636f
completion-external: use type "any" for optional closure
sim590 e9ac742
completion-external: use flag for _fzf_complete_nu's post_process_clo…
sim590 8c2183d
completion-external: remove bad "return" calls
sim590 90d2331
completion-external: remove unused input_line_before_trigger parameter
sim590 ef66bd7
completion-external: fix alignement
sim590 535ff16
Merge pull request #1 from zalewskigrzegorz/fix/nushel-scipt-typo
imsys 581e2b3
Merge pull request #4 from sim590/nushell-remove-bad-return-calls
imsys 5bee4c5
Merge pull request #3 from sim590/nushell-completion-fix-empty-closure
imsys b3d751e
compatibility with the other pull request.
imsys 5ff54eb
Merge pull request #2 from sim590/nushell-completion-pass
imsys 40094b7
shell/completion-external.nu: just some alignment
sim590 fc23c6e
Merge pull request #5 from sim590/nushell-completion-some-alignment
imsys f4f73a2
shell: keeping keybindings and external impl
sim590 8c6c0e2
shell/key-bindings.nu: enhance ctrlr
sim590 b0608cb
shell/key-bindings.nu: make CTRL_R opts overridable by FZF_CTRL_R_OPTS
sim590 c834dd1
shell/key-bindings.nu: rm mention of unused rg, nufmt commands
sim590 10bc522
shell/key-bindings.nu: uniformisation of command variable names
sim590 7ab8d25
shell/key-bindings.nu: separating necessary options from others
sim590 032bde7
shell/key-bindings.nu: keep full screen
sim590 5742835
shell/completion.nu: disable export, printenv, unset, unalias
sim590 55de1bf
shell/completion.nu: fix _fzf_complete_nu when `-m` is passed
sim590 4f10ad7
shell/completion.nu: disable `-m` for pass completion
sim590 e3fa04b
shell/completion-external.nu: pacman completion
sim590 2c9234c
shell/key-bindings.nu: make env variables overridable
sim590 a8aaf42
refactor(nushell): use fzf built-in walker instead of fd
sim590 77f28e4
feat(nushell): add missing CTRL-R options for parity with bash/zsh
sim590 f624009
feat(nushell): merge FZF_DEFAULT_OPTS and FZF_DEFAULT_OPTS_FILE
sim590 54aa577
feat(nushell): add fzf-tmux support in key bindings
sim590 bf9eb9e
fix(nushell): handle inherited env var type for __keybindings_loaded
sim590 c596a06
feat(nushell): allow disabling key bindings via empty variable
sim590 557e5e7
refactor(nushell): document completion extensibility pattern
sim590 97529ab
perf(nushell): replace slow help commands with which
sim590 03a14e1
fix(nushell): prevent ps from blocking in kill completion
sim590 828b782
fix(nushell): replace commandline content on CTRL-R selection
sim590 a55fc6f
refactor(nushell): remove unused closure in pacman completion
sim590 4012253
fix(nushell): use split row instead of split words for fzf options
sim590 12aa334
fix(nushell): use closure syntax in where filter for empty strings
sim590 0ad7787
fix(nushell): use split row instead of split column for ssh host parsing
sim590 969327b
fix(nushell): correct filename in header comment
sim590 1174f3d
refactor(nushell): remove unused variable and stale comment
sim590 58cce52
refactor(nushell): remove dead code in path completion
sim590 ed241f1
refactor(nushell): use FZF_COMPLETION_DIR_COMMANDS in dispatch
sim590 cea66b2
perf(nushell): use pacman -Slq/-Qq for faster package listing
sim590 28d154b
refactor(nushell): remove redundant FZF_TMUX env assignments
sim590 3868e40
feat(nushell): add --nushell flag to emit shell integration scripts
sim590 1761e10
feat(nushell): add nushell support to install/uninstall scripts
sim590 f23d70f
docs: add Nushell to README
sim590 df702d0
test(nushell): add shell integration test scaffolding
sim590 b2650de
fix(nushell): use sh -c instead of nu -c for CTRL-T and ALT-C
sim590 5836bc6
test(nushell): fix initialization, prepare, and add keybinding tests
sim590 3bf3bfc
fix(test): clear nushell history between tests
sim590 5f68a8b
refactor(nushell): remove unused export/unset/unalias completion
sim590 10787b8
feat(nushell): add sudo support, paru, and pacman preview
sim590 2efe7b8
Merge origin/master into nushell-integration
sim590 196a148
todo.txt: removed
sim590 37c86f0
docs: move Nushell completion to dedicated section and remove debug file
sim590 732c1e8
chore: remove .bundle/config from tracking
sim590 8d405a7
fix(nushell): remove unused var, fix typos, and guard empty cd result
sim590 8963f38
test(nushell): add file completion smoke test
sim590 17b194e
fix: restore missing src assignment in install and fix let syntax
sim590 f3f904c
fix(ci): add Slq to typos exceptions
sim590 0ec52ca
ci: install nushell via apt in GitHub Actions
sim590 452d42e
fix(test): rubocop fixes and safe teardown for nushell tests
sim590 95a0ff5
Merge branch 'master' into nushell-integration
sim590 691dfa3
docs: rewrite nushell setup to use native syntax
sim590 305a650
docs: remove --nushell from version note
sim590 adbd8e7
docs: simplify version note and create autoload dir
sim590 a56922c
docs: add nushell example for disabling keybindings
sim590 8057be9
fix(nushell): handle missing password store in pass completion
sim590 e127c4e
fix(nushell): join multi-selected paths into single completion result
sim590 95416c8
fix(nushell): clear FZF_DEFAULT_OPTS when calling fzf in completer
sim590 0025d22
fix(completion): align __fzf_defaults_nu with bash for --tmux support
sim590 ddf7025
fix(readme): use -- instead of em dash for Nushell bullet
sim590 1901af7
refactor(test): remove redundant test_ctrl_t and test_alt_c_command
sim590 3c1bfb6
refactor(test): remove redundant test_ctrl_r, document overrides
sim590 b4e1992
fix(completion): expand tilde in walker-root for path completion
sim590 6f1ed5a
fix(test): replace em-dash with ASCII double dash
sim590 4ec77b9
test(nushell): add multi-selection and hidden files to test_file_comp…
sim590 73e3ecb
fix(completion): use $nu.home-dir instead of $nu.home-path
sim590 85cd042
feat(completion): add $env.FZF_COMPLETERS for custom completers
sim590 450f0b5
fix(completion): remove leftover debug log
sim590 ba6dea5
style(completion): remove unnecessary empty line
sim590 4d81f66
refactor(completion): uncomment examples and remove combined section
sim590 673f979
feat(completion): expose post-processing hook in FZF_COMPLETERS
sim590 29d3018
docs(key-bindings): explain why reverse | uniq is safe
sim590 63c7e34
fix(key-bindings): check all fzf bindings to prevent duplicates
sim590 4837286
style(completion): remove trailing empty line after modeline
sim590 08a2ec1
refactor(key-bindings): replace duplicates guard with filter-and-append
sim590 76af275
refactor(completion): remove unused code and outdated comments
sim590 8b4d29c
Apply rewording of comment on $env.history from @junegunn
sim590 8632148
fix(completion): use open --raw for FZF_DEFAULT_OPTS_FILE
sim590 a96feb6
fix(completion): harmonize TMUX_PANE check with key-bindings.nu
sim590 76bcb97
refactor(completion): remove _nu suffix from function names
sim590 0b1d82e
fix(completion): prevent wrapper nesting on re-source
sim590 41af912
test: replace sleep with polling for nushell readiness
sim590 22c1fb1
fixup! test: replace sleep with polling for nushell readiness
sim590 6485735
refactor(completion): harmonize __fzf_defaults with key-bindings.nu
sim590 7bf47c7
fix(completion): allow re-sourcing to update the completer
sim590 9c4d392
style(completion): fix some code alignment
sim590 bae407b
Apply copilot suggestion for /etc/apt/keyrings
sim590 9bf1b8a
fix(install): respect --[no-]key-bindings and --[no-]completion for n…
sim590 a6fb102
fix(install): rename fzf.nu to _fzf_integration.nu, simplify partial cp
sim590 37d83c1
fix(uninstall): rename fzf.nu to _fzf_integration.nu
sim590 52a23e3
docs(man): add --nushell flag to man page
sim590 d25f3da
Merge branch 'master' into nushell-integration
junegunn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # ____ ____ | ||
| # / __/___ / __/ | ||
| # / /_/_ / / /_ | ||
| # / __/ / /_/ __/ | ||
| # /_/ /___/_/ completion-examples.nu | ||
| # | ||
| # Example custom completers for fzf's Nushell integration. | ||
| # | ||
| # To use these, add the desired entries to $env.FZF_COMPLETERS in your | ||
| # config.nu. Each closure receives two arguments: | ||
| # - prefix: the text before the trigger (e.g. "vim" in "vim **<TAB>") | ||
| # - spans: the full command as a list of words (e.g. ["pacman", "-S", "vim**"]) | ||
| # | ||
| # A closure can return either: | ||
| # - a list of candidate strings (fzf will use default options), or | ||
| # - a record with the following optional fields: | ||
| # candidates: list<string> # candidates to feed to fzf | ||
| # opts: list<string> # custom fzf options (default: ["-m"]) | ||
| # post: closure (|sel| ...) # post-processing of the selected item | ||
| # | ||
| # Simple example: | ||
| # $env.FZF_COMPLETERS = { | ||
| # git: {|prefix, spans| ["branch-main", "branch-dev", "branch-feature"]} | ||
| # } | ||
|
|
||
| # --- pacman / paru --- | ||
| # Completes package names for pacman and paru. | ||
| # Uses the spans to distinguish between subcommands: | ||
| # -S (sync), -F (files): list available packages from repos | ||
| # -Q (query), -R (remove): list installed packages | ||
| # Returns a record with custom fzf options for package preview. | ||
|
|
||
| $env.FZF_COMPLETERS = {} | ||
|
|
||
| $env.FZF_COMPLETERS.pacman = {|prefix, spans| | ||
| let sub = $spans | skip 1 | first | ||
| let candidates = (if ($sub =~ "-[SF]") { | ||
| ^pacman -Slq | lines | ||
| } else if ($sub =~ "-[QR]") { | ||
| ^pacman -Qq | lines | ||
| } else { | ||
| [] | ||
| }) | ||
| { | ||
| candidates: $candidates | ||
| opts: ["-m", "--preview", "pacman -Si {}", "--prompt", "Package > "] | ||
| } | ||
| } | ||
|
|
||
| $env.FZF_COMPLETERS.paru = {|prefix, spans| | ||
| let sub = $spans | skip 1 | first | ||
| let candidates = (if ($sub =~ "-[SF]") { | ||
| ^pacman -Slq | lines | ||
| } else if ($sub =~ "-[QR]") { | ||
| ^pacman -Qq | lines | ||
| } else { | ||
| [] | ||
| }) | ||
| { | ||
| candidates: $candidates | ||
| opts: ["-m", "--preview", "pacman -Si {}", "--prompt", "Package > "] | ||
| } | ||
| } | ||
|
|
||
| # --- pass (password-store) --- | ||
| # Completes entry names from ~/.password-store. | ||
| # Returns a simple list (no custom fzf options needed). | ||
|
|
||
| $env.FZF_COMPLETERS.pass = {|prefix, spans| | ||
| try { | ||
| ls ~/.password-store/**/*.gpg | ||
| | get name | ||
| | each {$in | str replace -r '^.*?\.password-store/(.*).gpg' '${1}'} | ||
| } catch { | ||
| [] | ||
| } | ||
| } | ||
|
|
||
| # --- Example with post-processing hook --- | ||
| # The "post" closure transforms the selected line after fzf returns. | ||
| # This is useful when the displayed line contains more information than | ||
| # what you want inserted on the command line (e.g. extracting a PID from | ||
| # a full "ps" output line). | ||
| # | ||
| # $env.FZF_COMPLETERS.mycommand = {|prefix, spans| | ||
| # { | ||
| # candidates: (^some-command | lines) | ||
| # opts: ["+m", "--header-lines=1"] | ||
| # post: {|selection| $selection | split row ' ' | get 0} | ||
| # } | ||
| # } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.