Add nushell shell integration#492
Merged
Merged
Conversation
Recognize nushell (`nu`) as a supported shell alongside bash, zsh, and fish, for auto-injection, manual source, and remote TRAMP sessions. Unlike the other shells, nushell emits OSC 7/133/2 natively via its built-in $env.config.shell_integration, and derives OSC 7's host from gethostname(2) so it already matches (system-name). So etc/shell/ghostel.nu only adds the ghostel-specific pieces: the ghostel_cmd OSC 52 elisp bridge and the outbound ssh terminfo-install wrapper. Injection mirrors fish: nushell vendor-autoloads from XDG_DATA_DIRS, so `nu` reuses fish's bootstrap dir and cleanup env var. The autoload shim locates ghostel.nu via `path self` because nushell's `source` needs a parse-time-constant path. Remote TRAMP uses --execute "source ..." (the analogue of fish's -C) and nushell starts login+interactive. Tests cover shell detection, default remote args, the auto-inject chain, and ghostel_cmd's OSC 52 output.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds nushell (
nu) as a first-class supported shell alongside bash, zsh, andfish — for auto-injection, manual
source, and remote TRAMP sessions.Design
Unlike the other shells, nushell emits OSC 7 (cwd), OSC 133 (prompt marks),
and OSC 2 (title) natively via its built-in
$env.config.shell_integration(on by default), and derives OSC 7's host from
gethostname(2)— so it alreadymatches Emacs
(system-name)the way the bash/zsh capture-once logic does,without the
$HOSTNAME-pollution workarounds. Soetc/shell/ghostel.nuonlyadds the ghostel-specific pieces:
ghostel_cmd— the OSC 52;ebridge for calling Elisp from the shell.sshterminfo-install wrapper (nushell port of the bash/fishinstall-and-cache logic, runtime-gated on
GHOSTEL_SSH_INSTALL_TERMINFO).Injection mirrors fish: nushell vendor-autoloads from
XDG_DATA_DIRS(
<dir>/nushell/vendor/autoload/), so'nureuses fish's bootstrap dir andGHOSTEL_SHELL_INTEGRATION_XDG_DIRcleanup. The autoload shim locatesghostel.nuviapath selfbecause nushell'ssourceneeds aparse-time-constant path. Remote/TRAMP uses
--execute "source …"(theanalogue of fish's
-C), and nushell starts login+interactive (-l -i).Changes
etc/shell/ghostel.nuandetc/shell/bootstrap/nushell/vendor/autoload/integration.nu.lisp/ghostel.el: shell detection (nu/nushell→'nu), local injection(folded into the fish XDG branch), remote TRAMP branch, default remote args,
and the
ghostel-shell-integration/ghostel-tramp-shell-integrationcustomizations.
nu --execute, asserting the autoload →path self→ source chain and XDGcleanup), and
ghostel_cmd's OSC 52 output.Caveat
Directory tracking and prompt navigation rely on nushell's native
shell_integration.osc7/.osc133(enabled by default); disabling them in yournushell config disables those features inside ghostel. Documented in the README.
Testing
make -j8 allgreen (build + lint + all tests, 0 unexpected).integration loaded (
ghostel_cmd/sshdefined),cd /tmpupdatesdefault-directory, andXDG_DATA_DIRSis cleaned with no env leak.