0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeでtmuxの挙動を再現したい

Posted at

tmuxでのペインを作ったり消したり切り替えたりの動作を、VSCodeでもそれっぽく再現するために設定した項目をさらします。

tmuxのデフォルトのプレフィクスがctrl+bなので、その設定でtmuxを操作しているときと同じような挙動をするようにkeybindings.jsonに以下の設定を加えました

ペイン


// エディタとターミナルの移動
{
    "key": "ctrl+b o",
    "command": "workbench.action.terminal.focus",
    "when": "editorFocus"
},
{
    "key": "ctrl+b o",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "terminalFocus"
},
// ターミナルの分割(縦のみ)
{
    "key": "ctrl+b shift+'",
    "command": "workbench.action.terminal.splitInActiveWorkspace"
},
// 一時的にエディタ、もしくはターミナルを全画面で表示する
{
   "key": "ctrl+b z",
    "command": "workbench.action.toggleMaximizedPanel",
    "when": "terminalFocus"
},
{
    "key": "ctrl+b z",
    "command": "workbench.action.togglePanel",
    "when": "editorFocus"
},
// ペインを閉じる
{
    "key": "ctrl+b x",
    "command": "workbench.action.terminal.kill",
    "when": "terminalFocus"
},
// 上下ペインのリサイズをAlt-UpとAlt-Downに割り当てた場合
{
    "key": "alt+up",
    "command": "workbench.action.terminal.resizePaneUp"
},
{
    "key": "alt+down",
    "command": "workbench.action.terminal.resizePaneDown"
},

ウィンドウ(ターミナルの切り替え)

// 新規ターミナル作成
{
    "key": "ctrl+b c",
    "command": "workbench.action.terminal.new"
},
// ターミナルの切り替え (next, previous)
{
    "key": "ctrl+b n",
    "command": "workbench.action.terminal.focusNext"
},
{
    "key": "ctrl+b p",
    "command": "workbench.action.terminal.focusPrevious"
},
// ウィンドウ一覧(tmuxでいうsessionの一覧)
{
    "key": "ctrl+s",
    "command": "workbench.action.terminal.findNext",
},

これで少なくともペインとウィンドウの切り替えはそれっぽく模倣できましたが、tmuxはそもそもsessionが扱えるのが便利なんですが

0
1
0

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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?