Interested in using Sublime Text for Laravel Development? Here's how to set it up from scratch like a Pro!
If you're still using Sublime Text, I would highly recommend that you check out Visual Studio Code instead. It outclasses sublime text in nearly every way, has a massive community and is open source!
Setting up your tools properly as a web developer can drastically improve your productivity. This article will show you how to setup sublime text for Laravel development and outline a few packages and settings that could make a big impact on your workflow. Although your final setup may differ from mine, this will at least give you an idea of how I go about setting up my development machines.
First, install sublime text from here. This one should be a no-brainer, but I thought I'd mention it in case you hadn't done it yet!
Our second step is to install package control. You should be able to hit Ctrl + Shift + P
(Cmd
on mac) and find the Install Package Control command. If you for some reason don't see that command in the list, you can alternatively install package control following the directions found here. This involves opening up the sublime console (not your normal terminal!) and pasting in the command found on their install page. To open the console, go to View > Show Console
in sublime text.
Now that we've got sublime and package control installed, we can use it to install all sorts of packages to improve the editor. To install a package, type Ctrl + Shift + P
(Cmd
on mac) and find the Package Control: Install Package command (start typing "Install Package" and you'll find it). From there, you can find and install tons of different packages from the package control registry. Your personal package preferences may vary (I'd encourage you to explore!), but I'll list the rough set that I use below:
1* AdvancedNewFile2* Auto Semi-Colon3* BracketHighlighter4* ColorHighlighter5* DocBlockr6* DotENV7* Emmet8* GitGutter9* Githubinator10* LESS11* Material Theme _(this is just the theme I use)_12* Laravel Blade Highlighter13* Laravel Blade Spacer14* Laravel Docs15* Sass16* SidebarEnhancements17* SublimeLinter _(language definitions are separate!)_18* SublimeLinter-php19* Vue Syntax Highlight
1* AdvancedNewFile2* Auto Semi-Colon3* BracketHighlighter4* ColorHighlighter5* DocBlockr6* DotENV7* Emmet8* GitGutter9* Githubinator10* LESS11* Material Theme _(this is just the theme I use)_12* Laravel Blade Highlighter13* Laravel Blade Spacer14* Laravel Docs15* Sass16* SidebarEnhancements17* SublimeLinter _(language definitions are separate!)_18* SublimeLinter-php19* Vue Syntax Highlight
Once you've finished installing your first set of plugins, it's usually a good idea to restart sublime text before we move on to configuring things.
Now that we've installed everything, it's time to configure some basic editor and package settings. You can hit Ctrl + ,
(Cmd
on mac) to see the sublime preferences. All of the defaults are on the left, and your user-specific preferences are on the right. Just like the packages you install, your individual preferences file will likely differ from mine, that's totally okay! Here are the most important contents of my sublime user settings file. Note that the first step for me is always to remove Vintage from the ignored_packages
entry in the settings file.
Preferences.sublime-settings
1"ignored_packages": [],2"always_show_minimap_viewport": true,3"bold_folder_labels": true,4"font_options": ["gray_antialias", "subpixel_antialias"],5"indent_guide_options": ["draw_normal", "draw_active"], // Highlight active indent6"line_padding_bottom": 6,7"line_padding_top": 6,8"overlay_scroll_bars": "enabled",9"highlight_line": true,10"rulers": [80],11"translate_tabs_to_spaces": true,
1"ignored_packages": [],2"always_show_minimap_viewport": true,3"bold_folder_labels": true,4"font_options": ["gray_antialias", "subpixel_antialias"],5"indent_guide_options": ["draw_normal", "draw_active"], // Highlight active indent6"line_padding_bottom": 6,7"line_padding_top": 6,8"overlay_scroll_bars": "enabled",9"highlight_line": true,10"rulers": [80],11"translate_tabs_to_spaces": true,
Key Bindings Sublime Text > Preferences > Key Bindings
If you're like me and you like to enable Vintage (vim) mode, mapping jj
to easily get from edit mode back to command mode is a must!
1[2 {3 "keys": ["j", "j"],4 "command": "exit_insert_mode",5 "context": [6 { "key": "setting.command_mode", "operand": false },7 { "key": "setting.is_widget", "operand": false }8 ]9 }10]
1[2 {3 "keys": ["j", "j"],4 "command": "exit_insert_mode",5 "context": [6 { "key": "setting.command_mode", "operand": false },7 { "key": "setting.is_widget", "operand": false }8 ]9 }10]
This should give you a general idea of how I configure Sublime Text on my development machines. As always, if you have any questions, you can find me on twitter