Skip to content

Instantly share code, notes, and snippets.

@mihirsoni
Last active July 28, 2019 09:26
Show Gist options
  • Save mihirsoni/d9a24e111c57d39e5697660d237e55c8 to your computer and use it in GitHub Desktop.
Save mihirsoni/d9a24e111c57d39e5697660d237e55c8 to your computer and use it in GitHub Desktop.
My Sublime Text Config

A fresh Installation for Sublime Text

  • Download and install Sublime Text 3

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can livesearch through. Watch the Status Bar for installation progress.

Install Theme

Install Ocean Next Theme for some good UI. You'll need to restart Sublime after installation.

Useful Packages

All packages can be installed with Installed Package Manager +Shift+P and type install. Then start looking for extenestions.

General

  • SideBarEnhancements Provides enhancements to the operations on Sidebar of Files and Folders.
  • Gist - Gist management.Create, read, update, and delete gists from within Sublime.
  • Alignment - Easy alignment of multiple selections and multi-line selections.
  • DocBlockr - Simplifies writing comments in Javascript, PHP

JS Specific

  • SublimeLinter - This is just a blank Linter Framework You need to install specific linter on top of this
  • SublimeLinter-eslint This linter plugin for SublimeLinter provides an interface to ESLint
  • Babel-Sublime Add correct syntax highlight for ES6

CSS & SASS

  • Sass - Adds syntax highlighting and tab/code completion for Sass and SCSS files. Also features Emmet shortcuts for many CSS properties.

Git & MarkDown

USer specific Setting

Open : SublimeTextPreferencesSettings – User, or with +`,'.' This file acceptes JSON format

{
	"color_scheme": "Packages/User/SublimeLinter/Oceanic Next (SL).tmTheme",
	"detect_indentation": true,
	"folder_exclude_patterns":
	[
		".svn",
		".git",
		".hg",
		"CVS",
		"node_modules"
	],
	"font_size": 16,
	"highlight_line": true,
	"highlight_modified_tabs": true,
	"ignored_packages":
	[
		"Vintage"
	],
	"tab_size": 2,
	"theme": "Oceanic Next.sublime-theme",
	"translate_tabs_to_spaces": true,
	"trim_trailing_white_space_on_save": true,
	"word_wrap": true,
}

This are set of new Shortcuts. Defaults can be found here (non-editable) A complete list of Settings can be referenced in SublimeTextPreferencesSettings – Default. But we can override it

Shortcuts

Open via: SublimeTextPreferencesKey Bindings – User. This file acceptes JSON format

[
  // Reveal the currently open file in the sidebar
  { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },
  // Create a new snippet [Jeffrey Way]
  { "keys": ["alt+super+n"], "command": "new_snippet" },
  // Open iTerm
  { "keys": ["ctrl+alt+t"], "command": "open_terminal" },
  // Select (or type) the syntax to apply to the current view.
  { "keys": ["ctrl+shift+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Set Syntax: "} },
  // swap the keybindings for paste and paste_and_indent
  { "keys": ["super+v"], "command": "paste_and_indent" },
  { "keys": ["super+shift+v"], "command": "paste" },
  // Close tag
  { "keys": ["super+."], "command": "close_tag" },
  // Alignment
  { "keys": ["super+shift+a"], "command": "alignment" },
  // Go to next Eslint error
  { "keys": ["super+e"],
    "command": "sublimelinter_goto_error",
    "args": {
       "direction": "next"
     }},
]

Commandline Shortcurt

Symlink Sublime Text so that it's in PATH file and easy to open files from terminal.

In Sublime Text 3 simply copy this into a terminal session:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/sublime

Now you can use

sublime . # To Open folder in sublime
sublime abc.js # To open a specific file in Sublime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment