在 tmuxinator 中的项目配置中在哪里定义 shell 别名?

在 tmuxinator 中的项目配置中在哪里定义 shell 别名?

我在~/.tmuxinator/*.yml文件中定义 Bash 别名,如下所示:

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

有没有更好的办法?它可以工作,但是显然,这样添加它们并不方便。

答案1

基于 tmuxinator 问题跟踪器中的这张票,标题为:“pre”选项不使用 zsh 选项、别名、配置(以 sh 身份运行)#286看起来你要么把它作为 apre:要么 a pre_window:。该票的 OP 正在尝试pre:

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

并收到此错误:

> 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
[exited]

和其中之一开发商这样说:

像 setopt、source 和 alias 这样的东西都是内置在 shell 命令中的,在 shell 脚本中没有意义。

您唯一的选择是将它们放在 pre_window 中,以便在每个窗口/窗格中使用发送键。

根据此评论,我认为您唯一的选择就是pre_window:按照您的做法使用。您可能想采取不同的策略,而不是直接列出所有别名pre_window:,将它们放入文件中:

$ 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

并有一个pre_window:像这样的:

pre_window: source ~/my_aliases

pre_window:但您的方法看起来至少与项目希望您使用的方式一致。

相关内容