editprompt 0.8.1 → 1.1.0

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 (3) hide show
  1. package/README.md +45 -28
  2. package/dist/index.js +735 -505
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -8,6 +8,8 @@ A CLI tool that lets you write prompts for CLI tools using your favorite text ed
8
8
 
9
9
  ![send without closing editor](https://github.com/user-attachments/assets/b0e486af-78d7-4b70-8c82-64d330c22ba1)
10
10
 
11
+ > [!IMPORTANT]
12
+ > **📢 Migrating from v0.8.1 or earlier?** Please see the [Migration Guide](docs/migration-guide-v1.md) for upgrading to v1.0.0's subcommand-based interface.
11
13
 
12
14
  ## 🏆 Why editprompt?
13
15
 
@@ -44,11 +46,11 @@ editprompt supports three main workflows to fit different use cases:
44
46
 
45
47
  ### Workflow 1: Basic - Write and Send
46
48
 
47
- ![wrihte and send prompt by editprompt](https://github.com/user-attachments/assets/6587b0c4-8132-4d5c-be68-3aa32a8d4df2)
49
+ ![wrihte and send prompt by editprompt](https://github.com/user-attachments/assets/6587b0c4-8132-4d5c-be68-3aa32a8d4df2)
48
50
 
49
51
  The simplest way to use editprompt:
50
52
 
51
- 1. Run `editprompt` to open your editor
53
+ 1. Run `editprompt open` to open your editor
52
54
  2. Write your prompt
53
55
  3. Save and close the editor
54
56
  4. Content is automatically sent to the target pane or clipboard
@@ -61,7 +63,7 @@ Perfect for one-off prompts when you need more space than a terminal input line.
61
63
 
62
64
  For iterating on prompts without constantly reopening the editor:
63
65
 
64
- 1. Set up a keybinding to open editprompt with `--resume` mode
66
+ 1. Set up a keybinding to open editprompt with `resume` subcommand
65
67
  2. Editor pane stays open between sends
66
68
  3. Write, send, refine, send again - all without closing the editor
67
69
  4. Use the same keybinding to toggle between your work pane and editor pane
@@ -84,9 +86,9 @@ Ideal for trial-and-error workflows with AI assistants.
84
86
 
85
87
  For replying to specific parts of AI responses:
86
88
 
87
- 1. Select text in your terminal (tmux copy mode or WezTerm selection) and trigger quote mode
89
+ 1. Select text in your terminal (tmux copy mode or WezTerm selection) and trigger collect mode
88
90
  2. Repeat to collect multiple selections
89
- 3. Run `editprompt --capture` to retrieve all collected quotes
91
+ 3. Run `editprompt dump` to retrieve all collected quotes
90
92
  4. Edit and send your reply with context
91
93
 
92
94
  Perfect for addressing multiple points in long AI responses.
@@ -98,26 +100,27 @@ Perfect for addressing multiple points in long AI responses.
98
100
 
99
101
  ```bash
100
102
  # Use with your default editor (from $EDITOR)
101
- editprompt
103
+ editprompt open
102
104
 
103
105
  # Specify a different editor
104
- editprompt --editor nvim
105
- editprompt -e nvim
106
+ editprompt open --editor nvim
107
+ editprompt open -e nvim
106
108
 
107
109
  # Always copy to clipboard
108
- editprompt --always-copy
110
+ editprompt open --always-copy
109
111
 
110
112
  # Show help
111
113
  editprompt --help
114
+ editprompt open --help
112
115
  ```
113
116
 
114
117
  ### Tmux Integration
115
118
 
116
119
  ```tmux
117
120
  bind -n M-q run-shell '\
118
- editprompt --resume --target-pane #{pane_id} || \
121
+ editprompt resume --target-pane #{pane_id} || \
119
122
  tmux split-window -v -l 10 -c "#{pane_current_path}" \
120
- "editprompt --editor nvim --always-copy --target-pane #{pane_id}"'
123
+ "editprompt open --editor nvim --always-copy --target-pane #{pane_id}"'
121
124
  ```
122
125
 
123
126
 
@@ -135,7 +138,7 @@ bind -n M-q run-shell '\
135
138
  "/bin/zsh",
136
139
  "-lc",
137
140
  string.format(
138
- "editprompt --resume --mux wezterm --target-pane %s",
141
+ "editprompt resume --mux wezterm --target-pane %s",
139
142
  target_pane_id
140
143
  ),
141
144
  })
@@ -151,7 +154,7 @@ bind -n M-q run-shell '\
151
154
  "/bin/zsh",
152
155
  "-lc",
153
156
  string.format(
154
- "editprompt --editor nvim --always-copy --mux wezterm --target-pane %s",
157
+ "editprompt open --editor nvim --always-copy --mux wezterm --target-pane %s",
155
158
  target_pane_id
156
159
  ),
157
160
  },
@@ -175,14 +178,14 @@ While editprompt is running, you can send content to the target pane or clipboar
175
178
 
176
179
  ```bash
177
180
  # Run this command from within your editor session
178
- editprompt -- "your content here"
181
+ editprompt input -- "your content here"
179
182
  # Sends content to target pane and moves focus there
180
183
 
181
- editprompt --auto-send -- "your content here"
184
+ editprompt input --auto-send -- "your content here"
182
185
  # Sends content, automatically submits it (presses Enter), and returns focus to editor pane
183
186
  # Perfect for iterating on prompts without leaving your editor
184
187
 
185
- editprompt --auto-send --send-key "C-m" -- "your content here"
188
+ editprompt input --auto-send --send-key "C-m" -- "your content here"
186
189
  # Customize the key to send after content (tmux format example)
187
190
  # WezTerm example: --send-key "\r" (default for WezTerm is \r, tmux default is Enter)
188
191
  ```
@@ -210,7 +213,7 @@ if vim.env.EDITPROMPT then
210
213
 
211
214
  -- Execute editprompt command
212
215
  vim.system(
213
- { "editprompt", "--", content },
216
+ { "editprompt", "input", "--", content },
214
217
  { text = true },
215
218
  function(obj)
216
219
  vim.schedule(function()
@@ -243,7 +246,7 @@ end
243
246
  Add this keybinding to your `.tmux.conf` to collect selected text as quotes:
244
247
 
245
248
  ```tmux
246
- bind-key -T copy-mode-vi C-e { send-keys -X pipe "editprompt --quote --target-pane #{pane_id}" }
249
+ bind-key -T copy-mode-vi C-e { send-keys -X pipe "editprompt collect --target-pane #{pane_id}" }
247
250
  ```
248
251
 
249
252
  **Usage:**
@@ -260,7 +263,7 @@ Add this event handler and keybinding to your `wezterm.lua` to collect selected
260
263
  ```lua
261
264
  local wezterm = require("wezterm")
262
265
 
263
- wezterm.on("editprompt-quote", function(window, pane)
266
+ wezterm.on("editprompt-collect", function(window, pane)
264
267
  local text = window:get_selection_text_for_pane(pane)
265
268
  local target_pane_id = tostring(pane:pane_id())
266
269
 
@@ -268,7 +271,7 @@ wezterm.on("editprompt-quote", function(window, pane)
268
271
  "/bin/zsh",
269
272
  "-lc",
270
273
  string.format(
271
- "editprompt --quote --mux wezterm --target-pane %s -- %s",
274
+ "editprompt collect --mux wezterm --target-pane %s -- %s",
272
275
  target_pane_id,
273
276
  wezterm.shell_quote_arg(text)
274
277
  ),
@@ -280,7 +283,7 @@ return {
280
283
  {
281
284
  key = "e",
282
285
  mods = "CTRL",
283
- action = wezterm.action.EmitEvent("editprompt-quote"),
286
+ action = wezterm.action.EmitEvent("editprompt-collect"),
284
287
  },
285
288
  },
286
289
  }
@@ -297,7 +300,7 @@ return {
297
300
  Run this command from within your editor pane to retrieve all collected quotes:
298
301
 
299
302
  ```bash
300
- editprompt --capture
303
+ editprompt dump
301
304
  ```
302
305
 
303
306
  This copies all collected quotes to the clipboard and clears the buffer, ready for your reply.
@@ -305,7 +308,7 @@ This copies all collected quotes to the clipboard and clears the buffer, ready f
305
308
  **Complete workflow:**
306
309
  1. AI responds with multiple points
307
310
  2. Select each point in copy mode and press `Ctrl-e`
308
- 3. Open your editor pane and run `editprompt --capture`
311
+ 3. Open your editor pane and run `editprompt dump`
309
312
  4. Edit the quoted text with your responses
310
313
  5. Send to AI
311
314
 
@@ -316,6 +319,20 @@ This copies all collected quotes to the clipboard and clears the buffer, ready f
316
319
  - Each quote is prefixed with `> ` in markdown quote format
317
320
  - Multiple quotes are separated with blank lines
318
321
 
322
+ ### Sending to Multiple Panes
323
+
324
+ You can send content to multiple target panes simultaneously by specifying `--target-pane` multiple times:
325
+
326
+ ```bash
327
+ # Send to multiple panes with open subcommand
328
+ editprompt open --target-pane %1 --target-pane %2 --target-pane %3
329
+
330
+ # Register multiple target panes for use with resume and input modes
331
+ editprompt register --target-pane %1 --target-pane %2
332
+ ```
333
+
334
+ The content will be sent sequentially to all specified panes. This is useful when you want to send the same prompt to multiple CLI sessions.
335
+
319
336
  #### Neovim Integration Example
320
337
 
321
338
  You can set up a convenient keybinding to capture your quote content:
@@ -323,7 +340,7 @@ You can set up a convenient keybinding to capture your quote content:
323
340
  vim.keymap.set("n", "<Space>X", function()
324
341
  vim.cmd("update")
325
342
 
326
- vim.system({ "editprompt", "--capture" }, { text = true }, function(obj)
343
+ vim.system({ "editprompt", "dump" }, { text = true }, function(obj)
327
344
  vim.schedule(function()
328
345
  if obj.code == 0 then
329
346
  vim.cmd("silent write")
@@ -394,15 +411,15 @@ You can also pass custom environment variables to your editor:
394
411
 
395
412
  ```bash
396
413
  # Single environment variable
397
- editprompt --env THEME=dark
414
+ editprompt open --env THEME=dark
398
415
 
399
416
  # Multiple environment variables
400
- editprompt --env THEME=dark --env FOO=fooooo
417
+ editprompt open --env THEME=dark --env FOO=fooooo
401
418
 
402
419
  # Useful for editor-specific configurations
403
- editprompt --env NVIM_CONFIG=minimal
420
+ editprompt open --env NVIM_CONFIG=minimal
404
421
  ```
405
422
 
406
423
  #### Target Pane Environment Variable
407
424
 
408
- When using the send-without-closing feature or quote capture, editprompt sets `EDITPROMPT_TARGET_PANE` to the target pane ID. This is automatically used by `editprompt --` and `editprompt --capture` commands.
425
+ When using the send-without-closing feature or dump, editprompt sets `EDITPROMPT_TARGET_PANE` to the target pane ID. This is automatically used by `editprompt input` and `editprompt dump` commands.