Skip to content

Add nushell shell integration#492

Merged
dakra merged 1 commit into
mainfrom
nushell-integration
Jul 1, 2026
Merged

Add nushell shell integration#492
dakra merged 1 commit into
mainfrom
nushell-integration

Conversation

@dakra

@dakra dakra commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

Adds nushell (nu) as a first-class supported shell alongside bash, zsh, and
fish — 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 already
matches Emacs (system-name) the way the bash/zsh capture-once logic does,
without the $HOSTNAME-pollution workarounds. So etc/shell/ghostel.nu only
adds the ghostel-specific pieces:

  • ghostel_cmd — the OSC 52 ;e bridge for calling Elisp from the shell.
  • The outbound ssh terminfo-install wrapper (nushell port of the bash/fish
    install-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 'nu reuses fish's bootstrap dir and
GHOSTEL_SHELL_INTEGRATION_XDG_DIR cleanup. 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 (-l -i).

Changes

  • New: etc/shell/ghostel.nu and
    etc/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-integration
    customizations.
  • Tests: shell detection, default remote args, the auto-inject chain (drives
    nu --execute, asserting the autoload → path self → source chain and XDG
    cleanup), and ghostel_cmd's OSC 52 output.
  • Docs: README (manual setup, local + remote) and CHANGELOG.

Caveat

Directory tracking and prompt navigation rely on nushell's native
shell_integration.osc7/.osc133 (enabled by default); disabling them in your
nushell config disables those features inside ghostel. Documented in the README.

Testing

  • make -j8 all green (build + lint + all tests, 0 unexpected).
  • Live-verified in a sandboxed Emacs: a real ghostel buffer running nushell —
    integration loaded (ghostel_cmd/ssh defined), cd /tmp updates
    default-directory, and XDG_DATA_DIRS is cleaned with no env leak.

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.
@dakra
dakra merged commit 0f0a9bd into main Jul 1, 2026
43 of 44 checks passed
@dakra
dakra deleted the nushell-integration branch July 1, 2026 05:43
@dakra
dakra temporarily deployed to github-pages July 1, 2026 05:43 — with GitHub Actions Inactive
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.

1 participant