2

I'm considering using Alpine on OS X (Yosemite). I have most things configured, but I want to be able to use a GUI text editor (specifically OS X's TextEdit) as the Alpine alternative editor, so that I can use the system keyboard shortcuts, spelling checker, mouse, etc. (I'm aware that I could use an editor like emacs or vim, but I don't want to use those.)

I know about the configuration setting in Alpine (Setup > Config > ... scroll down a lot ... Editor), which wants the name of a program/command to run when I invoke the alternate editor. I've tried "open -e", which tells TextEdit to open whatever filename follows, and invoking the alternate editor does indeed open TextEdit. However, the problem is returning the contents of the TextEdit buffer to Alpine — this doesn't work. I'm not sure what mechanism Alpine uses to obtain the text from the alternative editor, though I assume it uses a temporary file. In any case, I think the problem is that the "open" command returns immediately and Alpine thinks I didn't type anything. (I have also tried the "bbedit" command to invoke "BBEdit", with essentially the same result.)

Thanks in advance.

1

If Alpine indeed works with step files, then, according to man open, you could try:

open -W -n -e
  • The -W option ensures open waits until the app is closed to return.
  • The -n option is used to run a new instance of your app, even if it’s already running (this way, if you’re already running TextEdit, you don’t have to close the currently running instance).

If you’d like to use another editor, let’s say “Awesome Text Editor.app”, you can replace the -e by -a.

open -W -n -a "Awesome Text Editor"

Notice that you’ll need to close the application, not only the document.

Some editors also offer their own command-line utilities. In TextMate 2, the following command will wait for the document to be closed to return.

mate -w
  • I wouldn’t be surprised if BBEdit’s CLI utility also offered such an option, but I’m not familiar with it nor have it installed. – Édouard May 16 '15 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.