マイクロソフトが開発中の新しいターミナルソフト「Windows Terminal」を試してみます。
個人的にはPowerShellをタブ切り替えで使えるのが嬉しい。
Windows Terminal(Preview)のインストール
以下のサイトからWindows TerminalのPreview版をダウンロードできます。
Windows Terminal (Preview) を入手 – Microsoft Store ja-JP

「Microsoft Store を開きますか?」というダイアログが表示されるので「Microsoft Store を開く」ボタンをクリック。

Microsoft StoreのWindows Terminal (Preview)の入手画面が表示されるので「入手」ボタンをクリック。

「複数のデバイスで使用する」というダイアログが表示されます。これはお好みで良いと思います。私は「必要ありません」を選択。

スマホアプリのように、ダウンロードとインストールが自動的に実行されます。Windowsも便利になったなぁと感じる所です。

インストールが終わったら「起動」ボタンを押して起動してみましょう。

Windows Terminalを起動してみる
インストールしたWindows Terminalを起動してみるとこんな感じ。

一見いつものPowerShellの画面ですが、上にタブが表示されています。

タブを増やせます。

Ctrlを押しながらマウスのホイールを操作することでフォントサイズの拡大・縮小ができます。
PowerShellだとウィンドウサイズごと大きくなっていましたが、Windows Terminalではウィンドウサイズはそのままでフォントサイズのみが変化します。

「∨」ボタンを押すとPowerShell以外も選択してタブを追加できます。
cmd(コマンドプロンプト)のタブや、Azure Cloud Shellのタブなんかも追加できるようです。

「Ctrl+Shift+1」 「Ctrl+Shift+2」といったショートカットで新しいタブを追加できるようです。
Azule Cloud TerminalではCtrl+Shiftを押しながらマウスホイールを操作すると背景の不透明度を変えられます。

エクスプローラのアドレスバーに「wt- d .」と入力してEnterを押すと、開いているフォルダーをWindows Terminalで開けます。

altを押しながらマウスの左クリックでドラッグすると、矩形選択ができます。
デフォルトでは選択した内容は即座にクリップボードにコピーされ、右クリックでペーストできます。

今の所、PowerShellタブを管理者モードで追加することは出来ないようです。
Windows Terminalの設定
プルダウンの「Settings」ボタンを押すか、「Ctrl+,」で設定ファイルがテキストエディタで開かれます。

設定ファイルはjson形式になっています。
内容は以下のようになっていました。
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{6e9fa4d2-a4aa-562d-b1fa-0789dc1f83d7}",
"hidden": false,
"name": "Legacy",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
追加するタブの種類もこの設定ファイルで管理されているようです。
defaultProfileにはWindowsTerminalのデフォルトのターミナルを指定できます。指定するguidは設定ファイル内の「list」の項目を見ると分かります。
initialCols、initialRowsでWindows Terminal起動時の幅と高さを設定できます。
それぞれ横の文字数、縦の行数を指定します。
この設定はWindows Terminalを再起動すると反映されます。
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols": 120,
"initialRows": 50,
…
ターミナルごとの設定はlist内の項目を編集することで行います。
例えばタブを追加した時の初期フォルダーを「”startingDirectory”: “C:\Users”」のように指定できます。
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"startingDirectory": "C:\\Users"
},
コメントに書いてあるように、「Alt」を押しながらプルダウンメニューのSettingsを選択するとデフォルトの設定ファイルを開く事ができます。
設定ファイルの記述内容に間違いがあると、ファイルを保存した時にWindows Terminal側でエラーが表示されます。

エラーの例です。
Failed to reload settings
Settings could not be reloaded from file. Check for syntax errors, including trailing commas.
* Line 25, Column 38
Bad escape sequence in string
See Line 25, Column 45 for detail.
Temporarily using the Windows Terminal default settings.
エラーのある行数まで教えてくれる親切設計です。
defaultの設定内容は以下のようになっていました。
// THIS IS AN AUTO-GENERATED FILE! Changes to this file will be ignored.
{
"alwaysShowTabs": true,
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols": 120,
"initialRows": 30,
"requestedTheme": "system",
"showTabsInTitlebar": true,
"showTerminalTitleInTitlebar": true,
"tabWidthMode": "equal",
"snapToGridOnResize": false,
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
"confirmCloseAllTabs": true,
"profiles":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"startingDirectory": "%USERPROFILE%",
"closeOnExit": "graceful",
"colorScheme": "Campbell Powershell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 12,
"historySize": 9001,
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
"padding": "8, 8, 8, 8",
"snapOnInput": true,
"useAcrylic": false
},
{
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false,
"startingDirectory": "%USERPROFILE%",
"closeOnExit": "graceful",
"colorScheme": "Campbell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 12,
"historySize": 9001,
"icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
"padding": "8, 8, 8, 8",
"snapOnInput": true,
"useAcrylic": false
}
],
"schemes":
[
{
"name": "Campbell",
"foreground": "#CCCCCC",
"background": "#0C0C0C",
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",
"yellow": "#C19C00",
"blue": "#0037DA",
"purple": "#881798",
"cyan": "#3A96DD",
"white": "#CCCCCC",
"brightBlack": "#767676",
"brightRed": "#E74856",
"brightGreen": "#16C60C",
"brightYellow": "#F9F1A5",
"brightBlue": "#3B78FF",
"brightPurple": "#B4009E",
"brightCyan": "#61D6D6",
"brightWhite": "#F2F2F2"
},
{
"name": "Campbell Powershell",
"foreground": "#CCCCCC",
"background": "#012456",
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",
"yellow": "#C19C00",
"blue": "#0037DA",
"purple": "#881798",
"cyan": "#3A96DD",
"white": "#CCCCCC",
"brightBlack": "#767676",
"brightRed": "#E74856",
"brightGreen": "#16C60C",
"brightYellow": "#F9F1A5",
"brightBlue": "#3B78FF",
"brightPurple": "#B4009E",
"brightCyan": "#61D6D6",
"brightWhite": "#F2F2F2"
},
{
"name": "Vintage",
"foreground": "#C0C0C0",
"background": "#000000",
"black": "#000000",
"red": "#800000",
"green": "#008000",
"yellow": "#808000",
"blue": "#000080",
"purple": "#800080",
"cyan": "#008080",
"white": "#C0C0C0",
"brightBlack": "#808080",
"brightRed": "#FF0000",
"brightGreen": "#00FF00",
"brightYellow": "#FFFF00",
"brightBlue": "#0000FF",
"brightPurple": "#FF00FF",
"brightCyan": "#00FFFF",
"brightWhite": "#FFFFFF"
},
{
"name": "One Half Dark",
"foreground": "#DCDFE4",
"background": "#282C34",
"black": "#282C34",
"red": "#E06C75",
"green": "#98C379",
"yellow": "#E5C07B",
"blue": "#61AFEF",
"purple": "#C678DD",
"cyan": "#56B6C2",
"white": "#DCDFE4",
"brightBlack": "#5A6374",
"brightRed": "#E06C75",
"brightGreen": "#98C379",
"brightYellow": "#E5C07B",
"brightBlue": "#61AFEF",
"brightPurple": "#C678DD",
"brightCyan": "#56B6C2",
"brightWhite": "#DCDFE4"
},
{
"name": "One Half Light",
"foreground": "#383A42",
"background": "#FAFAFA",
"black": "#383A42",
"red": "#E45649",
"green": "#50A14F",
"yellow": "#C18301",
"blue": "#0184BC",
"purple": "#A626A4",
"cyan": "#0997B3",
"white": "#FAFAFA",
"brightBlack": "#4F525D",
"brightRed": "#DF6C75",
"brightGreen": "#98C379",
"brightYellow": "#E4C07A",
"brightBlue": "#61AFEF",
"brightPurple": "#C577DD",
"brightCyan": "#56B5C1",
"brightWhite": "#FFFFFF"
},
{
"name": "Solarized Dark",
"foreground": "#839496",
"background": "#002B36",
"black": "#073642",
"red": "#DC322F",
"green": "#859900",
"yellow": "#B58900",
"blue": "#268BD2",
"purple": "#D33682",
"cyan": "#2AA198",
"white": "#EEE8D5",
"brightBlack": "#002B36",
"brightRed": "#CB4B16",
"brightGreen": "#586E75",
"brightYellow": "#657B83",
"brightBlue": "#839496",
"brightPurple": "#6C71C4",
"brightCyan": "#93A1A1",
"brightWhite": "#FDF6E3"
},
{
"name": "Solarized Light",
"foreground": "#657B83",
"background": "#FDF6E3",
"black": "#073642",
"red": "#DC322F",
"green": "#859900",
"yellow": "#B58900",
"blue": "#268BD2",
"purple": "#D33682",
"cyan": "#2AA198",
"white": "#EEE8D5",
"brightBlack": "#002B36",
"brightRed": "#CB4B16",
"brightGreen": "#586E75",
"brightYellow": "#657B83",
"brightBlue": "#839496",
"brightPurple": "#6C71C4",
"brightCyan": "#93A1A1",
"brightWhite": "#FDF6E3"
}
],
"keybindings":
[
{ "command": "closePane", "keys": [ "ctrl+shift+w" ] },
{ "command": "closeWindow", "keys": [ "alt+f4" ] },
{ "command": "copy", "keys": [ "ctrl+shift+c" ] },
{ "command": "copy", "keys": [ "ctrl+insert" ] },
{ "command": "decreaseFontSize", "keys": [ "ctrl+-" ] },
{ "command": "duplicateTab", "keys": [ "ctrl+shift+d" ] },
{ "command": "increaseFontSize", "keys": [ "ctrl+=" ] },
{ "command": { "action": "moveFocus", "direction": "down" }, "keys": [ "alt+down" ] },
{ "command": { "action": "moveFocus", "direction": "left" }, "keys": [ "alt+left" ] },
{ "command": { "action": "moveFocus", "direction": "right" }, "keys": [ "alt+right" ] },
{ "command": { "action": "moveFocus", "direction": "up" }, "keys": [ "alt+up" ] },
{ "command": "newTab", "keys": [ "ctrl+shift+t" ] },
{ "command": { "action": "newTab", "index": 0 }, "keys": ["ctrl+shift+1"] },
{ "command": { "action": "newTab", "index": 1 }, "keys": ["ctrl+shift+2"] },
{ "command": { "action": "newTab", "index": 2 }, "keys": ["ctrl+shift+3"] },
{ "command": { "action": "newTab", "index": 3 }, "keys": ["ctrl+shift+4"] },
{ "command": { "action": "newTab", "index": 4 }, "keys": ["ctrl+shift+5"] },
{ "command": { "action": "newTab", "index": 5 }, "keys": ["ctrl+shift+6"] },
{ "command": { "action": "newTab", "index": 6 }, "keys": ["ctrl+shift+7"] },
{ "command": { "action": "newTab", "index": 7 }, "keys": ["ctrl+shift+8"] },
{ "command": { "action": "newTab", "index": 8 }, "keys": ["ctrl+shift+9"] },
{ "command": "nextTab", "keys": [ "ctrl+tab" ] },
{ "command": "openNewTabDropdown", "keys": [ "ctrl+shift+space" ] },
{ "command": "openSettings", "keys": [ "ctrl+," ] },
{ "command": "paste", "keys": [ "ctrl+shift+v" ] },
{ "command": "paste", "keys": [ "shift+insert" ] },
{ "command": "prevTab", "keys": [ "ctrl+shift+tab" ] },
{ "command": "resetFontSize", "keys": ["ctrl+0"]},
{ "command": { "action": "resizePane", "direction": "down" }, "keys": [ "alt+shift+down" ] },
{ "command": { "action": "resizePane", "direction": "left" }, "keys": [ "alt+shift+left" ] },
{ "command": { "action": "resizePane", "direction": "right" }, "keys": [ "alt+shift+right" ] },
{ "command": { "action": "resizePane", "direction": "up" }, "keys": [ "alt+shift+up" ] },
{ "command": "scrollDown", "keys": [ "ctrl+shift+down" ] },
{ "command": "scrollDownPage", "keys": [ "ctrl+shift+pgdn" ] },
{ "command": "scrollUp", "keys": [ "ctrl+shift+up" ] },
{ "command": "scrollUpPage", "keys": [ "ctrl+shift+pgup" ] },
{ "command": { "action": "splitPane", "split": "horizontal"}, "keys": [ "alt+shift+-" ] },
{ "command": { "action": "splitPane", "split": "vertical"}, "keys": [ "alt+shift+plus" ] },
{ "command": { "action": "switchToTab", "index": 0 }, "keys": ["ctrl+alt+1"] },
{ "command": { "action": "switchToTab", "index": 1 }, "keys": ["ctrl+alt+2"] },
{ "command": { "action": "switchToTab", "index": 2 }, "keys": ["ctrl+alt+3"] },
{ "command": { "action": "switchToTab", "index": 3 }, "keys": ["ctrl+alt+4"] },
{ "command": { "action": "switchToTab", "index": 4 }, "keys": ["ctrl+alt+5"] },
{ "command": { "action": "switchToTab", "index": 5 }, "keys": ["ctrl+alt+6"] },
{ "command": { "action": "switchToTab", "index": 6 }, "keys": ["ctrl+alt+7"] },
{ "command": { "action": "switchToTab", "index": 7 }, "keys": ["ctrl+alt+8"] },
{ "command": { "action": "switchToTab", "index": 8 }, "keys": ["ctrl+alt+9"] },
{ "command": "find", "keys": [ "ctrl+shift+f" ] },
{ "command": "toggleFullscreen", "keys": [ "alt+enter" ] },
{ "command": "toggleFullscreen", "keys": [ "f11" ] }
]
}
デフォルト設定を参考にカスタマイズできそうです。
設定方法についてのドキュメントは以下を参照とのこと。
terminal/index.md at master · microsoft/terminal
カスタマイズする事で作業の効率化が図れそうです。
正規リリース版が楽しみになってきました。
Windows Terminalの使い方概要は以上です。
コメント/ピンバック