Merge pull request #501 from antonva/termite-terminator-support

Added support for termite and terminator in editorcmd.
This commit is contained in:
Oliver Blanthorn 2018-05-08 19:16:34 +01:00 committed by GitHub
commit 6ed334967f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,10 +80,12 @@ export async function getBestEditor(): Promise<string> {
"xterm -class tridactyl_editor -e",
"uxterm -class tridactyl_editor -e",
"urxvt -e",
// "terminator -e", // NB: requires command to be in quotes, which breaks the others
// so terminator is not supported.
"alacritty -e", // alacritty is nice but takes ages to start and doesn't support class
"cool-retro-term -e",
// Terminator and termite require -e commands to be in quotes, hence the extra quote at the end.
// The closing quote is implemented in the editor function.
'terminator -e "',
'termite --class tridactyl_editor -e "',
"dbus-launch gnome-terminal --",
// I wanted to put hyper.js here as a joke but you can't start it running a command,
// which is a far better joke: a terminal emulator that you can't send commands to.
@ -142,7 +144,11 @@ export async function editor(file: string, content?: string) {
config.get("editorcmd") == "auto"
? await getBestEditor()
: config.get("editorcmd")
await run(editorcmd + " " + file)
// Dirty hacks for termite and terminator support part 2.
const e = editorcmd.split(" ")[0]
if (e === "termite" || e === "terminator") {
await run(editorcmd + " " + file + '"')
} else await run(editorcmd + " " + file)
return await read(file)
}