← Back to Upcase

I am trying to run this command bind-key r split-window -h "rake routes"

Well it runs it perfectly but two thing stand out…

  1. When I run this key binding it runs the command and exits out…
  2. When I run this key binding I would like for the window pane to be bigger than what it is…

Any help?

Is what I get from SO but I still don’t know how to implement this…

Hey @staycreativedesign, I think I can help out:

  1. If you have a command like rake routes which prints output and then completes, tmux will close the pane you open since it considers the command to be “done”. You can alter this by piping to less which will wait for you to exit, so your whole command becomes: bind-key r split-window -h 'rake routes | less'.
  2. You can specify the size of the window to create, as a percentage, with the -p option. So to make it 80% of the current pane, your full command would end up being:
bind-key r split-window -h -p 80 'rake routes | less'

You may run into an issue with rake not being defined in the newly spawned shell. Likely the best answer to this is generate binstubs, and then use bin/rake in place of rake in your command.