I define Bash aliases in my ~/.tmuxinator/*.yml files like this:

pre_window: alias cc=heh/path/that;alias ccc='cc clean; clear; cc' ;alias selenium-restart=bin/docker/restart-selenium-chrome ;alias yii=bin/docker/yii/yii

Is there a better way? It works, but, obviously, it is not convenient to add them like that.


Based on this ticket in tmuxinator's issue tracker titled: "pre" option not using zsh options, alias, configuration (running as sh) #286 it looks like you'd either do it as a pre: or a pre_window:. The OP to that ticket was trying pre:

    - setopt clobber
    - source ~/projects/auv/devel/setup.zsh
    - stt

and getting this error:

> mux start auv-core
sh: 13: setopt: not found
sh: 13: source: not found
sh: 13: stt: not found
arranging in: main-vertical
arranging in: main-vertical

and one of the developers says this:

Things like setopt, source and alias are all built in shell commands and don't make sense in a shell script.

Your only option would be to put them in pre_window so send-keys is used in each window / pane.

Based on this comment I think your only option is to use pre_window: as you're doing. You might want to take a different tactic rather than list all the aliases in a pre_window: directly, put them in a file:

$ cat ~/my_aliases
alias cc=heh/path/that
alias ccc='cc clean; clear; cc'
alias selenium-restart=bin/docker/restart-selenium-chrome
alias yii=bin/docker/yii/yii

and have a pre_window: like this:

pre_window: source ~/my_aliases

But your approach looks consistent with how the project intends you to use pre_window: at the very least.

  • I didn't realize for some reason that I can put commands in separate list items for pre/pre_window, thanks! – jojman Aug 3 '18 at 1:21
  • By the way, what I'm doing is what your post suggests to be impossible. Bash aliases in pre_window work fine. – jojman Aug 3 '18 at 1:23
  • @jojman - no you can put aliases in pre_window you can't put them in pre is what the thread stated. – slm Aug 3 '18 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.