3 ms·
You can do that by setting textwidth to a value, say "set textwidth=80", and hitting the "gq" action. So to format the current paragraph something like "gq}" wo
by augusto-moura 3y ago
You can do that by setting textwidth to a value, say "set textwidth=80", and hitting the "gq" action. So to format the current paragraph something like "gq}" would do the same as your snippet
- shiomiru 3y agoI like fmt better because it works on all vi's. It's also closer to the UNIX philosophy of doing one thing and doing it well. Also, it's not just fmt you can use. Want to sort a paragraph of lines? !}sort^M and you're done. Or reverse sort till the end of the file with !Gsort -r^M etc. Really, all UNIX commands are integrated into your editor, and that's the beauty of it.
- cerved 3y agoI didn't know you could use motions like that! <3
- fuzztester 3y ago>Or reverse sort till the end of the file with !Gsort -r^M etc. Right. Or flip the case of a section of text, even of an arbitrary block of lines demarcated by marks set by vi(m) commands like ma and mb and the like, by filtering it through tr. Or filter another section through sed or awk or even through a Unix pipeline, to do whatever you want. And with just a little practice, you can become fluent and fast with all of this, and it improves your productivity a lot, apart from being fun and creative.