Sublime Forum

Custom user wrap_width ignored (stomped by menu options?)

#1

i have a user settings file which specifies a custom wrap width of 61.
png
this was working until recently, but as of today the custom wrap width is being ignored.

i suspect what’s happening is that this is due to an interaction with the menu settings. i have read in another thread ( Wrap width issues in Distraction Free mode ) that the intended behavior is that menu settings override the user settings file. however, i cannot figure out a way to stop using the menu settings and use the value from the settings file instead.

things i have tried:
i have tried unchecking wrap from the menu (which disables wrap, rather than using the settings value).
i have tried changing view->word wrap column. this just changes the wrap_width setting which the menu is stomping the specified value with.
i have tried restarting in various states, hoping it would revert to using the preferences from the user settings file. so far, nothing has worked.

does anyone know how to get it to ignore menu word wrap settings and use the settings file again?

0 Likes

#2

As you mentioned, settings that are applied via the menu commands (or rather, by the set_setting command, which is what the menus use) override all other settings and are specific to that view. Specifically they’re known as “Buffer Specific Settings” and they’re at the top of the settings hierarchy to ensure that they always supercede everything else (see here: https://www.sublimetext.com/docs/settings.html#settings_files)

Buffer specific settings are just that; settings that apply only to that particular tab in the editor. Trying to swap the settings via the menu just replaces one buffer setting with another one.

Settings like this are only temporary for as long as the tab is open, so closing and reopening the file will reset them. You need to close the tab specifically; by default Sublime stores the state of everything in the session information and re-applies it when you restart, so just quitting Sublime won’t do anything.

If you want to remove the setting without closing the file, you can open the Sublime console with View > Show Console and enter something like the following (replace the setting with whichever one you want to erase):

view.settings().erase("wrap_width")

This erases the buffer specific setting (if there is one), which allows one of the other settings in the hierarchy to put the setting back. In this context, view is taken to be whatever file currently has the focus, so make sure you’re working in the correct file before you do this.

0 Likes

#3

thank you so much for elaborating on the mechanics of this! it hadn’t occurred to me that it would be tab lifespan instead of application.

when i reopen a tab, or do
>>> view.settings().erase("wrap_width");
it resets to preferences as you describe, resetting the menu state to not override.

word%20wrap

0 Likes