Is there a way to use $EDITOR as the merge-tools program? #6548
-
What I have currently: [merge-tools.nvimdiff]
program = "nvim"
merge-args = ["-c", "JJdiff", "-d", "$left", "$output", "$right"] What I'd like to do: [merge-tools.nvimdiff]
program = "$EDITOR"
merge-args = ["-c", "JJdiff", "-d", "$left", "$output", "$right"] For context, my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I don't believe there's a built-in way. You could make your own script like #!/bin/sh
$EDITOR "$@"
# **Update/quick fixup:** There should *not* be quotes around $EDITOR If you make it exectuable, call it IIRC, Some systems (Debian derivatives, I think) have a Update 2: Yeah, Alternatively, you could use [merge-tools.nvimdiff]
program = "env"
merge-args = ["ENV_EDITOR=1", "nvim", "-c", "JJdiff", "-d", "$left", "$output", "$right"] Aside: there's also a separate issue that we might want a feature with a possible name of |
Beta Was this translation helpful? Give feedback.
As ilyagr suggested, you'll need to use
sh
to expand$EDITOR
environment variable. Something like this might also work (seejj util exec --help
for the trick):I don't think we'll want to add support for environment variables expansion at arbitrary places. Even if we had that,
program = "$EDITOR"
wouldn't work if$EDITOR
had command name and arguments inline.