Skip to content

Commit 8d86d93

Browse files
mek-ytneiljp
authored andcommitted
FAQ: Add entry discussing composing messages in an external editor.
Main content by original author, with phrasing adjustments by neiljp. Additional notes regarding the terminal switching between the application and terminal editors, and the application being paused while editing, added by neiljp.
1 parent e16ee44 commit 8d86d93

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/FAQ.md

+50
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [When are messages marked as having been read?](#when-are-messages-marked-as-having-been-read)
1414
- [How do I access multiple servers?](#how-do-i-access-multiple-servers)
1515
- [What is autocomplete? Why is it useful?](#what-is-autocomplete-why-is-it-useful)
16+
- [Can I compose messages in another editor?](#can-i-compose-messages-in-another-editor)
1617
- Something is not working!
1718
- [Colors appear mismatched, don't change with theme, or look strange](#colors-appear-mismatched-dont-change-with-theme-or-look-strange)
1819
- [Symbols look different to in the provided screenshots, or just look incorrect](#symbols-look-different-to-in-the-provided-screenshots-or-just-look-incorrect)
@@ -373,6 +374,55 @@ through autocomplete depend upon the context automatically.
373374
**NOTE:** If a direct message recipient's name contains comma(s) (`,`), they
374375
are currently treated as comma-separated recipients.
375376

377+
## Can I compose messages in another editor?
378+
379+
In the `main` branch of zulip-terminal, you can now use an external editor of
380+
your choice to compose your messages using the `Ctrl o` hotkey.
381+
382+
The editor command is looked for in the `ZULIP_EDITOR_COMMAND` and `EDITOR`
383+
environment variables (in that order), or the `editor` entry of the zuliprc
384+
file (which overrides both of those).
385+
386+
It should work directly for most terminal editors with only the program name,
387+
eg. `vim`, `nano`, `helix`, `kakoune`, `nvim`, etc.
388+
389+
It can also be used with a desktop editor with some constraints: the program
390+
must not fork or detach from the running terminal and should open in a new
391+
window. For this reason it may be useful to use `ZULIP_EDITOR_COMMAND` (or the
392+
zuliprc setting) to avoid conflict with the more widely used `EDITOR`
393+
environment variable. Some examples include:
394+
395+
- [lapce](https://github.com/lapce/lapce) with `lapce -n -w`
396+
- [sublime-text](https://www.sublimetext.com/) with `subl -n -w`
397+
- [marker](https://github.com/fabiocolacio/Marker) with `marker`
398+
- [vim](https://github.com/vim/vim) with `vim -g -f` or `gvim -f`
399+
- [vscode](https://github.com/microsoft/vscode) with `code -n -w`
400+
401+
**NOTE:** Backslashing white space (`\ `) is needed when using an executable
402+
containing them, for example Sublime Text on macOS can be configured with
403+
`/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl`.
404+
405+
This feature works by sending the message content back and forth using
406+
temporary files:
407+
- A temporary file is created, filled with any existing message content;
408+
- The editor command is run, with the filename appended (standard practice for editors);
409+
- You edit your text in the editor of your choice;
410+
- When the external editor process ends (closing the window, or quitting the terminal
411+
editor), the compose box will be updated with the new message content from
412+
the temporary file.
413+
414+
> NOTE 1: If using a terminal-based editor, it will temporarily take over the
415+
> entire terminal and replace the application. However, upon exiting that
416+
> editor, the application should return to the terminal.
417+
418+
> NOTE 2: Whichever type of editor you use (terminal or desktop/graphical), the
419+
> application will temporarily pause while you are editing. The application
420+
> should resume as normal once you exit the external editor and the text you
421+
> entered appears in the compose area.
422+
423+
**If you have success with other editors, these examples do not work, or have
424+
other problems, please let us know!**
425+
376426
## Colors appear mismatched, don't change with theme, or look strange
377427

378428
Some terminal emulators support specifying custom colors, or custom color

0 commit comments

Comments
 (0)