Search code examples
cloud9-ide

Cloud-9 SDK: c9-editor doesn't open from terminal as default editor


I'm running a local VM with Cloud-9 SDK installed. In my workspace I have a Mercurial repository, and I'd like to be able to use Cloud-9 editor for commit messages, and possibly also as a pipe for other commands like hg diff.

What I tried so far:

  • In TERMINAL settings I selected "Use Cloud9 as the Default Editor". If I try to hg commit, c9-editor doesn't open and the terminal get stalled until I press CTRL+C.
  • Same result if I set editor with export EDITOR="/usr/bin/c9 open --wait".
  • c9 somefile.txt works just fine from the same terminal, opening the file in the editor.

Solution

  • Hg creates a file in tmp, and usually cloud9 is configured to allow editing only in home and workspace.

    as a workaround you can use

    export EDITOR='fn() {
        cat $1 > ~/.c9-edit;
        c9 open --wait ~/.c9-edit;
        cat ~/.c9-edit > $1;
    } ;fn'