icb — Internal/Isolated Clipboard
English / 日本語
English
A standalone clipboard history tool for terminal environments.
Works entirely within your shell — no OS clipboard, no GUI, no dependencies.
Designed for use over SSH.
Concept
When you SSH into a remote server, the system clipboard doesn't follow you.
icb gives you a persistent clipboard history that lives inside the terminal session itself.
echo "some text" | icb # store
icb # pick from history → stdout
Install
go install github.com/yyYank/icb@latest
Or download a binary from the releases page.
Shell Integration
Add one line to your ~/.zshrc or ~/.bashrc to enable the Ctrl+X I keybinding.
zsh
echo 'eval "$(icb init)"' >> ~/.zshrc
bash
echo 'eval "$(icb init)"' >> ~/.bashrc
Then reload your shell:
source ~/.zshrc # or ~/.bashrc
Now you can press Ctrl+X I at any point while typing a command to open the TUI and insert the selected entry at the cursor:
$ make OUT=<Ctrl+X I> → TUI opens → select entry → make OUT=some text
Usage
Store — pipe anything into icb to save it to history.
echo "hello world" | icb
cat main.go | icb
curl https://example.com/script.sh | icb
Pick & Paste — run icb without arguments to open the TUI.
icb # browse and select
icb | bash # select and execute
icb > out.txt # select and save to file
TUI
> search query...
──────────────────────────────────────
echo hello world
cat main.go | icb
▶ ssh -i ~/.ssh/key user@host
SELECT * FROM users WHERE id = 1
──────────────────────────────────────
4/100 d:delete s:snippet p:preview y:copy Enter:select Ctrl+C:cancel
| Key |
Action |
↑ / ↓ |
Move cursor |
| Type anything |
Incremental search |
y |
Copy selected entry to clipboard |
Enter |
Select → stdout |
Ctrl+C / Esc |
Cancel |
Ctrl+X I |
Insert at cursor (requires shell integration) |
tmux Integration
You can open icb from any pane with Alt+i and paste the selected entry back to the original pane automatically.
Add the following to your ~/.tmux.conf:
bind -n M-i run-shell 'PANE=#{pane_id}; NW=$(tmux new-window -c "#{pane_current_path}" -P -F "##{pane_id}"); tmux send-keys -t "$NW" "icb | tmux loadb - && tmux paste-buffer -t $PANE; exit" Enter'
How it works:
- Press
Alt+i in any pane
- A new window opens with the icb TUI
- Select an entry and press
Enter
- The selected text is pasted into the original pane
- The window closes automatically
How it works
icb detects whether stdin is a pipe or a TTY at runtime.
- Pipe → reads stdin and appends to history
- TTY → opens the TUI to browse and select
History is stored in ~/.icb_history as JSON Lines. Up to 1000 entries are kept; older entries are pruned automatically.
Built with
License
Apache License 2.0
日本語
ターミナル環境で完結するクリップボード履歴ツール。
OSのクリップボード、GUI、外部依存なし。SSH接続先でもそのまま使える。
コンセプト
SSHでリモートサーバーに入ると、手元のクリップボードは使えない。
icb はシェル環境の中だけで動く、独立したクリップボード履歴を提供する。
echo "some text" | icb # 蓄積
icb # 履歴から選択 → 標準出力
インストール
go install github.com/yyYank/icb@latest
またはリリースページからバイナリをダウンロード。
シェルインテグレーション
~/.zshrc または ~/.bashrc に1行追加するだけで Ctrl+X I キーバインドが使えるようになる。
zsh
echo 'eval "$(icb init)"' >> ~/.zshrc
bash
echo 'eval "$(icb init)"' >> ~/.bashrc
シェルを再読み込みする:
source ~/.zshrc # または ~/.bashrc
コマンド入力中に Ctrl+X I を押すとTUIが開き、選んだ内容がカーソル位置に挿入される:
$ make OUT=<Ctrl+X I> → TUI起動 → 選択 → make OUT=some text
使い方
蓄積する — パイプで渡すだけで履歴に保存される。
echo "hello world" | icb
cat main.go | icb
curl https://example.com/script.sh | icb
選択して使う — 引数なしで起動するとTUIが開く。
icb # 履歴から選択
icb | bash # 選択してそのまま実行
icb > out.txt # 選択してファイルに保存
TUI
> 検索ワード...
──────────────────────────────────────
echo hello world
cat main.go | icb
▶ ssh -i ~/.ssh/key user@host
SELECT * FROM users WHERE id = 1
──────────────────────────────────────
4/100 d:delete s:snippet p:preview y:copy Enter:select Ctrl+C:cancel
| キー |
動作 |
↑ / ↓ |
カーソル移動 |
| 文字入力 |
インクリメンタルサーチ |
y |
選択中のエントリをクリップボードへコピー |
Enter |
選択 → 標準出力 |
Ctrl+C / Esc |
キャンセル |
Ctrl+X I |
カーソル位置に挿入(シェルインテグレーション必要) |
tmuxインテグレーション
Alt+i を押すだけで任意のペインからicbを開き、選択した内容を元のペインに自動で貼り付けられる。
~/.tmux.conf に以下を追加する:
bind -n M-i run-shell 'PANE=#{pane_id}; NW=$(tmux new-window -c "#{pane_current_path}" -P -F "##{pane_id}"); tmux send-keys -t "$NW" "icb | tmux loadb - && tmux paste-buffer -t $PANE; exit" Enter'
動作の流れ:
- 任意のペインで
Alt+i を押す
- 新しいウィンドウが開いてicbのTUIが起動する
- エントリを選択して
Enter を押す
- 選択したテキストが元のペインに貼り付けられる
- ウィンドウが自動で閉じる
仕組み
起動時に標準入力がパイプかTTYかを自動判定する。
- パイプあり → 標準入力を読み取って履歴に追記
- パイプなし → TUIを起動して履歴を閲覧・選択
履歴は ~/.icb_history にJSON Lines形式で保存される。上限は1000件で、超えた分は古いものから自動削除。
使用ライブラリ
ライセンス
Apache License 2.0