Basically, the solution through modifying what zsh does on every new shell sounds a bit complicated. Instead, simply start your tmux with the program that you want to show in the first pane:
tmux new-session ranger
When you manually add further panes, they will just start the default shell.
You can also prepare a whole bunch of panes. For example, to start with a layout of
┌────────────┬───────────┐
│ │ zsh │
│ │ │
│ ranger ├───────────┤
│ │ zsh │
│ │ │
└────────────┴───────────┘
you could just
#!/bin/sh
# e.g. /usr/local/bin/my_tmux
# or just ~/bin/mt, to make your typing easier
# (assuming /home/r45i/bin is part of $PATH)
#
# check we're not running within tmux
if [ -z "$TMUX" ]
then
# start a detached session
tmux new-session -d ranger
# split the window horizontally
tmux split-window -h
# split the freshly created vertically
tmux split-window -v
# attach to the session
tmux attach-session -d
fi
exportapproach cannot work, because environment variables are only passed to children (i.e., processes started by a process), not along "siblings" (i.e., processes that were started by the same process, in your case tmux)