Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Zellij plugin for spawning floating command terminal pane.

License

NotificationsYou must be signed in to change notification settings

vdbulcke/ghost

Repository files navigation

AZellij plugin for spawning floating command terminal pane.Basically, it is an interactive version ofzrf (function zrf () { zellij run --name "$*" --floating -- zsh -ic "$*";}).

Demo

Sincev0.3.0, if you define a list of completions fromglobal_completion plugin configuration, it will load each lines as a list of commands that you can fuzzy search (usingfuzzy-matcher).

If the plugin finds a.ghost at the working dir of the plugin, it will add the working dir completions with the global_completions.

Completion

Requirements

Zellij versionv0.40.0 or later.

Zellijghost
v0.40.xv0.4.0
v0.41.1v0.5.0

Zellij Plugin Permission

PermissionWhy
ReadApplicationStateSubscribe to Pane and tab events
RunCommandsCreating Run Command floating pane
ChangeApplicationStateSetting plugin pane name

Host Filesystem Access

NOTE: zellijv0.39.0 changed the/host path on plugin from the current zellij session working dir to the previous pane working dir (seeRelease Notes for more info)

Zellij maps the folder where Zellij was started to/host path on the plugin.

The plugin will look for a/host/.ghost file (i.e. the current working of the previous focussed pane) to load a list of predefined commands (like a bash_history).

Example of a.ghost file:

cargo build## this is a comment starting with '#'# this is also a commentterraform apply## empty lines are also ignoredgotest -v ./...

Install

Upgrade

Breaking Change

v0.4.0
  • renamed configcwd withexec_cwd

Download WASM Binary

  • Downloadghost.wasm binary fromrelease page.
  • Verify binary signature with cosign (see instruction bellow)
  • copy binary to zellij plugin dir:
    • mv target/wasm32-wasip1/release/ghost.wasm ~/.config/zellij/plugins/

Validate Signature With Cosign

Make sure you havecosign installed locally (seeCosign Install).

Then you can use the./verify_signature.sh in this repo:

./verify_signature.sh PATH_TO_DOWNLOADED_ARCHIVE TAG_VERSION

for example

$ ./verify_signature.sh~/Downloads/ghost.wasm v0.4.0Checking Signaturefor version: v0.4.0Verified OK

Build from source

WARNING: requires to have rust installed and wasmrustup target add wasm32-wasip1

  • git clone git@github.com:vdbulcke/ghost.git
  • cd ghost
  • cargo build --release
  • mv target/wasm32-wasip1/release/ghost.wasm ~/.config/zellij/plugins/

Configuration

Required Configuration

Zsh Shell

Keyvalue
shellzsh
shell_flag-ic

fish Shell

Keyvalue
shellfish
shell_flag-c

Bash Shell

Keyvalue
shellbash
shell_flag-ic

Optional Configuration

Keyvaluedesctiption
cwd (deprecated useexec_cwd instead)directory pathset working dir for command
exec_cwd (zellij0.40.0) (deprecated inv0.6.0)directory pathset working dir for command
ghost_launcher (deprecated inv0.6.0)GhostLauncher pane nameplugin will automatically close that pane
embeddedtruecreated command panes are embedded instead of floating
debugtruedisplay debug info
global_completionmultine list of completionglobal list of completion to inlude to/host/.ghost file

NOTE: The "GhostLauncher" (ghost_launcher,exec_cwd) is no longer need. Now thecwd is derived from theget_plugin_ids().initial_cwd plugin api.

Launch Plugin

zellij plugin --floating --configuration"shell=zsh,shell_flag=-ic,cwd=$(pwd)" --"file:$HOME/.config/zellij/plugins/ghost.wasm"

Config Keybindings

shared_except"locked" {// ghost native plugin (with default zellij cwd)    bind"Alt (" {        LaunchOrFocusPlugin"file:~/.config/zellij/plugins/ghost.wasm" {            floatingtrue// Ghost config            shell"zsh"// required ("bash", "fish", "zsh")            shell_flag"-ic"// required ("-ic",  "-c",    "-ic")// optional config// ghost_launcher "GhostLauncher" // name of the Ghost launcher pane (default GhostLauncher)// debug false                    // display debug info, config, parse command etc// embedded false                 // spawned command pane will be embedded instead of floating pane// NOTE: using 'r#"' and '"#' rust like multi string delimeter            global_completionr#"                tf apply -auto-approve                cargo build                go test -v  ./...            "#        }    }}

Limitations

resizing

UI column size is not handled, so resizing to plugin window too small may crash the plugin.UI row size is partiallt handled, where it will minimize to a simple prompt if the plugin window becomes too small.

Note

This my first rust project, so the code might not be the most idiomatic rust.Inpiration was taken from otherzellij plugins.

About

A Zellij plugin for spawning floating command terminal pane.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp