LoginSignup
6

More than 5 years have passed since last update.

sublime text3内のタブでターミナルを開くにはTerminalViewが便利

Posted at

pythonなんかを書いていていちいちターミナルから実行するのがめんどいかつsublimeからは離れたくない場合TerminalViewというパッケージが便利
他にも、TerminalとかSublimeREPLとか色々あったけど、使いにくいもしくは古いといことがあったので今回はやめた。
※(日本語使う場面ない人には関係ないが)TerminalViewを使いサブライム内のウィンドウでterminalを開くと日本語入力ができない&表示が文字化けするという問題を発見。コマンド打てば一時的には直るけど、再度開くたびにせっていしなきゃならないのはめんどい。どなたか解決法をご教示ください。。

package controllに入っているので入れるのもかんたん。

1.package controll(command + shit + p)を開く
2.install packageを選択
3.TerminalViewを選択

起動はpackage controll(command + shit + p)でTerminalView(他に似たような名前のパッケージ入れてなければterとかだけで絞れる)を選択する作業中のファイルのディレクトリをカレントディレクトリとしてターミナルが開かれる

ただ、そのままだとcommand + c とかcommand + vでコピペとかができないのでちょっと不便。そんなときは
Preferences→Package Setting→TerminalView→Keybindingsを開き
Defaultの下記の部分をコピペし

    // Utility keybindings
    {"keys": ["ctrl+shift+t"], "command": "new_file", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+n"], "command": "new_file", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+q"], "command": "close", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+w"], "command": "close", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["shift+pageup"], "command": "terminal_view_scroll", "args": {"forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["shift+pagedown"], "command": "terminal_view_scroll", "args": {"forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+v"], "command": "terminal_view_paste", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+c"], "command": "terminal_view_copy", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "characters", "forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+up"], "command": "move", "args": {"by": "lines", "forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+down"], "command": "move", "args": {"by": "lines", "forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bol", "extend": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eol", "extend": false}, "context": [{"key": "setting.terminal_view"}]},

Userのほうに下記のように書き換えたものを保存する。
そうするとUserの設定が優先されるので、commandベースでコピペができる
(もっと適切な設定の仕方ありそうだけど)

[
    // Utility keybindings
    {"keys": ["command+t"], "command": "new_file", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+n"], "command": "new_file", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+q"], "command": "close", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+w"], "command": "close", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["shift+pageup"], "command": "terminal_view_scroll", "args": {"forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["shift+pagedown"], "command": "terminal_view_scroll", "args": {"forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+v"], "command": "terminal_view_paste", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+c"], "command": "terminal_view_copy", "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+left"], "command": "move", "args": {"by": "characters", "forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+right"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+up"], "command": "move", "args": {"by": "lines", "forward": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+down"], "command": "move", "args": {"by": "lines", "forward": true}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+home"], "command": "move_to", "args": {"to": "bol", "extend": false}, "context": [{"key": "setting.terminal_view"}]},
    {"keys": ["command+end"], "command": "move_to", "args": {"to": "eol", "extend": false}, "context": [{"key": "setting.terminal_view"}]},
]

まだ入れたばかりなので、なんかあれば都度追記します。

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
6