Screen-aware autocomplete for your terminal
Complete text from anywhere visible in your tmux pane with a fuzzy finder popup.
This project was created from scratch through conversation with Claude using OpenCode - no code was written manually.
Complete pod names, paths, and identifiers from kubectl output:
Quickly grab IP addresses from dig output:
When a command fails, press Ctrl+n then Ctrl+x to edit it in nvim:
Edit commands with full vim motions - comment shows why you're editing:
Press Tab to switch to clipboard history mode:
Ever had a long path, URL, or identifier on screen and wished you could just autocomplete it without copy-pasting? tmux-ghostcomplete does exactly that.
Press Ctrl+n and a popup appears with all the text tokens visible in your current tmux pane. Start typing to filter, press Enter to insert the selection into your command line.
- Screen-aware - Extracts all visible text from your tmux pane
- Exact matching - Uses fzf with exact substring matching (no fuzzy)
- Smart completion - Intelligently handles delimiters to avoid duplication
- Styled floating popup - Subtle rounded borders with Kanagawa-themed colors
- Toggle to close - Press
Ctrl+nagain to dismiss (or Escape) - Clipboard history - Press Tab to access clipboard history (via cliphist)
- Command line editor - Press Ctrl+x to edit your command in nvim
- Edit failed commands - Automatically loads last failed command for quick fixes
- History search - Press
Ctrl+fto search through full scrollback history - Fast - Optimized with
shand singleawkfor minimal latency - Live highlighting - Matches are highlighted in your terminal as you scroll
As you scroll through completions, matching text is highlighted in your terminal pane so you can see exactly where each token came from.
- Green highlight (bright green
#00FF00, underlined) - Current match (bottom-most occurrence) - Yellow highlight (carpYellow
#E6C384on sumiInk0) - Other matches on screen
The highlighting:
- Only shows matches within the visible area (no scrollback)
- Prioritizes the bottom-most match (most recent)
- Automatically cleans up when you select or cancel
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ $ kubectl get pods โ
โ NAME READY STATUS โ
โ api-server 1/1 Running โ โ gray highlight
โ api-worker 1/1 Running โ โ purple highlight (current)
โ โ
โ โญโ ๐ป GhostComplete โโโโโโโโโโโฎ โ
โ โ โธ api-worker โ โ โ focused item
โ โ api-server โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- tmux (with
display-popupsupport, v3.2+) - fzf
- zsh
- cliphist (optional, for clipboard history)
- wl-copy (optional, for Wayland clipboard)
- nvim (optional, for command line editing)
-
Clone the repository:
git clone https://github.com/bechampion/tmux-ghostcomplete.git ~/.zsh/plugins/tmux-ghostcomplete -
Copy the tokenizer script:
cp ~/.zsh/plugins/tmux-ghostcomplete/bin/tmux-ghostcomplete ~/.local/bin/ chmod +x ~/.local/bin/tmux-ghostcomplete
-
Add to your
~/.zshrc:source ~/.zsh/plugins/tmux-ghostcomplete/tmux-ghostcomplete.plugin.zsh
-
Reload your shell:
source ~/.zshrc
git clone https://github.com/bechampion/tmux-ghostcomplete.git /tmp/tmux-ghostcomplete
cd /tmp/tmux-ghostcomplete && ./install.shzinit
zinit light bechampion/tmux-ghostcompletezplug
zplug "bechampion/tmux-ghostcomplete"antigen
antigen bundle bechampion/tmux-ghostcomplete| Key | Action |
|---|---|
Ctrl+n |
Open GhostComplete popup (press again to close) |
Ctrl+f |
Open history search (search full scrollback) |
Tab |
Toggle between tokens and clipboard history |
Ctrl+x |
Open nvim to edit command line |
Enter |
Select and insert (or search in Ctrl+f mode) |
Escape |
Close popup |
- Open a tmux session
- Have some text visible on screen (commands, output, logs, etc.)
- Press
Ctrl+n - Type to filter the tokens (exact matching)
- Press
Enterto insert the selection - Press
EscapeorCtrl+nto cancel
The selected text is also copied to your clipboard (Wayland).
Press Ctrl+f to open a simple search prompt that searches through your full tmux scrollback history.
โญโ ๐ History Search โโฎ
โ โฏ your search term โ
โฐโโโโโโโโโโโโโโโโโโโโโโฏ
- Type your search term
- Press
Enterto search - tmux enters copy-mode and highlights all matches - Press
Escape,Ctrl+f, orCtrl+cto cancel
| Key | Action |
|---|---|
Enter |
Search for the term in tmux scrollback |
โ / Ctrl+p |
Previous search from history |
โ / Ctrl+n |
Next search from history |
โ / โ |
Move cursor |
Ctrl+โ / Ctrl+โ |
Move by word |
Ctrl+a / Ctrl+e |
Beginning / end of line |
Ctrl+w |
Delete word backwards |
Backspace / Delete |
Delete character |
Escape / Ctrl+f / Ctrl+c |
Cancel |
- Searches full scrollback (not just visible area)
- Kanagawa-themed highlighting - green for current match, yellow for others
- No tokenization - search for any text, including spaces
- Quick toggle - press
Ctrl+fagain to close - Search history - navigate previous searches with
โ/โorCtrl+p/Ctrl+n - History stored in
~/.local/share/tmux-ghostcomplete/search_history
- Find that error message from earlier
- Search for a specific command you ran
- Locate a URL or path in your history
- Find text that scrolled off screen
The popup uses tmux's native styling for a clean, minimal look:
โญโ ๐ป GhostComplete โโโโโโโโโโโโโโโโโฎ
โ โฏ search query โ
โ โธ matching-token-1 โ
โ matching-token-2 โ
โ matching-token-3 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ [ Tab: clipboard | C-x: edit ] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Press Ctrl+x while in the GhostComplete popup to open your command in nvim for editing.
If you have text in your prompt, Ctrl+x opens it in nvim:
# You have this complex command:
$ kubectl get pods -n production | grep -E "api|web" | awk '{print $1}'
# Press Ctrl+n, then Ctrl+x
# nvim opens with the command
# Edit it with full vim motions
# :wq to save and return to shell
If your prompt is empty and the last command failed ($? != 0), Ctrl+x automatically loads that failed command:
# You run a command with a typo:
$ kubetcl get pods
zsh: command not found: kubetcl
# Prompt is now empty
# Press Ctrl+n - notice the title shows "Edit last cmd"
# Press Ctrl+x
# nvim opens with "kubetcl get pods"
# Fix the typo and :wq
# The corrected command is ready to run!
The popup shows visual indicators when this mode is active:
- Title:
๐ป GhostComplete ~ Edit last cmd - Label:
[ Tab: clipboard | C-x: edit last cmd ]
The editor opens with a minimal configuration for speed:
- No swap files
- No backup files
- No undo files
- No status line
- Fix failed commands - Quickly edit and re-run commands that errored
- Complex pipelines - Edit long commands with multiple pipes
- Fix typos - Use vim motions to quickly fix errors
- Restructure commands - Rearrange arguments and flags
Press Tab to toggle between screen tokens and clipboard history.
Tokens mode (default) - Shows text from your visible tmux pane:
โญโ ๐ป GhostComplete โโโโโโโโโโโโโโโโโฎ
โ โฏ search query โ
โ โธ token-from-screen โ
โ [ Tab: clipboard | C-x: edit ] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Clipboard mode - Shows your clipboard history:
โญโ ๐ป GhostComplete โโโโโโโโโโโโโโโโโฎ
โ ๐ search query โ
โ โธ previous-clipboard-entry โ
โ [ Tab: tokens | C-x: edit ] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Clipboard history requires cliphist. Add this to your Sway/Hyprland config:
Sway:
exec wl-paste --type text --watch cliphist store
exec wl-paste --type image --watch cliphist storeHyprland:
exec-once = wl-paste --type text --watch cliphist store
exec-once = wl-paste --type image --watch cliphist storeThe plugin intelligently handles text insertion based on delimiters to avoid duplication.
The following characters are recognized as delimiters:
/ : , @ ( ) [ ] = " '
When you press Ctrl+n, the plugin looks at what you've typed and:
- Extracts the query - Uses only the text after the last delimiter for filtering
- Avoids duplication - When inserting, strips any overlapping prefix
- Query changes - If you modify the query in the popup, the selection replaces your typed word
# You type:
curl http://192
# Popup filters to tokens containing "192"
# You select: 192.168.1.100
# Result (192 is stripped to avoid duplication):
curl http://192.168.1.100
# You type:
cat /var/log/sys
# Popup filters to tokens containing "sys"
# You select: syslog
# Result:
cat /var/log/syslog
The tokenizer preserves certain patterns intact instead of splitting them:
| Pattern | Example |
|---|---|
http://, https:// |
https://github.com/user/repo |
git@ |
git@github.com:user/repo.git |
ftp://, file:// |
ftp://files.example.com/path |
containerd:// |
containerd://k8s.io/container |
s3:// |
s3://bucket/path |
| IPv6 addresses | 2001:0db8:85a3::8a2e:0370:7334 |
Change the trigger key in the plugin file:
# Default: Ctrl+n for completion, Ctrl+f for history search
bindkey '^n' _gc_complete
bindkey '^f' _gc_history_search
# Example: Ctrl+Space for completion
bindkey '^ ' _gc_completeModify in tmux-ghostcomplete.plugin.zsh:
tmux display-popup -E -w 35% -h 30% \
-b rounded \
-S 'fg=#54546D' \
-s 'bg=#1F1F28' \
-T ' ๐ป GhostComplete 'The popup uses Kanagawa colors:
| Element | Color | Description |
|---|---|---|
bg |
#1F1F28 |
Background (sumiInk1) |
fg |
#DCD7BA |
Text (fujiWhite) |
bg+ |
#2A2A37 |
Selected background (sumiInk4) |
hl |
#E6C384 |
Match highlight (carpYellow) |
prompt |
#957FB8 |
Prompt (oniViolet) |
- Make sure you're inside a tmux session
- Check tmux version:
tmux -V(needs 3.2+)
- There might not be any text longer than 3 characters on screen
- Try reducing the minimum token length in the tokenizer
Add this to your ~/.zshrc:
bindkey '^[' redisplay- fzf - The fuzzy finder powering this plugin
- cliphist - Clipboard history manager
- tmux - Terminal multiplexer
- kanagawa.nvim - The colorscheme inspiration
MIT License - See LICENSE for details.
Note: This project was created entirely through conversation with Claude (Anthropic's AI assistant) using OpenCode. The author prompted and directed the development but did not write the code directly.





