When I have automatic wrapping enabled, I can write some text like
This line is starting to get fairly long so
it has been wrapped
If I start writing a comment, I get fairly sensible behaviour:
# When I reach the maximum line width in a
# comment, the next line gets commented
# too!
If, however, I'm writing some Ruby and I'm in the middle of a string on an indented line...
str = "If I'm trying to write a ruby string,
and then it tries to wrap, I get a
surprise newline and a bunch of space!"
While this is valid Ruby code, a better way to write this would be the following:
str = "Really, what I'd like it to do is "\
"notice that I'm in the middle of a "\
"string and sort it out for me"
Is there a plugin or option to add special rules for wrapping certain lines, so that relevant characters can be added in a context-aware fashion?
textwidth
is exceeded, it's doing it for every non-whitespace character typed. This could still work, but would be a big performance hit.formatexpr
seems the way to go to me!