-
Notifications
You must be signed in to change notification settings - Fork 864
Added documentation for the draft editor #2311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AndreasArvidsson
wants to merge
3
commits into
main
Choose a base branch
from
draft-editor-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+73
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Draft editor | ||
|
|
||
| The draft editor lets you revise text in a full text editor before inserting it | ||
| back into the application where you started. It is useful for composing longer | ||
| messages in applications whose text fields have limited editing or voice-control | ||
| support. | ||
|
|
||
| The plugin uses an already-running editor application. It opens a new tab in | ||
| that editor, optionally copies selected text into it, and remembers the original | ||
| window. When you submit the draft, the plugin closes the temporary tab, returns | ||
| to the original window, and pastes the revised text. If text was selected in the | ||
| original window, the paste replaces that selection. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - The editor application must be running before you start a draft. | ||
| - By default, the plugin recognizes Visual Studio Code, VSCodium, Codium, and | ||
| code-oss. | ||
| - The source application and editor must support the standard Talon editing and | ||
| tab actions used by the community command set. | ||
|
|
||
| The commands for starting a draft are available only when a recognized editor | ||
| is running and is not the focused application. | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | Action | | ||
| | --------------- | ------------------------------------------------------------------------------------------------ | | ||
| | `draft this` | Open a new editor tab. If text is selected, copy it into the draft. | | ||
| | `draft all` | Select all text in the current field or document and open it as a draft. | | ||
| | `draft line` | Select the current line and open it as a draft. | | ||
| | `draft top` | Select from the cursor to the start of the document and open it as a draft. | | ||
| | `draft bottom` | Select from the cursor to the end of the document and open it as a draft. | | ||
| | `draft submit` | While editing a draft, close its tab, return to the original window, and paste the revised text. | | ||
| | `draft discard` | Close the draft without pasting it and return to the original window. | | ||
|
|
||
| ## Example workflow | ||
|
|
||
| 1. Start Visual Studio Code or another configured editor. | ||
| 2. Focus the application in which you want to compose or revise text. | ||
| 3. Say `draft this` to start with an empty draft, or select some text and say | ||
| `draft this` to revise it. | ||
| 4. Edit the text in the newly opened editor tab. | ||
| 5. Say `draft submit` to send the result back, or `draft discard` to cancel. | ||
|
|
||
| The most recently submitted draft is kept in memory. When the editor is running | ||
| but not focused, saying `draft submit` pastes that text again. This can be used | ||
| to recover from a failed window switch or to insert the last draft in another | ||
| location. The saved draft is cleared when Talon restarts. | ||
|
|
||
| ## Configure a different editor | ||
|
|
||
| Set `user.draft_editor` to the application name Talon reports for your editor. | ||
| For example, add the following to a `.talon` file to use Sublime Text: | ||
|
|
||
| ```talon | ||
| settings(): | ||
| user.draft_editor = "Sublime Text" | ||
| ``` | ||
|
|
||
| To recognize multiple application names, separate them with a comma and a | ||
| space: | ||
|
|
||
| ```talon | ||
| settings(): | ||
| user.draft_editor = "Sublime Text, Notepad++" | ||
| ``` | ||
|
|
||
| Setting this value replaces the default editor list; it does not add to it. | ||
|
|
||
| ## Demo | ||
|
|
||
| [Watch the draft editor demo on YouTube](https://www.youtube.com/watch?v=U6Q9qjSIVQg). | ||
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user adds this setting while the custom editor is already running—the setup this section describes—the draft commands remain disabled because
draft_editor.pyrecomputesuser.draft_editor_app_runningonly at Talon startup and onapp_launch/app_close; reloading a.talonsetting and switching focus does not callhandle_app_running. Document that the editor or Talon must be restarted after changing this setting, or update detection when the setting changes.Useful? React with 👍 / 👎.