LoginSignup
16

More than 1 year has passed since last update.

朝食の時間が3分伸びる(vscode拡張機能)

Last updated at Posted at 2022-11-25

起動時のターミナル分割とコマンド実行を自動化

「Restore Terminals」
qiita.gif
簡単な設定のみで任意のコマンドを実行ターミナルの分割ができます!
早速、セットアップをしていきましょう!

MarketPlaceにて下記をコピペ

restore terminals

下記をインストール

Screenshot 2022-11-26 at 0.37.31.png

設定

共通の設定
settings.jsonに記述

個別で設定
.vscode/restore-terminals.jsonに記述
restoreTerminals.terminalsterminalsに変更

①画面内で分割する例

以下のコードは一画面が三つに分割される

settings.json
 "restoreTerminals.terminals": [
    {
      "splitTerminals": [
        {
          "name": "🍎",
          "commands": ["echo 1"]
        },
        {
          "name": "🍌",
          "commands": ["echo 2", "git init"]
        },
        {
          "name": "🐡",
          "commands": ["echo 3", "npm init -y"]
        },
      ]
    },
  ]

②複数タブを開く例

以下のコードはタブが3つ作成される

settings.json
  "restoreTerminals.terminals": [
    {
      "splitTerminals": [
        {
          "name": "🦍",
          "commands": ["echo 1"]
        }
      ]
    },
    {
      "splitTerminals": [
        {
          "name": "🍌",
          "commands": ["echo 2"]
        }
      ]
    },
    {
      "splitTerminals": [
        {
          "name": "🙈",
          "commands": ["echo 3"]
        }
      ]
    }
  ]

その他の設定について(詳細はサンプルをご参照ください!)

起動時に実行せず、自分でターミナルを開いた時実行
runOnStartup: false
コマンドを貼り付けるだけで実行はしない
shouldRunCommands: false
既存のターミナルを閉じずに実行
keepExistingTerminalsOpen: true
遅延して実行(下記だと3秒)
artificialDelayMilliseconds: 3000

以上で終わりです
ありがとうございました><

参考記事

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16