tmux-fuzzy-motion 0.0.4 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.ja.md +57 -18
  2. package/README.md +62 -17
  3. package/dist/cli.js +1040 -455
  4. package/package.json +2 -1
package/README.ja.md CHANGED
@@ -2,20 +2,23 @@
2
2
 
3
3
  [English README](./README.md)
4
4
 
5
- `tmux-fuzzy-motion` は、`tmux copy-mode` 内で素早くカーソル移動するための
6
- CLI です。現在の viewport からジャンプ対象を抽出し、fuzzy search で絞り込み、
5
+ `tmux-fuzzy-motion` は、tmux pane 内で素早くカーソル移動するための CLI です。
6
+ 現在の viewport からジャンプ対象を抽出し、fuzzy search で絞り込み、
7
7
  大文字の hint で移動できます。英字のローマ字 query に対しては Migemo による
8
8
  日本語マッチも行います。
9
9
 
10
10
  ## 特徴
11
11
 
12
12
  - `tmux copy-mode` 内で動作
13
+ - `start` は copy mode の外から起動しても自動で copy mode に入る
14
+ - `start --scope all` は current window の visible pane 全体を対象にできる
13
15
  - 現在の viewport から URL、path、filename、symbol、一般的な単語を抽出
14
16
  - `fzf` による fuzzy match
15
17
  - `jsmigemo` による英字 query の Migemo マッチ
16
18
  - overlay 描画時も pane の色を維持
19
+ - 外部 daemon を再利用し、matcher と Migemo の起動コストを常駐側へ寄せる
17
20
  - 単一キーの大文字 hint で素早く選択
18
- - query は対象 pane 内に描画し、終了時に元の pane を復元
21
+ - UI tmux popup で表示し、常駐用の scratch window を作らない
19
22
 
20
23
  ## 動作要件
21
24
 
@@ -51,10 +54,36 @@ npx tmux-fuzzy-motion@latest doctor
51
54
  `tmux.conf` に次を追加してください。
52
55
 
53
56
  ```tmux
54
- bind-key -T copy-mode-vi s run-shell -b 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
55
- bind-key -T copy-mode s run-shell -b 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
57
+ bind-key -T copy-mode-vi s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
58
+ bind-key -T copy-mode s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
56
59
  ```
57
60
 
61
+ copy mode の外からも起動したい場合は、root table にも bind を追加します。
62
+
63
+ ```tmux
64
+ bind-key s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
65
+ ```
66
+
67
+ current window の visible pane 全体から選びたい場合は、`--scope all` を付けた bind を追加します。
68
+
69
+ ```tmux
70
+ bind-key S run-shell 'tmux-fuzzy-motion start --scope all #{pane_id} #{client_tty}'
71
+ ```
72
+
73
+ `start` サブコマンドを経由せずに tmux から直接 popup を開きたい場合は、次の設定も使えます。
74
+
75
+ ```tmux
76
+ bind-key -T copy-mode-vi s run-shell -C "display-popup -E -B -x '##{popup_pane_left}' -y '##{popup_pane_top}' -w '#{pane_width}' -h '#{pane_height}' 'tmux-fuzzy-motion popup-live #{pane_id}'"
77
+ bind-key -T copy-mode s run-shell -C "display-popup -E -B -x '##{popup_pane_left}' -y '##{popup_pane_top}' -w '#{pane_width}' -h '#{pane_height}' 'tmux-fuzzy-motion popup-live #{pane_id}'"
78
+ ```
79
+
80
+ > [!NOTE]
81
+ > 後述の手順の`2.`で`'tmux-fuzzy-motion start %25 /dev/ttys000' returned 127`のようなエラーが表示される場合は以下のようにrun-shell環境のPATHに`tmux-fuzzy-motion`を含める必要があります。
82
+ >
83
+ > ```tmux
84
+ > set-environment -g PATH "/path/to/node/bin:$PATH"
85
+ > ```
86
+
58
87
  設定変更後は tmux を reload します。
59
88
 
60
89
  ```bash
@@ -63,13 +92,15 @@ tmux source-file ~/.tmux.conf
63
92
 
64
93
  ## 使い方
65
94
 
66
- 1. `copy-mode` に入る
67
- 2. `s` を押す
68
- 3. 小文字や記号で query を入力する
69
- 4. fuzzy match で候補を絞り込む
70
- 5. 英字 query の場合は Migemo による日本語候補も対象になる
71
- 6. 大文字 hint を押して即座に移動する
72
- 7. `Esc` または `Ctrl-[` でキャンセルする
95
+ 1. `tmux-fuzzy-motion start` を bind したキーを押す
96
+ 2. `--scope current`(default)は current pane のみを対象にし、pane がまだ `copy-mode` でなければ先に `copy-mode` に入る
97
+ 3. `--scope all` は current window の visible pane 全体を popup に合成して対象にする
98
+ 4. 小文字や記号で query を入力する
99
+ 5. fuzzy match で候補を絞り込む
100
+ 6. 英字 query の場合は Migemo による日本語候補も対象になる
101
+ 7. 大文字 hint を押して即座に移動する
102
+ 8. `--scope all` で選択した場合は、該当 pane を active にして必要なら `copy-mode` に入ってから移動する
103
+ 9. `Esc` または `Ctrl-[` でキャンセルする
73
104
 
74
105
  ## 入力キー
75
106
 
@@ -83,11 +114,18 @@ tmux source-file ~/.tmux.conf
83
114
  ## コマンド
84
115
 
85
116
  ```text
86
- tmux-fuzzy-motion start <pane-id> <client-tty>
117
+ tmux-fuzzy-motion start [--scope current|all] <pane-id> <client-tty>
118
+ tmux-fuzzy-motion popup-live <pane-id>
87
119
  tmux-fuzzy-motion doctor
88
120
  ```
89
121
 
90
- `input` は `start` から内部的に使うサブコマンドです。
122
+ `popup` と `daemon` は内部サブコマンドです。`popup-live` は `display-popup`
123
+ から直接起動する設定向けです。
124
+
125
+ `--scope`:
126
+
127
+ - `current`: current pane のみを対象にする。default
128
+ - `all`: current window の visible pane 全体を対象にする
91
129
 
92
130
  ## Doctor
93
131
 
@@ -133,9 +171,10 @@ pnpm check
133
171
 
134
172
  ## 制約
135
173
 
136
- - 対象は現在の viewport のみ
137
- - `copy-mode` 専用
174
+ - 対象は各 pane の現在の viewport のみ
175
+ - `--scope all` の対象は current window の visible pane のみ
176
+ - zoom 中の `--scope all` は見えている pane のみを対象にする
138
177
  - query 入力は ASCII 寄り
139
178
  - combining character の完全な扱いは未保証
140
- - overlay は一時的な tmux pane を swap して表示し、終了時に元へ戻す
141
- - query は pane 内の最下行右端に描画する
179
+ - `display-popup` が必要なため、tmux 3.2 以上が必須
180
+ - query は popup の最下行右端に描画する
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [日本語版はこちら](./README.ja.md)
4
4
 
5
- `tmux-fuzzy-motion` is a CLI for quick cursor jumps inside `tmux copy-mode`.
5
+ `tmux-fuzzy-motion` is a CLI for quick cursor jumps in tmux panes.
6
6
  It scans the current viewport, extracts jump targets, filters them with fuzzy
7
7
  search, and lets you jump with uppercase hints. Roman queries can also match
8
8
  Japanese text through Migemo.
@@ -10,12 +10,15 @@ Japanese text through Migemo.
10
10
  ## Features
11
11
 
12
12
  - Works inside `tmux copy-mode`
13
+ - `start` can also be launched outside copy-mode and enters copy-mode automatically
14
+ - `start --scope all` can target every visible pane in the current window
13
15
  - Extracts URLs, paths, filenames, symbols, and general words from the current viewport
14
16
  - Supports fuzzy matching with `fzf`
15
17
  - Supports Migemo matching for alphabetic queries via `jsmigemo`
16
18
  - Preserves pane colors while drawing the overlay
19
+ - Reuses an external daemon process so matcher and Migemo startup stay warm
17
20
  - Uses single-key uppercase hints for fast selection
18
- - Renders the query inside the target pane and restores the original pane after finishing
21
+ - Opens the UI in a tmux popup instead of creating a persistent scratch window
19
22
 
20
23
  ## Requirements
21
24
 
@@ -51,10 +54,39 @@ npx tmux-fuzzy-motion@latest doctor
51
54
  Add these bindings to your `tmux.conf`:
52
55
 
53
56
  ```tmux
54
- bind-key -T copy-mode-vi s run-shell -b 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
55
- bind-key -T copy-mode s run-shell -b 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
57
+ bind-key -T copy-mode-vi s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
58
+ bind-key -T copy-mode s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
56
59
  ```
57
60
 
61
+ If you also want to launch it outside copy-mode, add a binding in the root
62
+ table as well:
63
+
64
+ ```tmux
65
+ bind-key s run-shell 'tmux-fuzzy-motion start #{pane_id} #{client_tty}'
66
+ ```
67
+
68
+ If you want to search across every visible pane in the current window, add a
69
+ binding with `--scope all`.
70
+
71
+ ```tmux
72
+ bind-key S run-shell 'tmux-fuzzy-motion start --scope all #{pane_id} #{client_tty}'
73
+ ```
74
+
75
+ If you want tmux to open the popup directly without going through the `start`
76
+ subcommand, use this instead:
77
+
78
+ ```tmux
79
+ bind-key -T copy-mode-vi s run-shell -C "display-popup -E -B -x '##{popup_pane_left}' -y '##{popup_pane_top}' -w '#{pane_width}' -h '#{pane_height}' 'tmux-fuzzy-motion popup-live #{pane_id}'"
80
+ bind-key -T copy-mode s run-shell -C "display-popup -E -B -x '##{popup_pane_left}' -y '##{popup_pane_top}' -w '#{pane_width}' -h '#{pane_height}' 'tmux-fuzzy-motion popup-live #{pane_id}'"
81
+ ```
82
+
83
+ > [!NOTE]
84
+ > If you see an error like `'tmux-fuzzy-motion start %25 /dev/ttys000' returned 127` at step 2 below, you need to add `tmux-fuzzy-motion` to the PATH in the run-shell environment:
85
+ >
86
+ > ```tmux
87
+ > set-environment -g PATH "/path/to/node/bin:$PATH"
88
+ > ```
89
+
58
90
  Reload tmux after editing the config:
59
91
 
60
92
  ```bash
@@ -63,13 +95,18 @@ tmux source-file ~/.tmux.conf
63
95
 
64
96
  ## Usage
65
97
 
66
- 1. Enter `copy-mode`.
67
- 2. Press `s`.
68
- 3. Type a query in lowercase or symbols.
69
- 4. Narrow the candidates with fuzzy matching.
70
- 5. For alphabetic queries, Migemo also expands roman input to Japanese matches.
71
- 6. Press an uppercase hint to jump immediately.
72
- 7. Press `Esc` or `Ctrl-[` to cancel.
98
+ 1. Press the key bound to `tmux-fuzzy-motion start`.
99
+ 2. `--scope current` (the default) targets only the current pane and enters
100
+ copy-mode first if needed.
101
+ 3. `--scope all` targets every visible pane in the current window by composing
102
+ them into a single popup.
103
+ 4. Type a query in lowercase or symbols.
104
+ 5. Narrow the candidates with fuzzy matching.
105
+ 6. For alphabetic queries, Migemo also expands roman input to Japanese matches.
106
+ 7. Press an uppercase hint to jump immediately.
107
+ 8. In `--scope all`, the selected pane becomes active and enters copy-mode if
108
+ needed before the cursor moves.
109
+ 9. Press `Esc` or `Ctrl-[` to cancel.
73
110
 
74
111
  ## Input Keys
75
112
 
@@ -83,11 +120,18 @@ tmux source-file ~/.tmux.conf
83
120
  ## Commands
84
121
 
85
122
  ```text
86
- tmux-fuzzy-motion start <pane-id> <client-tty>
123
+ tmux-fuzzy-motion start [--scope current|all] <pane-id> <client-tty>
124
+ tmux-fuzzy-motion popup-live <pane-id>
87
125
  tmux-fuzzy-motion doctor
88
126
  ```
89
127
 
90
- `input` is an internal subcommand used by `start`.
128
+ `popup` and `daemon` are internal subcommands. `popup-live` is intended for
129
+ direct `display-popup` bindings.
130
+
131
+ `--scope`:
132
+
133
+ - `current`: target only the current pane. This is the default.
134
+ - `all`: target every visible pane in the current window.
91
135
 
92
136
  ## Doctor
93
137
 
@@ -133,9 +177,10 @@ pnpm check
133
177
 
134
178
  ## Limitations
135
179
 
136
- - Targets are limited to the current viewport
137
- - Designed for `copy-mode` only
180
+ - Targets are limited to the current viewport of each pane
181
+ - `--scope all` targets only visible panes in the current window
182
+ - Zoomed windows with `--scope all` only target the pane that is visible
138
183
  - Query input is ASCII-oriented
139
184
  - Exact behavior for combining characters is not fully guaranteed
140
- - The overlay swaps in a temporary tmux pane and restores the original pane when it exits
141
- - The query is drawn on the bottom row inside the pane, aligned to the right edge
185
+ - Requires `display-popup`, so tmux 3.2 or later is mandatory
186
+ - The query is drawn on the popup's bottom row, aligned to the right edge