+14

Hard Wrap.

Guido Governatori 16 років тому • оновлено Hugo Schmitt 14 років тому • 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). 
+2
@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.
+2
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

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

+1

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("wrap_lines")
        self.window.run_command("insert", {"characters": " "})


HTH