32

I am using Sublime Text 2. When I am on an HTML file. If I resize the window. The code at the very end shifts down to the next line. How do I stop this from happening? I want the code to continue onward, so I will have to scroll side to side to see the rest of the code and not have the shift to the next line.

I have taken screenshots to better illustrate what I am referring to.

Full window of code

After window has been resized. Notice the number lines? How do I stop that? I'd rather scroll right to see the rest of the code instead of having the code jump to the next line.

Resized window

I noticed this only happens in an HTML file.

4 Answers 4

52

Look in the default Preferences.sublime-settings file for the setting below:

// Disables horizontal scrolling if enabled.
// May be set to true, false, or "auto", where it will be disabled for
// source code, and otherwise enabled.
"word_wrap": "auto",

If you want the default for word wrap to be off for all syntax types:

Copy "word_wrap": "auto", into your user Preferences.sublime-settings file

If you want the default for word wrap to be off for code and off for HTML but on for other syntax types:

Copy "word_wrap": "auto", into the HTML.sublime-settings file


Set it to "word_wrap": "false",.

Now your default for HTML will be word wrap is off.

You can change this anytime by toggling the Word Wrap item in the View menu or by launching the Control Panel and typing enough of word wrap until the Word Wrap: Toggle item is selected and hitting Return.

1
  • 2
    +1. Just to clarify, putting this code in that settings file will disable word wrap for any syntax, not just HTML files. If you want that behavior, or any other option for that matter, to only apply to files with a certain syntax type, open such a file and edit your syntax-specific preferences from the menu and put the above code there.
    – Rob Wise
    Commented Jul 16, 2014 at 7:27
23

Just uncheck "Word wrap" in the "view" menu.

0
17
  1. Open an HTML file with Sublime Text.

  2. Choose Sublime Text > Preferences > Settings - Syntax Specific.

  3. A file named HTML.sublime-settings will open.

  4. Insert the following:

    {
        "word_wrap": "false"
    }
    
  5. Save the file.

1
  • I think it only needs: "word_wrap": "false" Commented Mar 6, 2017 at 14:05
1

You can specify a particular number of columns to display before wrapping, irrespective of the window width. Put your desired number of columns in the relevant preferences file:

"wrap_width": 80,

This is probably not what you want with HTML, but it helps with readability for things like Markdown, TeX, or plain text when the author didn't use line breaks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.