Wrapping lines in Sublime Text

Print Friendly

I’m a big fan of Sublime Text 2 and it has become my default editor for all things web design. However, there was something about the default behavior of this app that really bugged me. Whenever I would browse a document I would always get frustrated by the way the application would horizontally scroll whenever a document had really long lines of code (like lengthy CSS declarations). I knew there had to be a way to force the code to wrap to a new line and disable this behavior. Well, after a long Google search, I found the answer, and thought I’d share with you how to enable Sublime Text word wrap.


Sublime has very extensive customization capabilities. Unfortunately, they’re not stored in a preferences dialog box, they’re accessed via coding. This is a cool feature for more advanced users, but I’d imagine it’s frustrating for most beginners. Here’s how to access the preferences document.

NOTE: These instructions are for Mac users. Windows/Linux operations are the same, but menus will be different.

  • Click Sublime Text 2 > Preferences > Settings – More > Syntax Specific – User

When you open this file, it will correspond to whatever type of document you currently have open. This means if you’re working on a CSS document, you’ll be editing preferences for all documents that end in .css. I went ahead and opened a .css file first, just to make sure this worked, then I opened up a .html, .php, and .js file to ensure I had matching settings across the board.


Now it’s time to type out the actual code for the setting that we’re going to enable. Just copy and paste the code below into the preferences document and you’ll be all set.

{ “word_wrap”: true }

Now save your document, close it, and restart Sublime Text 2. Once you do that, open a document that previously had horizontal scrolling problems. Now the code should wrap once it hits the edge of the window and scrolling should be disabled.

Sublime Text documentation

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)