>> Or even a quality :s command instead of a function: >> :%s/.\{72}/&r/g > > Thanks - I occasionally need to split a line into equal-length blocks > and your command is excellent. Your posts are very valuable. > > However, for anyone trying this, 'r' should be '\r'. > > :%s/.\{72}/&\r/g
Whooops...good catch. I got it right in my response to the OP, but missed the "\" in my reply to Bram. If you end up with the letter "r" every 72 characters instead of a newline, you used my messed up version. :) I used this regularly at my last job where I'd occasionally have serial-data dumps and have to break the file into 128-byte packet-sized pieces...invaluable to be able to have one command that quickly sliced my file into 128-character lines. :) -tim