Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
There are many things I love from emacs navigation only inside code, so here I have a frankenstein version of those navigation commands plus others custom
[
// Delete line
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
// Find under expand
{ "keys": ["ctrl+shift+k"], "command": "find_under_expand" },
// Change workspace
{ "keys": ["ctrl+alt+shift+p"], "command": "prompt_select_workspace" },
{ "keys": ["ctrl+alt+shift+h"], "command": "show_scope_name" },
// Emacs Like Stuff
// Move scrolll up and down
{ "keys": ["alt+shift+p"], "command": "scroll_lines", "args": {"amount": 1.0 } },
{ "keys": ["alt+shift+n"], "command": "scroll_lines", "args": {"amount": -1.0 } },
// Go to start of line
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} },
// Go to end of line
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} },
// Move cursor left, right, up, down
{ "keys": ["ctrl+b"], "command": "move", "args": {"by": "characters", "forward": false} },
{ "keys": ["ctrl+f"], "command": "move", "args": {"by": "characters", "forward": true} },
{ "keys": ["ctrl+p"], "command": "move", "args": {"by": "lines", "forward": false} },
{ "keys": ["ctrl+n"], "command": "move", "args": {"by": "lines", "forward": true} },
// New line
{ "keys": ["ctrl+m"], "command": "insert", "args": {"characters": "\n"} },
// Right delete
{ "keys": ["alt+shift+d"], "command": "right_delete" },
// Jump word left and right
{ "keys": ["alt+b"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["alt+f"], "command": "move", "args": {"by": "word_ends", "forward": true} },
// Text selection
{ "keys": ["alt+shift+f"], "command": "move", "args": { "by": "characters", "forward": true, "extend": true } },
{ "keys": ["alt+shift+b"], "command": "move", "args": { "by": "characters", "forward": false, "extend": true } },
{ "keys": ["alt+p"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+n"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["ctrl+m"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }
]
},
// fixing commands replaced by emacs by adding an extra alt key
{ "keys": ["ctrl+shift+a"], "command": "select_all" },
{ "keys": ["ctrl+alt+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+alt+f"], "command": "show_panel", "args": {"panel": "find", "reverse": false} },
{ "keys": ["ctrl+alt+n"], "command": "new_file" },
{ "keys": ["ctrl+alt+b"], "command": "build" },
{ "keys": ["ctrl+alt+m"], "command": "move_to", "args": {"to": "brackets"} },
{ "keys": ["ctrl+}"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["shift+alt+space"], "command": "code_intel_auto_complete" },
{ "keys": ["alt+shift+a"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["alt+shift+e"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["alt+d"], "command": "delete_word", "args": { "forward": true } },
]
[
{ "key": "ctrl+d", "command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly" },
// Navigation
{ "key": "alt+shift+n", "command": "scrollLineDown",
"when": "editorTextFocus" },
{ "key": "alt+shift+p", "command": "scrollLineUp",
"when": "editorTextFocus" },
{ "key": "ctrl+a", "command": "cursorHome",
"when": "editorTextFocus" },
{ "key": "ctrl+e", "command": "cursorEnd",
"when": "editorTextFocus" },
{ "key": "ctrl+p", "command": "cursorUp",
"when": "editorTextFocus" },
{ "key": "ctrl+n", "command": "cursorDown",
"when": "editorTextFocus" },
{ "key": "ctrl+b", "command": "cursorLeft",
"when": "editorTextFocus" },
{ "key": "ctrl+f", "command": "cursorRight",
"when": "editorTextFocus" },
{ "key": "alt+shift+d", "command": "deleteRight",
"when": "editorTextFocus && !editorReadonly" },
{ "key": "alt+b", "command": "cursorWordStartLeft",
"when": "editorTextFocus" },
{ "key": "alt+f", "command": "cursorWordEndRight",
"when": "editorTextFocus" },
// Text Selection
{ "key": "alt+shift+f", "command": "cursorRightSelect",
"when": "editorTextFocus" },
{ "key": "alt+shift+b", "command": "cursorLeftSelect",
"when": "editorTextFocus" },
{ "key": "alt+shift+e", "command": "cursorEndSelect",
"when": "editorTextFocus" },
{ "key": "alt+shift+a", "command": "cursorHomeSelect",
"when": "editorTextFocus" },
{ "key": "ctrl+l", "command": "cursorDownSelect",
"when": "editorTextFocus" },
// Duplicate line
{ "key": "ctrl+shift+d", "command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly" },
// Simulating enter
{ "key": "ctrl+m", "command": "macros.coolLineBreak"},
// { "key": "ctrl+m", "command": "breakpointWidget.action.acceptInput",
// "when": "breakpointWidgetVisible && inBreakpointWidget" },
// { "key": "ctrl+m", "command": "repl.action.acceptInput",
// "when": "inDebugRepl && textInputFocus" },
// { "key": "ctrl+m", "command": "settings.action.focusNextSetting",
// "when": "inSettingsSearch" },
// { "key": "ctrl+m", "command": "acceptSelectedSuggestionOnEnter",
// "when": "acceptSuggestionOnEnter && suggestWidgetVisible && suggestionMakesTextEdit && textInputFocus" },
// { "key": "ctrl+m", "command": "acceptRenameInput",
// "when": "editorFocus && renameInputVisible" },
// { "key": "ctrl+m", "command": "list.select",
// "when": "listFocus && !inputFocus" },
// { "key": "ctrl+m", "command": "notification.toggle",
// "when": "notificationFocus" },
// Fixing
{ "key": "ctrl+shift+a", "command": "editor.action.selectAll" },
{ "key": "ctrl+alt+p", "command": "workbench.action.quickOpen" },
{ "key": "ctrl+alt+n", "command": "workbench.action.files.newUntitledFile" },
{ "key": "ctrl+alt+f", "command": "actions.find" }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.