Sublime Forum

How can I set word wrap turned on by default?

#1

Hi.
How can I set word wrap (Ctrl+Shift+W) turned on by default when I open document?
Is it possible?

Regards, Silent Imp.

0 Likes

#2

Preferences > User File Preferences
add this line:

wordWrap true
0 Likes

#3

Does this tip is still valid? Because It seems is not working anymore

0 Likes

#4

That tip is from Sublime Text 1.
If you go to Preferences > File Settings — Default, you can see that the option is now this:

	"word_wrap": true,
5 Likes

#5

This doesn’t work for me and it’s driving me crazy. I have it set to true, yet every time I open a document I have to set it manually. I’ve noticed it happens with Rails (.erb and .rb) files which is what I’m working on right now.

Any suggestions?

0 Likes

#6

Try setting in in a language specific file:

Packages/User/Ruby.sublime-settings

{
    "word_wrap": true
}
0 Likes

#7

[quote=“mgresko”]Try setting in in a language specific file:
Packages/User/Ruby.sublime-settings
[/quote]

Thanks I’ll try it, didn’t know about this, but isn’t there a way to make it global? I’d like ALL the files to have it regardless of the language.

0 Likes

#8

Thanks I’ll try it, didn’t know about this, but isn’t there a way to make it global? I’d like ALL the files to have it regardless of the language.[/quote]

Actually the default value is word_wrap: true

[quote=“adzenith”]That tip is from Sublime Text 1.
If you go to Preferences > File Settings — Default, you can see that the option is now this:

"word_wrap": true, [/quote]

But this value is overridden by the \Sublime Text 2\Packages\Ruby\Ruby.sublime-settings:

{ "word_wrap": false }
So you have to override the overridden value:

[quote=“mgresko”]Try setting in in a language specific file:
Packages/User/Ruby.sublime-settings

{ "word_wrap": true } [/quote]

You can create this file when you currently edit a Ruby source with Preferences > File Settings — More > Syntax Specific - User

The priority order is always:
-User\Ruby.sublime-settings
-Ruby\Ruby.sublime-settings
-User\Base File.sublime-settings
-Default\Base File.sublime-settings

0 Likes

#9

Wow, that is certainly convoluted. I mean I appreciate the answer, but you can see how having the same setting in 3 different places is just a recipe for disaster right? Global Settings User should override everything else, including the packages specific settings, I mean it is named “global”!

Wouldn’t you agree?

0 Likes

#10

[quote=“kakubei”]Wow, that is certainly convoluted. I mean I appreciate the answer, but you can see how having the same setting in 3 different places is just a recipe for disaster right? Global Settings User should override everything else, including the packages specific settings, I mean it is named “global”!

Wouldn’t you agree?[/quote]

It MUST work that way, otherwise… universe collapses…

Seriously, what I feel wrong is that word_wrap must not be changed in syntax language package, like what you see in Ruby.
Now if you want to ALWAYS have word_wrap enabled, you could probably use a plugin with (untested):

[code]import sublime, sublime_plugin

class WordWrapListener(sublime_plugin.EventListener):
def on_load(self, view):
view.settings().set(“word_wrap”, True)[/code]

0 Likes

#11

Needs to be lower case. Works for me in Preference->User Settings…

{
    "word_wrap": true
}
2 Likes

#12

this is the correct answer for version 3

0 Likes

#13

thanks. it is working. st4.

0 Likes