Skip to content

Instantly share code, notes, and snippets.

@FootballFan141
Forked from tibbon/sublimehints.md
Created July 23, 2018 04:00
Show Gist options
  • Save FootballFan141/c55152ab43fdd310787ed83e61e00ed6 to your computer and use it in GitHub Desktop.
Save FootballFan141/c55152ab43fdd310787ed83e61e00ed6 to your computer and use it in GitHub Desktop.
Sublime Hints of the Day

David's Sublime Hints

Hint 1 - Set default indentation to 2 spaces

A tab size of 2 almost always looks better and can fit more on screen

  • Click on Sublime Text -> Preferences -> Settings - User
  • Alter the file to add "tab_size: 2" and save it

Mine looks like the following:

{
	"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
	"font_size": 20,
	"ignored_packages":
	[
		"Vintage"
	],
	"tab_size": 2
}

Hint 2 - Install Sublime Autocomplete All

It's more helpful to have autocomplete across all of your open files, as we have more an more files open. Fortunately, there's a plugin for that!

Hit cmd+shift+p in Sublime to open the Command Pallete. Start typing 'install' to select 'Package Control: Install Package', then search for AllAutocomplete and select it. That's it.

Hint 3 - Install JSHint for automatic JavaScript linting

Linting is automatically evaluating your code for syntax errors, style and best practices. And we've got a tool for it!

This is a bit more complicated, as it requires you install Node.js.

  • Install Node.js and NPM. You still may find better instructions out there
  • Run npm install jshint from your bash terminal.
  • Install Sublime-JSHint. Cmd+Shift+P in Sublime. Start typing install, select Package Control: Install Package type js gutter, select JSHint Gutter
  • Configure JS Gutter/JSHint. Hit Cmd+Shift+P and start typing jshint set plugin and go to the Set Plugin Options. Set lint_on_edit and lint_on_save to be true. Save the file. Now when you edit/save a JavaScript file it will automatically lint!

Minor note with JSHint

It will probably bug you about stuff that you don't want to be bothered about. Consult this link on configuring a hidden .jshintrc file in each of your projects to configure what type of things you want JSHint to look for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment