Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ranger command to open tmux split in current directory
# You always need to import ranger.api.commands here to get the Command class:
from ranger.api.commands import *
# My additional commands
class terminal(Command):
Open new tmux split in the current directory.
def execute(self):
import os
from ranger.ext.get_executables import get_executables
if os.environ.get('TMUX'):
command = 'tmux split-window -v'
command = os.environ.get('TERMCMD', os.environ.get('TERM'))
if command not in get_executables():
command = 'x-terminal-emulator'
if command not in get_executables():
command = 'xterm', flags='f')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment