Hard Wrap.

Guido Governatori 7 years ago • updated by Hugo Schmitt 5 years ago 10
It would be good to have an option to turn on automatic hard wrap. Now one has to do it manually for each paragraph. 

Mostly I write text (latex) and I use version control systems. Most diff tools do not handle long lines well (in some cases it is hard to find the diff since one has to scroll horizonatally). 

No, that's manual wrapping.

@ClarkHaynes This doesn’t  do what the original poster asks for, which is automatic hard-wrapping without manually requesting it by pressing a key sequence.

I’d really love to see automatic hard-wrapping. 

Vim is the only editor on the Mac which currently does this. Automatic hard-wrapping is really nice for LaTeX documents for the reasons that the original poster gives.
I feel obliged to say emacs does autofill, which is the same thing as automatic hard wrapping. I would love to see this for sublime too

https://github.com/ehuss/Sublime-Wrap-Plus has it, but I like the one in BBEdit 10 better.

No, that's manual wrapping.

No, that's manual wrapping.

I don't seem to be able to make manual wrapping work, which I am finding increasingly frustrating. The default Sublime strategy appears to be Edit-> Wrap-> Wrap paragraph at *. This is greyed out and not accessible, for some reason.

edit: I am on Linux


Here's my current solution.

Bind space like this:

    { "keys": [" "], "command": "space_and_wrap_lines", "context": [
         { "key": "selector", "operator": "equal", "operand": "text.html.markdown, text.tex.latex" },
         { "key": "following_text", "operator": "regex_contains", "operand": "^$", "match_all": true }

And write this little command in a new plugin:

import sublime, sublime_plugin
class SpaceAndWrapLinesCommand(sublime_plugin.WindowCommand):
    def run(self):
        self.window.run_command("insert", {"characters": " "})