How to set up MavensMate with Sublime Text.
As we mentioned in our previous post on MavensMate for Visual Studio Code, we love MavensMate. It’s an incredibly powerful tool that helps you work more effectively as a Salesforce developer. MavensMate is open source and offers plugins for Visual Studio, Atom and Sublime Text 3. Many developers use MavensMate to deploy code changes to their Salesforce orgs by clicking save in their text editor. There are many other great reasons to use MavensMate. Our initial post covers most of the background on MavensMate including what it is and how it’s useful. This post is designed to help you install one of the most popular Salesforce developer tools: MavensMate for Sublime Text.
The MavensMate for Sublime Text plugin requires Sublime Text 3 to be installed. It also requires the MavensMate desktop client which you can download on GitHub here.
The MavensMate desktop client does not care which text editor plugin you are using so installing the client is a good place to start.
You can learn more about all the features of the MavensMate desktop client on our post about MavensMate for Visual Studio Code.
Once you have MavensMate desktop client installed, you can install the MavensMate plugin for Sublime.
First, make sure you have package control installed for Sublime Text 3. (Note: You may already have it installed.)
Then, open Package Control by either visiting Preferences > Package Control or just typing cmd+shift+P. Next, type “Install Package”:
You are then prompted to search for Packages in Sublime. Search for MavensMateand install the plugin.
Once that’s done you’ll get a message like this:
MavensMate for Sublime Text v7.0.2
Welcome to MavensMate for Sublime Text. In order for this plugin to operate, MavensMate Desktop must be installed and running. Please visit https://github.com/joeferraro/MavensMate/tree/master/docs for more information. Happy Coding!
Once the MavensMate desktop client and Sublime Text plugin are successfully installed, you just need to configure the desktop client to connect to your Salesforce project and tell MavensMate which metadata to track.
First, open MavensMate and select New Project or Open Project.
MavensMate allows you to convert your text editor into something akin to the Salesforce developer console through OAuth 2.0. Tell MavensMate which kind of org you wish to connect and click Connect. You’ll be prompted to login to your Salesforce sandbox; just input the username and password for that org in the prompt. You’ll be asked for various permissions from MavensMate.
Once you click Allow, MavensMate will ask you which metadata types you want to track. For example, do you want Apex Classes, Triggers, Pages, and Static Resources or is it okay to leave Static Resources out?
MavensMate just tracks the metadata that you tell it to. To make selections about metadata go to the Advanced tab and use the selection tool.
Then, visit the Metadata tab and again select the metadata you want tracked.
Once you’ve selected your metadata, give the project a new name in Project Detailsand click Create Project. Note: You can go to Edit Project and change the types of metadata you track at any time.
You should now see Sublime listed as one of your editor options in the desktop client. Click Open in Sublime to launch your project in Sublime. You should now see your project metadata there. You can now make changes and when you save, MavensMate will validate the change and automatically upload it to the connected Org, just as it would if you were working on an Apex class or trigger in the developer console on Salesforce.
Now that you’ve got the MavensMate plugin for Sublime installed and working, you can go about your day and code just as you normally would. Each time you save, MavensMate will automatically deploy that code to the server. Because Blue Canvasautomatically picks up your changes and commits them to source control, you can now easily use MavensMate with Blue Canvas. With Blue Canvas and MavensMate, you have full continuous backups of all changes in your Salesforce orgs, as well as the ability to rollback to previous states of your application. You can even use Blue Canvas and MavensMate to compare differences and deploy between Salesforce environments.
To learn more about MavensMate and how it can work with Blue Canvas, check out our first post about MavensMate for Salesforce.
How to keep your orgs in sync without having to reupload your data in your sandboxes.
How to rollback a Salesforce change using Git without having to use the command line.