#pragma once #include #include namespace ExternalEditor { // $VISUAL, then $EDITOR, then the first of nano/vim/vi found on PATH. // Empty if nothing was found. std::string defaultCommand(); // Is the first word of `command` an executable we can find? bool commandExists(const std::string& command); // Well-known editors that are installed (used for tab completion). std::vector installedEditors(); // Opens `initialText` in the editor and returns the edited text. // Throws std::runtime_error if the editor cannot be run or exits with an error. std::string edit(const std::string& command, const std::string& initialText); } // namespace ExternalEditor