Setting up Sublime Text 3 for a better development workflow

in #sublime-text7 years ago (edited)

Setting up Sublime Text 3

In this post I am going to show you how to setup/configure Sublime Text 3 for a better development workflow.

Installing Sublime Text 3

To install Sublime Text 3 visit their website and hit the download button. The following should be pretty straight forward.

macOS

On macOS the installation process might be the simplest one of all three. You simply drag & drop the Sublime Text icon to your applications folder and you're finished.

Windows

On windows the installation process is similary simply as on macOS. After the download finished you'll have a setup file to execute where you'll be able to adjust the installation path to your liking.

Linux

To install Sublime Text on Linux you've got to use the command line. Furthermore the installation process can differ depending on your distribution. But thanksfully this is all documented on the products website.

Installing the package control

The package control gives you the option to easily install packages which will make your development experience so much better. Simply hit Ctrl/Cmd + Shift + P and type "Install package control". Another way would be to visit the package control's website, copy the code from the textbox, open the console in Sublime Text (View -> Show Console) and paste what you've just copied.

Installing packages

To install a package you have to open the command palette again (Ctrl/Cmd + Shift + P).

Type "Package Control: Install Package" and hit enter.

I've got a few recommendations which you should install no matter what type of programming work you do:

  • SideBarEnhancements
    • Way more options for the sidebar
  • Git
    • Git integration: Use git on the command palette
  • DocBlockr
    • Simplifies documenting your code
  • AdvancedNewFile
    • Create new files and specify a path for those on creation

You can also browse on the package control's website to find packages that fit your needs. To make Sublime Text look better you can also install different color schemes and themes.

Adjust the settings to your liking

Sublime Text gives you a wide variety of settings you can adjust. To access the settings page press Cmd + , on macOS or go to Preferences -> Settings if you are on Windows or Linux. On the left pane you can see the default settings and a description to each setting. Whereas on the right pane your user settings are shown (this is the file you want to edit). Ofcourse this is, just as the color scheme and theme, something which will differ for any user but I'm still going to show you my settings and explain these a bit.

// This makes sure to add a new line at the end of a file which is considered good practice in languages like PHP
"ensure_newline_at_eof_on_save": true,

// This adds some extra space to each line on the bottom and the top for better readability
"line_padding_bottom": 4,
"line_padding_top": 4,

// Makes sure your file(s) will be saved in case Sublime Text is no longer in the foreground. Espacially useful for web 
// development when you change to your browser and reload a page but forgot to save or for C/C++ development where 
// you change your foreground window to a command line to compile.
"save_on_focus_lost": true,

// Self explanatory 
"scroll_past_end": true,

// Cuts off unnecessary white spaces when saving a file
"trim_trailing_white_space_on_save": true

You can also remove the "Vintage" package from the ignored_packages list if you're familar with vim. This will allow you to use vim shortcuts in Sublime.