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
}
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 typinginstall
, selectPackage Control: Install Package
typejs gutter
, select JSHint Gutter - Configure JS Gutter/JSHint. Hit
Cmd+Shift+P
and start typingjshint set plugin
and go to the Set Plugin Options. Setlint_on_edit
andlint_on_save
to be true. Save the file. Now when you edit/save a JavaScript file it will automatically lint!
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.