LoginSignup
27
28

More than 5 years have passed since last update.

SublimeTextの僕ショートカット設定

Last updated at Posted at 2014-04-24

大体何となくEmacsっぽく使いたくて色々いじってみた結果こんな感じのキーバインド設定になった。

まだ検索関連とか良い感じとは言い難い挙動だから改良の余地ありまくりなんだけど今んとここれで落ち着いてる。

サイドバーのキーバインドは SideBarEnhancements 入れないと効かない。つかこれあるとないとじゃ全然違うし多分必須パッケージですよね。

あとST3になって出たらしい機能の goto_definition が便利すぎて泣ける。メソッド定義元が別ファイルでも一発で探し当ててくれる。マジこれヤバい。

[
  {}

  // -------------------------------------------
  // Cursor move
  // -------------------------------------------

  // 右に1つ移動
  ,{ "keys": ["cltr+f"], "command": "move", "args": {
    "by": "characters", "forward": true}
  }

  // 左に1つ移動
  ,{ "keys": ["cltr+b"], "command": "move", "args": {
    "by": "characters", "forward": false}
  }

  // 下に1つ移動
  ,{ "keys": ["cltr+n"], "command": "move", "args": {
    "by": "lines", "forward": true}
  }

  // 上に1つ移動
  ,{ "keys": ["cltr+p"], "command": "move", "args": {
    "by": "lines", "forward": false}
  }

  // 1単語右に移動
  ,{ "keys": ["alt+f"], "command": "move", "args": {
    "by": "words", "forward": true}
  }

  // 1単語左に移動
  ,{ "keys": ["alt+b"], "command": "move", "args": {
    "by": "words", "forward": false}
  }

  // 行頭に移動
  ,{ "keys": ["ctrl+a"], "command": "move_to", "args": {
    "to": "hardbol"}
  }

  // 行末に移動
  ,{ "keys": ["ctrl+e"], "command": "move_to", "args": {
    "to": "hardeol"}
  }

  // ファイルの先頭に移動
  ,{ "keys": ["ctrl+super+p"], "command": "move_to", "args": {
    "to": "bof", "extend": false}
  }

  // ファイルの最後に移動
  ,{ "keys": ["ctrl+super+n"], "command": "move_to", "args": {
    "to": "eof", "extend": false}
  }

  // 1ページ下にスクロール
  ,{ "keys": ["ctrl+v"], "command": "move", "args": {
    "by": "pages", "forward": true}
  }

  // 1ページ上にスクロール
  ,{ "keys": ["alt+v"], "command": "move", "args": {
    "by": "pages", "forward": false}
  }




  // -------------------------------------------
  // Selection
  // -------------------------------------------

  // 選択しつつ上にカーソル移動
  ,{ "keys": ["ctrl+shift+p"], "command": "move", "args": {
    "by": "lines", "forward": false, "extend":true}
  }

  // 選択しつつ下にカーソル移動
  ,{ "keys": ["ctrl+shift+n"], "command": "move", "args": {
    "by": "lines", "forward": true, "extend":true}
  }

  // 選択しつつ右にカーソル移動
  ,{ "keys": ["ctrl+shift+f"], "command": "move", "args": {
    "by": "characters", "forward": true, "extend":true}
  }

  // 選択しつつ左にカーソル移動
  ,{ "keys": ["ctrl+shift+b"], "command": "move", "args": {
    "by": "characters", "forward": false, "extend":true}
  }

  // 全選択
  ,{ "keys": ["ctrl+x", "h"], "command": "select_all" }


  // クオート内を選択
  ,{ "keys": ["ctrl+r"],  "command": "select_quoted" }



  // -------------------------------------------
  // Edit
  // -------------------------------------------

  // インデントを1段階増やす
  ,{ "keys": ["ctrl+]"], "command": "indent"}

  // インデントを1段階減らす
  ,{ "keys": ["ctrl+["], "command": "unindent"}


  // カーソルの右を1つ削除
  ,{ "keys": ["ctrl+d"], "command": "right_delete"}

  // カーソルの左を1つ削除
  ,{ "keys": ["ctrl+h"], "command": "left_delete"}


  // 改行
  ,{ "keys": ["ctrl+m"], "command": "insert", "args": {
    "characters": "\n"}
  }


  // 行の複製
  ,{ "keys": ["ctrl+shift+d"], "command": "duplicate_line" }


  // 今のカーソル行と上の行を入れ替える
  ,{ "keys": ["ctrl+alt+p"], "command": "swap_line_up" }

  // 今のカーソル行と下の行を入れ替える
  ,{ "keys": ["ctrl+alt+n"], "command": "swap_line_down" }


  // カット
  ,{ "keys": ["alt+w"],  "command": "cut" }

  // コピー
  ,{ "keys": ["ctrl+w"], "command": "copy" }

  // ペースト
  ,{ "keys": ["ctrl+y"], "command": "paste" }


  // やり直し
  ,{ "keys": ["ctrl+u"], "command": "undo" }

  // やり直しのやり直し
  ,{ "keys": ["alt+u"],  "command": "redo_or_repeat" }


  // カーソル位置を戻す
  ,{ "keys": ["ctrl+shift+u"], "command": "soft_undo" }

  // カーソル位置を戻す前に戻す
  ,{ "keys": ["alt+shift+u"], "command": "soft_redo" }




  // -------------------------------------------
  // Find
  // -------------------------------------------

  // 検索パネルを表示
  ,{ "keys": ["ctrl+s"], "command": "show_panel", "args": {"panel": "find"} }

  // 次を検索
  ,{ "keys": ["ctrl+s"], "command": "find_under", "args": {"panel": "find"},
    "context":
    [
      { "key": "panel_visible", "operator": "equal", "operand": true }
    ]
  }

  // 前を検索
  ,{ "keys": ["alt+s"], "command": "find_under_prev", "args": {"panel": "find"},
    "context":
    [
      { "key": "panel_visible", "operator": "equal", "operand": true }
    ]
  }




  // -------------------------------------------
  // Files Tabs Windows
  // -------------------------------------------
  // ファイル保存
  ,{ "keys": ["ctrl+x", "ctrl+s"], "command": "save" }

  // ファイルを開く(Goto Anything)
  ,{ "keys": ["ctrl+x","ctrl+f"], "command": "show_overlay", "args":
    {"overlay": "goto", "show_files": true}
  }

  // ファイルを閉じる
  ,{ "keys": ["ctrl+x", "k"], "command": "close" }


  // 次のタブに移る
  ,{ "keys": ["ctrl+tab"], "command": "next_view" }

  // 前のタブに移る
  ,{ "keys": ["shift+ctrl+tab"], "command": "prev_view" }


  // ウィンドウを閉じる
  ,{ "keys": ["super+ctrl+w"], "command": "close_window" }


  // プロジェクトを閉じる(ウィンドウは残る)
  ,{ "keys": ["super+shift+w"], "command": "close_project" }



  // -------------------------------------------
  // settings
  // -------------------------------------------
  // ユーザーキーバインド設定ファイルを開く
  ,{ "keys": ["super+shift+,"], "command": "open_file", "args":
    {"file": "${packages}/User/Default ($platform).sublime-keymap"}
  }



  // -------------------------------------------
  // MarkDown
  // -------------------------------------------

  // Markdownをプレビュー
  ,{ "keys": ["alt+m"], "command": "markdown_preview", "args":
    {"target": "sublime", "parser": "markdown"}
  }



  // -------------------------------------------
  // Dash
  // -------------------------------------------

  // Dashで開く
  ,{ "keys": ["super+ctrl+h"], "command": "dash_doc"}



  // -------------------------------------------
  // sidebar * SidebarEnhancement が必要
  // -------------------------------------------

  // 新規フォルダを作成
  ,{ "keys": ["super+shift+n"], "command": "side_bar_new_directory", "args": {
    "paths": []}
  }

  // 新規ファイルを作成
  ,{ "keys": ["super+shift+t"], "command": "side_bar_new_file" }

  // ファイル名変更
  ,{ "keys": ["super+shift+r"], "command": "side_bar_rename" }

  // ファイルの複製
  ,{ "keys": ["super+shift+d"], "command": "side_bar_duplicate" }

  // ファイルの移動
  ,{ "keys": ["super+shift+m"], "command": "side_bar_move" }

  // ブラウザで開く
  ,{ "keys": ["super+ctrl+e"],  "command": "side_bar_open_in_browser" }



  // -------------------------------------------
  // escape replace to Ctrl+G
  // -------------------------------------------

  // キャンセル
  ,{ "keys": ["ctrl+g"], "command": "cancel" }
  ,{ "keys": ["ctrl+g"], "command": "single_selection", "context":
    [
      { "key": "num_selections", "operator": "not_equal", "operand": 1 }
    ]
  }
  ,{ "keys": ["ctrl+g"], "command": "clear_fields", "context":
    [
      { "key": "has_next_field", "operator": "equal", "operand": true }
    ]
  }
  ,{ "keys": ["ctrl+g"], "command": "clear_fields", "context":
    [
      { "key": "has_prev_field", "operator": "equal", "operand": true }
    ]
  }
  ,{ "keys": ["ctrl+g"], "command": "hide_panel", "args": {"cancel": true},
    "context":
    [
      { "key": "panel_visible", "operator": "equal", "operand": true }
    ]
  }
  ,{ "keys": ["ctrl+g"], "command": "hide_overlay", "context":
    [
      { "key": "overlay_visible", "operator": "equal", "operand": true }
    ]
  }
  ,{ "keys": ["ctrl+g"], "command": "hide_auto_complete", "context":
    [
      { "key": "auto_complete_visible", "operator": "equal", "operand": true }
    ]
  }


  // -------------------------------------------
  // jump
  // -------------------------------------------

  // 行ジャンプ
  ,{ "keys": ["super+g"], "command": "show_overlay", "args": {
    "overlay": "goto", "text": ":"}
  }




  // -------------------------------------------
  // Define
  // -------------------------------------------

  // 定義元へジャンプ
  ,{ "keys": ["f3"], "command": "goto_definition" }

  // ジャンプを戻る
  ,{ "keys": ["alt+left"], "command": "jump_back" }

  // ジャンプを進む
  ,{ "keys": ["alt+right"], "command": "jump_forward" }



  // -------------------------------------------
  // SublimeSFTP
  // -------------------------------------------

  // ファイルをアップロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+f"], "command": "sftp_upload_file" }

  // フォルダをアップロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+r"], "command": "sftp_upload_folder" }

  // 同期してアップ
  ,{ "keys": ["super+ctrl+u","super+ctrl+y"], "command": "sftp_sync_up" }

  // 開いてるファイルをアップロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+n"], "command": "sftp_upload_open_files" }

  // モニタリング開始
  ,{ "keys": ["super+ctrl+u","super+ctrl+m"], "command": "sftp_monitor_file" }

  // ファイルをダウンロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+o"], "command": "sftp_download_file" }

  // フォルダをダウンロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+e"], "command": "sftp_download_folder" }

  // 同期してダウンロード
  ,{ "keys": ["super+ctrl+u","super+ctrl+d"], "command": "sftp_sync_down" }

  // リモートとの差分を見る
  ,{ "keys": ["super+ctrl+u","super+ctrl+i"], "command": "sftp_diff_remote_file" }

  // リモートとローカルを同期
  ,{ "keys": ["super+ctrl+u","super+ctrl+b"], "command": "sftp_sync_both" }
  ,{ "keys": ["super+ctrl+u","super+ctrl+c"], "command": "sftp_vcs_changed_files" }
  ,{ "keys": ["super+ctrl+u","super+ctrl+w"], "command": "sftp_browse" }
  ,{ "keys": ["super+ctrl+r","super+ctrl+s"], "command": "sftp_create_server" }

  ,{ "keys": ["super+ctrl+r","super+ctrl+b"], "command": "sftp_browse_server" }
  ,{ "keys": ["super+ctrl+r","super+ctrl+n"], "command": "sftp_last_server" }
  ,{ "keys": ["super+ctrl+r","super+ctrl+e"], "command": "sftp_edit_server" }
  ,{ "keys": ["super+ctrl+r","super+ctrl+d"], "command": "sftp_delete_server" }

  ,{ "keys": ["super+ctrl+u","super+ctrl+s"], "command": "sftp_show_panel" }
  ,{ "keys": ["super+ctrl+u","super+ctrl+x"], "command": "sftp_cancel_upload" }
  ,{ "keys": ["super+ctrl+u","super+ctrl+i"], "command": "sftp_switch_config", "args": {
    "paths": []}
  }
]
27
28
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
27
28