cycold / cycold.github.io

Please dot not star...
4 stars 1 forks source link

Default (OSX).sublime-keymap #153

Closed cycold closed 6 years ago

cycold commented 6 years ago
/**
  按键命令详细: http://docs.sublimetext.info/en/latest/reference/commands.html
  这里的super等于Mac的command按键 
*/

[

  /** alt */
  // 触发侧边栏
  { "keys": ["alt+s"], "command": "toggle_side_bar" },
  // 打开侧边栏并且定位文件所在目录
  { "keys": ["alt+f"], "command": "reveal_in_side_bar"},
  // 打开finder并定位到当前文件在finder中的目录(打开当前文件所在的目录)
  { "keys": ["alt+o"], "command": "open_dir", "args": {"dir": "$file_path", "file": "$file_name"} },
  // 触发自动补全
  { "keys": ["alt+/"], "command": "auto_complete" },
  // 向上移动行:
  { "keys": ["alt+up"], "command": "swap_line_up" },
  // 向下移动行
  { "keys": ["alt+down"], "command": "swap_line_down" },
  // 复制当前行插入到下一行:
  { "keys": ["super+alt+down"], "command": "duplicate_line" },
  // 重新缩进 http://stackoverflow.com/questions/8839753/how-do-i-reformat-html-code-using-sublime-text-2
  { "keys": ["alt+r"], "command": "reindent" , "args": { "single_line": false } },
  // 切换选项Tab
  { "keys": ["alt+tab"], "command": "next_view_in_stack" },
  { "keys": ["alt+super+tab"], "command": "prev_view_in_stack" },

  /** super */
  // 查找并选择下一个
  { "keys": ["super+d"], "command": "find_under_expand" },
  // 查找全部
  { "keys": ["super+g"], "command": "find_all_under" },
  // 设置缩进 sublime 也支持 shift + tab 缩进
  { "keys": ["super+]"], "command": "indent" },
  { "keys": ["super+["], "command": "unindent" },
  // 连接行
  { "keys": ["super+j"], "command": "join_lines" },
  // 粘贴时自动格式化
  { "keys": ["super+shift+v"], "command": "paste_and_indent" },
  // 插入新行
  { "keys": ["super+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line.sublime-macro"} },
  // 插入新行到光标所在行之上
  { "keys": ["super+shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line Before.sublime-macro"} },

  /** 以下快捷键需要安装或者启用相应的插件 */
  // 需要安装vintage(或者enable vintage) map ii to Esc in insert mode 连按jj进入命令模式
  // https://github.com/sublimehq/Vintage
  // Vintage sublimeText自己已经安装了
  { "keys": ["j", "j"],
      "command": "exit_insert_mode",
      "context":
      [
        { "key": "setting.command_mode", "operand": false },
        { "key": "setting.is_widget", "operand": false }
      ]
  },

  // 插件 alignment 快捷键 https://github.com/wbond/sublime_alignment/issues
  { "keys": ["shift+alt+a"], "command": "alignment" },

  // 使能Emmet在react的jsx文件中: http://stackoverflow.com/questions/26089802/in-sublime-text-3-how-do-you-enable-emmet-for-jsx-files
  { "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
    [
      { "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
      { "match_all": true, "key": "selection_empty" },
      { "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
      { "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
      { "match_all": true, "key": "is_abbreviation" }
    ]
  },

]