Home Download Buy Blog Forum Support

How can I set word wrap turned on by default?

How can I set word wrap turned on by default?

Postby SilentImp on Mon Dec 14, 2009 3:33 pm

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

Regards, Silent Imp.
SilentImp
 
Posts: 12
Joined: Tue Dec 01, 2009 11:29 am

Re: How can I set word wrap turned on by default?

Postby EJ12N on Thu Dec 17, 2009 6:49 pm

Preferences > User File Preferences
add this line:
Code: Select all
wordWrap true
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: How can I set word wrap turned on by default?

Postby gagginaspinnata on Fri Dec 09, 2011 4:36 pm

Does this tip is still valid? Because It seems is not working anymore
gagginaspinnata
 
Posts: 10
Joined: Fri Nov 11, 2011 4:27 pm

Re: How can I set word wrap turned on by default?

Postby adzenith on Fri Dec 09, 2011 6:28 pm

That tip is from Sublime Text 1.
If you go to Preferences > File Settings — Default, you can see that the option is now this:
Code: Select all
   "word_wrap": true,
adzenith
 
Posts: 1215
Joined: Mon Oct 19, 2009 9:12 pm

Re: How can I set word wrap turned on by default?

Postby kakubei on Wed Jan 18, 2012 10:17 am

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?
kakubei
 
Posts: 58
Joined: Sun Sep 25, 2011 9:19 am

Re: How can I set word wrap turned on by default?

Postby mgresko on Wed Jan 18, 2012 12:14 pm

Try setting in in a language specific file:

Packages/User/Ruby.sublime-settings

Code: Select all
{
    "word_wrap": true
}
mgresko
 
Posts: 2
Joined: Sun Jan 15, 2012 10:23 pm

Re: How can I set word wrap turned on by default?

Postby kakubei on Thu Jan 19, 2012 9:53 am

mgresko wrote:Try setting in in a language specific file:
Packages/User/Ruby.sublime-settings

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.
kakubei
 
Posts: 58
Joined: Sun Sep 25, 2011 9:19 am

Re: How can I set word wrap turned on by default?

Postby bizoo on Thu Jan 19, 2012 10:19 am

kakubei wrote:
mgresko wrote:Try setting in in a language specific file:
Packages/User/Ruby.sublime-settings

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.

Actually the default value is word_wrap: true
adzenith wrote:That tip is from Sublime Text 1.
If you go to Preferences > File Settings — Default, you can see that the option is now this:
Code: Select all
   "word_wrap": true,

But this value is overridden by the \Sublime Text 2\Packages\Ruby\Ruby.sublime-settings:
Code: Select all
{
   "word_wrap": false
}

So you have to override the overridden value:
mgresko wrote:Try setting in in a language specific file:
Packages/User/Ruby.sublime-settings
Code: Select all
{
    "word_wrap": true
}

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
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: How can I set word wrap turned on by default?

Postby kakubei on Thu Jan 19, 2012 11:29 am

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?
kakubei
 
Posts: 58
Joined: Sun Sep 25, 2011 9:19 am

Re: How can I set word wrap turned on by default?

Postby bizoo on Thu Jan 19, 2012 12:27 pm

kakubei wrote: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?

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: Select all
import sublime, sublime_plugin

class WordWrapListener(sublime_plugin.EventListener):
    def on_load(self, view):
        view.settings().set("word_wrap", True)
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 13 guests