Exporting and Sharing Sublime Text Configuration
Join the DZone community and get the full member experience.Join For Free
Sublime Text is a very powerful and popular text editor. But it’s more than a text editor… it’s an ecosystem of programmer’s tools where you can go to armory and choose the winning set for every code you’ll face. However, entering this ecosystem is long walk; learning all the plugins, tricks and such will take time. In this blog post I’ll show how more experienced Sublime Text user can share his/her setup with fellow peers still learning Sublime Text. Also, I have created a shell script collection which helps copying configurations into a fresh Sublime Text installation.
If you are new to Sublime Text 2 read my crash course article. Instructions in this blog post have been tested with Sublime Text 2. Sublime Text 3 is in beta, but it is not recommended yet for every day usage yet as some of the workflow critical plugins have not yet been ported for this version.
Sublime Text configuration mainly consists of following
- Packages/ folder where all your installed plugins and setting files lie (shortcut into this available through preferences menu)
- Packages/User/ folder where are the files specific to your configuration (other folders in Packages/ folder are pristine plugin files and should not be directly edited)
- Packages/User/Preferences.sublime-settings stores the preferences you have changed
- Packages/User/Package Control.sublime-settings containsthe list of installed addons
1. Configuration files needing copying
To transfer your Sublime Text configuration to fellow user you only need to copy
- Packages/User/Preferences.sublime-settings for settings
- Packages/User/Package Control.sublime-settings for list of plugins
- Other configuration files (shortcut keys, SFTP server configs, etc.) could be transferred, but they are not critical or may contain sensitive information
It is not safe to copy plugins as is between environments, as plugins may contain operating system or computer specific dependencies. It’s better to copy Package Control.sublime-settings file only. On the next Sublime Text start up Package Control will automatically read the list of packages from this file and install any missing packages from Github.
Manually installed packages, those not through Package Control, must be installed by hand on the target computer.
2. Automated setups
I have created a sublime-helper, a collection of shell scripts, which will help copying Sublime Text configurations (hosted on Github). It comes with my own configuration andpackage list; please free to clone and do whatever you want it with to make your and your peers’ workflow smooth.
The script will also setup subl shell alias to open Sublime Text from command line. Also, your UNIX EDITOR environment variable will point to special subl-wrapper-wait-exitcommand which integrates Sublime Text for git and svn commit message editing.
I tested the script by transferring my Sublime Text 2 configuration from OSX to Ubuntu Linux. A person new to Sublime Text was able to configure the editor and grasp some basics in 5 minutes. After seeing SublimeLinter jshint warning highlighting and JsFormatplugins the test person reaction was: “Oh my god, oh my god, oh my god.”
I think he is not switching back to Aptana + Eclipse.
Published at DZone with permission of Mikko Ohtamaa, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.