As of 2017, the source-code (runner.py) did this:
term = os.environ.get('TERMCMD', os.environ.get('TERM'))
if term not in get_executables():
term = 'x-terminal-emulator'
if term not in get_executables():
term = 'xterm'
if isinstance(action, str):
action = term + ' -e ' + action
else:
action = [term, '-e'] + action
so you should be able to put any xterm-compatible program name in TERMCMD
. However, note the use of -e
(gnome-terminal doesn't match xterm's behavior). If you are using Debian/Ubuntu/etc, the Debian packagers have attempted to provide a wrapper to hide this difference in the x-terminal-emulator
feature. If that applies to you, you could set TERMCMD
to x-terminal-emulator
.
Followup - while the design of the TERMCMD
feature has not changed appreciably since mid-2016, the location within the source has changed:
That is implemented in get_term
:
def get_term():
"""Get the user terminal executable name.
Either $TERMCMD, $TERM, "x-terminal-emulator" or "xterm", in this order.
"""
command = environ.get('TERMCMD', environ.get('TERM'))
if shlex.split(command)[0] not in get_executables():
command = 'x-terminal-emulator'
if command not in get_executables():
command = 'xterm'
return command
which uses x-terminal-emulator
as before.
There is a related use of TERMCMD
in rifle.py
, used for executing commands rather than (as asked in the question) for opening a terminal. Either way, the key to using ranger is x-terminal-emulator
, since GNOME Terminal's developers do not document their command-line interface, while Debian developers have provided this workaround.
Quoting from Bug 701691 – -e accepts only one term; all other terminal emulators accept more than one term (which the developer refused to fix, marking it "not a bug"):
Christian Persch 2013-06-06 16:02:54 UTC
There are no docs for the gnome-terminal command line options.
Best Answer
I use
ranger
too, andvim
.Try
env EDITOR=vim ranger
then try out E option to open an editor for the file. If it worked, then the changes are not working for you for either of the two reasons..bashrc
after editing it withexport EDITOR=vim
change.For scenario one, just do a
source ~/.bashrc
before starting ranger or open another shell. For later you want to find out the shell that you are using and edit the proper environment file for it.