2021年1月20日水曜日

Windows Terminal すべてのキー割り当てを解除するためのKeybindingsデータ

 Widnows Terminalでは、デフォルトのキー割り当てがあるのだが、機能が多い分、多数のキー割り当てが使われている。しかし、キー割り当ては、Windows Terminal内部でのデフォルト値として設定されているため、解除するには、個々にunbindコマンドで割り当てを解除する方法しかない。そこで、すべてのキー割り当てを解除するsetings.jsonの“Keybindings”セクションを作った。

 これをsettings.jsonにある、"Keybindings"に置き換えると、Ctrl+Shift+P以外のキー割り当てがすべて解除される。デフォルトのキー設定が必要な場合には、その行を「//」を使って注釈行とすることで、デフォルト設定が有効になり、キー割り当てが有効になる。

 たとえば、クリップボードのコピー("action": "copy")は、デフォルトではCtrl+Cに割り当ててあるが、それは、

{ "command": "unbind", "keys": "ctrl+c" }, // {"action": "copy", "singleLine": false }  = ctrl+c

としてある。この行の先頭に「//」を付ければ、注釈になり、デフォルトのCtrl+Cが有効になる。

 Keybindingsセクションはキーコード順に並べてある。これは、キーから探すことが多いと考えられるからだ。元の機能は同じ行にCommand:やActionを注釈でつけているので、機能から探すときには、JSONエディタ側の検索機能を使う。

 全部unbindしてしまうと困るだろうからコマンドパレット(commandPalette)の割り当てであるCtrl+Shift+pだけは有効にしてある。なお、Windows Terminalのキー割り当てなどについては、以下の記事を参考にしてほしい。

【Windows Terminal完全マスター】プロファイルにキーボードショートカットを設定する:Windows 10 The Latest - @IT

Windows Terminalの設定に関しては、以下の記事がある。

【Windows Terminal完全マスター】プロファイルをカスタマイズして使いやすくしよう


Keybindingsのリスト

"keybindings":
[
	//{ "command": "unbind", "keys": "ctrl+shift+p" }, // commandPalette = ctrl+shift+p
	{ "command": "unbind", "keys": "ctrl+," }, // openSettings  = ctrl+,
	//
	{ "command": "unbind", "keys": "ctrl+c" }, // {"action": "copy", "singleLine": false }  = ctrl+c
	{ "command": "unbind", "keys": "ctrl+v" }, // paste  = ctrl+v
	//
	{ "command": "unbind", "keys": "alt+down" }, // { "action": "moveFocus", "direction": "down" }  = alt+down
	{ "command": "unbind", "keys": "alt+enter" }, // toggleFullscreen  = alt+enter
	{ "command": "unbind", "keys": "alt+f4" }, // closeWindow  = alt+f4
	{ "command": "unbind", "keys": "alt+left" }, // { "action": "moveFocus", "direction": "left" }  = alt+left
	{ "command": "unbind", "keys": "alt+right" }, // { "action": "moveFocus", "direction": "right" }  = alt+right
	{ "command": "unbind", "keys": "alt+shift+-" }, // { "action": "splitPane", "split": "horizontal" }  = alt+shift+-
	{ "command": "unbind", "keys": "alt+shift+d" }, // { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }  = alt+shift+d
	{ "command": "unbind", "keys": "alt+shift+down" }, // { "action": "resizePane", "direction": "down" }  = alt+shift+down
	{ "command": "unbind", "keys": "alt+shift+home" }, // {"command":"togglePaneZoom","keys":"alt+shift+home"},
	{ "command": "unbind", "keys": "alt+shift+left" }, // { "action": "resizePane", "direction": "left" }  = alt+shift+left
	{ "command": "unbind", "keys": "alt+shift+plus" }, // { "action": "splitPane", "split": "vertical" }  = alt+shift+plus
	{ "command": "unbind", "keys": "alt+shift+right" }, // { "action": "resizePane", "direction": "right" }  = alt+shift+right
	{ "command": "unbind", "keys": "alt+shift+up" }, // { "action": "resizePane", "direction": "up" }  = alt+shift+up
	{ "command": "unbind", "keys": "alt+up" }, // { "action": "moveFocus", "direction": "up" }  = alt+up
	{ "command": "unbind", "keys": "ctrl+-" }, // { "action": "adjustFontSize", "delta": -1 }  = ctrl+-
	{ "command": "unbind", "keys": "ctrl+0" }, // resetFontSize  = ctrl+0
	{ "command": "unbind", "keys": "ctrl+=" }, // { "action": "adjustFontSize", "delta": 1 }  = ctrl+=
	{ "command": "unbind", "keys": "ctrl+alt+," }, // { "action": "openSettings", "target": "defaultsFile" }  = ctrl+alt+,
	{ "command": "unbind", "keys": "ctrl+alt+1" }, // { "action": "switchToTab", "index": 0 }  = ctrl+alt+1
	{ "command": "unbind", "keys": "ctrl+alt+2" }, // { "action": "switchToTab", "index": 1 }  = ctrl+alt+2
	{ "command": "unbind", "keys": "ctrl+alt+3" }, // { "action": "switchToTab", "index": 2 }  = ctrl+alt+3
	{ "command": "unbind", "keys": "ctrl+alt+4" }, // { "action": "switchToTab", "index": 3 }  = ctrl+alt+4
	{ "command": "unbind", "keys": "ctrl+alt+5" }, // { "action": "switchToTab", "index": 4 }  = ctrl+alt+5
	{ "command": "unbind", "keys": "ctrl+alt+6" }, // { "action": "switchToTab", "index": 5 }  = ctrl+alt+6
	{ "command": "unbind", "keys": "ctrl+alt+7" }, // { "action": "switchToTab", "index": 6 }  = ctrl+alt+7
	{ "command": "unbind", "keys": "ctrl+alt+8" }, // { "action": "switchToTab", "index": 7 }  = ctrl+alt+8
	{ "command": "unbind", "keys": "ctrl+alt+9" }, // { "action": "switchToTab", "index": 8 }  = ctrl+alt+9
	{ "command": "unbind", "keys": "ctrl+insert" }, // { "action": "copy", "singleLine": false }  = ctrl+insert
	{ "command": "unbind", "keys": "ctrl+shift+1" }, // { "action": "newTab", "index": 0 }  = ctrl+shift+1
	{ "command": "unbind", "keys": "ctrl+shift+2" }, // { "action": "newTab", "index": 1 }  = ctrl+shift+2
	{ "command": "unbind", "keys": "ctrl+shift+3" }, // { "action": "newTab", "index": 2 }  = ctrl+shift+3
	{ "command": "unbind", "keys": "ctrl+shift+4" }, // { "action": "newTab", "index": 3 }  = ctrl+shift+4
	{ "command": "unbind", "keys": "ctrl+shift+5" }, // { "action": "newTab", "index": 4 }  = ctrl+shift+5
	{ "command": "unbind", "keys": "ctrl+shift+6" }, // { "action": "newTab", "index": 5 }  = ctrl+shift+6
	{ "command": "unbind", "keys": "ctrl+shift+7" }, // { "action": "newTab", "index": 6 }  = ctrl+shift+7
	{ "command": "unbind", "keys": "ctrl+shift+8" }, // { "action": "newTab", "index": 7 }  = ctrl+shift+8
	{ "command": "unbind", "keys": "ctrl+shift+9" }, // { "action": "newTab", "index": 8 }  = ctrl+shift+9
	{ "command": "unbind", "keys": "ctrl+shift+c" }, // { "action": "copy", "singleLine": false }  = ctrl+shift+c
	{ "command": "unbind", "keys": "ctrl+shift+d" }, // duplicateTab  = ctrl+shift+d
	{ "command": "unbind", "keys": "ctrl+shift+down" }, // scrollDown  = ctrl+shift+down
	{ "command": "unbind", "keys": "ctrl+shift+f" }, // find  = ctrl+shift+f
	{ "command": "unbind", "keys": "ctrl+shift+pgdn" }, // scrollDownPage  = ctrl+shift+pgdn
	{ "command": "unbind", "keys": "ctrl+shift+pgup" }, // scrollUpPage  = ctrl+shift+pgup
	{ "command": "unbind", "keys": "ctrl+shift+space" }, // openNewTabDropdown  = ctrl+shift+space
	{ "command": "unbind", "keys": "ctrl+shift+t" }, // newTab  = ctrl+shift+t
	{ "command": "unbind", "keys": "ctrl+shift+tab" }, // prevTab  = ctrl+shift+tab
	{ "command": "unbind", "keys": "ctrl+shift+up" }, // scrollUp  = ctrl+shift+up
	{ "command": "unbind", "keys": "ctrl+shift+v" }, // paste  = ctrl+shift+v
	{ "command": "unbind", "keys": "ctrl+shift+w" }, // closePane ctrl+shift+w
	{ "command": "unbind", "keys": "ctrl+tab" }, // nextTab  = ctrl+tab
	{ "command": "unbind", "keys": "f11" }, // toggleFullscreen  = f11
	{ "command": "unbind", "keys": "shift+insert" }, // paste  = shift+insert
	{ "command": "unbind"}
]

0 件のコメント:

コメントを投稿