Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sublime custom settings and key mapping
// Selects all instances of current selection. This already exists under ctrl+super+g but is hard to press/remember, whereas this is just an extension of super+a (select all), add shift to select duplicates.
{ "keys": ["super+shift+a"], "command": "find_all_under" },
// Converts all tabs to spaces and sets indentation for the file to spaces.
{ "keys": ["super+shift+i"], "command": "expand_tabs", "args": { "set_translate_tabs": true } },
// Unbinds Quit so that I don't accidentally close everything when trying to close 1 file (super+w). If the whole window closes I also lose undo history, which can be annoying.
{ "keys": ["super+q"], "command": "unbound" },
// Toggles word-wrap on/off. You can also force it to default on/off in settings.
{ "keys": ["alt+w"], "command": "toggle_setting", "args": { "setting": "word_wrap" } },
// Opens Goto with @ which targets function names.
{ "keys": ["super+r"], "command": "go_to_selection" },
// You can open settings with super+, why not open key-bindings with super+.
{ "keys": ["super+."], "command": "open_file", "args": {"file": "${packages}/User/Default (OSX).sublime-keymap"} }
// I don't use super+1 to select the first tab, so was experimenting using "bookmarks"
// { "keys": ["super+1"], "command": "next_bookmark" },
// { "keys": ["super+2"], "command": "prev_bookmark" },
// { "keys": ["super+3"], "command": "toggle_bookmark" },
// { "keys": ["super+4"], "command": "clear_bookmarks" },
// { "keys": ["super+5"], "command": "select_all_bookmarks" }
// It’s not a big deal, but this subtle highlight of where in the minimap you’re looking is quite useful.
"always_show_minimap_viewport": true,
// This lets you ignore files or folders when using Goto (super+t) or find in folder (super+shift+f), removing stuff you don't care about and making these function faster. There's also `index_exclude_patterns` but I couldn't get it to ignore node_modules.
"node_modules/**", "bower_components/**", "dist/**", "runtime/**", "tmp/**", "*.min.*", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"
// Makes files and folders stand out from each other
"bold_folder_labels": true,
// Set to your preference, but only if you want to enable spell_check
"dictionary": "Packages/Language - English/en_GB.dic",
// Particularly useful when working with different projects and different standards between spaces and tabs. It may look messy or distracting initially, but you’ll soon just see it as white-space with extra information.
"draw_white_space": "all",
// I like my tabs to stay in relatively static positions like in web browsers. With this on (default) opening too many tabs will make the top tab bar scroll left/right, hiding tabs that have scrolled off screen.
"enable_tab_scrolling": false,
// Keeps my files consistent, though the same can be done with .editorconfig
"ensure_newline_at_eof_on_save": true,
// Will copy the highlighted text into the search box when opening find (super+f). Older versions had this enabled by default.
"find_selected_text": true,
// Make changed tabs more obvious
"highlight_modified_tabs": true,
// My eyes aren't what they used to be
"line_padding_top": 1,
// Particularly useful for complex attribute-wranglers like Angular and some PHP templates.
"match_brackets_angle": true,
// I sometimes like to open project files from command line (subl package.json) and want them in the window already open.
"open_files_in_new_window": false,
// Make shift+tab always un-indent the line, instead of inserting a tab if you're not at the start of the line. If you use auto completion and expect shift+tab to insert a tab instead of using the auto-complete suggestion, this will change that behaviour (you can just hit escape to remove suggestion, then tab).
"shift_tab_unindent": true,
// Gives more context, useful for projects that have the same named file in different locations e.g. search/index.js and list/index.js
"show_full_path": true,
// Sure, it underlines some code-related items, but saves my ass in comments and template wording.
"spell_check": true,
// Keeps my files clean. Can be done with .editorconfig. May make unintended changes in messier open-source projects, but I usually `git add --patch` and skip over white-space changes.
"trim_trailing_white_space_on_save": true
// Remove $ from separators to allow selecting the dollar-sign part of PHP/jQuery variables when double-clicking etc. e.g. `$allThis` instead of $`justThis`. This can also be language specific, e.g. save this in a file called `PHP.sublime-settings` in your `Packages/User` folder.
// "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment