iTerm2 如何保存一组 Tabs 下次打开还打开这些 Tabs - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yimity
V2EX    macOS

iTerm2 如何保存一组 Tabs 下次打开还打开这些 Tabs

  •  
  •   yimity 2017-02-08 14:00:12 +08:00 5593 次点击
    这是一个创建于 3169 天前的主题,其中的信息可能已经有所发展或是发生改变。

    就是想要打开多个 Tab ,然后关电脑或者重启的时候,再次打开 iTerm2 的时候把保存的这一组 Tabs 重新打开。并设定到特定的目录中。该如何做呢?

    14 条回复    2017-02-12 09:27:28 +08:00
    gesse
        1
    gesse  
       2017-02-08 14:21:43 +08:00
    不关电脑?
    yimity
        2
    yimity  
    OP
       2017-02-08 15:31:18 +08:00
    @gesse 唉,就是想要关电脑呢,之前 Windows 中的 cmder 可以做到,但是切到 Mac 就不知道咋实现了。
    关键是十多个 Tab 呢。即使很长时间关一次电脑,但是还是很麻烦。
    minamike
        3
    minamike  
       2017-02-08 15:51:09 +08:00
    Applescript 或 automator 建一个 workflow 吧
    sojingle
        4
    sojingle  
       2017-02-08 15:52:52 +08:00   2
    系统的 Preferences->General->不要选择 Close windows when quitting an app ,同时 iTerm2 的 Preferences->General->Startup 选择 Use System Window Restoration Settings
    yimity
        5
    yimity  
    OP
       2017-02-08 18:56:45 +08:00
    @minamike 应该怎么写呢,这个没写过。

    @sojingle 这样子我关机重启的话,打开 iTerm2 还是原来的味道?这样子设置,会不会其他 APP 也会被影响?
    AnyISalIn
        6
    AnyISalIn  
       2017-02-08 19:36:25 +08:00
    tmux 大法好
    kenzi
        7
    kenzi  
       2017-02-08 20:03:08 +08:00 via iPad
    Tmux+1
    minamike
        8
    minamike  
       2017-02-08 20:45:34 +08:00
    @yimity

    activate application "Terminal"
    tell application "Terminal" to do script "script1" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script2" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script3" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script4" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script5" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script6" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script7" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script8" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script9" in window 1
    tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
    tell application "Terminal" to do script "script10" in window 1

    把 script1 ~ script10 改成你要运行的命令 笨办法
    minamike
        9
    minamike  
       2017-02-08 20:49:17 +08:00   1
    @yimity 对了 我这个是用于自带的终端的 要用于 iTerm2 的话要把 Terminal 改成 iTerm2 的名称
    wjidea
        10
    wjidea  
       2017-02-09 09:17:36 +08:00
    tmux 大法好
    yimity
        11
    yimity  
    OP
       2017-02-09 09:30:36 +08:00
    @minamike 好的,谢谢,我试一下。
    sojingle
        12
    sojingle  
       2017-02-09 12:57:07 +08:00
    @yimity 是的,其他程序也受影响。

    这个功能是让程序在退出时不关闭窗口(文档),下次程序启动就会自动打开这些窗口。如果你在退出 iTerm 的时候直接 CMD+Q 退出而不是一个个窗口关掉,下次再打开就是这个状态,其他写的比较标准的程序也是一样的行为。

    关电脑时系统给程序发送的就是直接退出的命令。
    Cople
        13
    Cople  
       2017-02-10 10:37:25 +08:00
    Window > Save Window Arrangment
    ychongsaytc
        14
    ychongsaytc  
       2017-02-12 09:27:28 +08:00 via iPhone
    tmux+10086
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2993 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 27ms UTC 13:35 PVG 21:35 LAX 06:35 JFK 09:35
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86