4 ms·
While pandoc is certainly a very useful tool, don't you think it's overkill to call a 143MB (on my Linux system) pandoc executable to do word (un)wrapping? Ema
by nemoniac 3y ago
While pandoc is certainly a very useful tool, don't you think it's overkill to call a 143MB (on my Linux system) pandoc executable to do word (un)wrapping?
Emacs has `fill-paragraph` built in and `unfill-paragraph` is a short function definition [1]. Both work across multiple paragraphs.
[1] https://www.emacswiki.org/emacs/UnfillParagraph https://www.emacswiki.org/emacs/UnfillParagraph
- kugurerdem 3y agoNice point! I agree that it's a bloated method, however, this was the best solution I could come up with at that point of time. I am certain that there are better solutions, it's just me who could not find it. I went with this solution anyways since it was still an improvement compared to my previous method in vim which involved setting the text width to a large number like 9999, highlighting the text I wanted to unwrap and then typing 'gqq' for formatting, and then yanking it. And of course, I had to re-wrap the text if I wanted to maintain the original format of the text file. You are absolutely right and I understand what you mean though. I am open to trying other alternatives and I should try to come up with a better method to workaround this problem. Never tried Emacs, just went with Vim so far. Did not know that Emacs had already an elegant solution for this problem. Nice! :)
- pxeger1 3y agoMy solution would be to go to the start of each paragraph and hold J (shift + j) until the entire paragraph was joined onto one line, and then go down to the next one. I guess it depends on how long your emails are but this is pretty quick.
- eichin 3y agoI haven't needed it myself, but it might be easier to just keep the document in line-break-per-paragraph form and just turn on visual-line-mode...
- kugurerdem 3y agoMy problem with this method is that it's not convenient especially when there are lots of paragraphs. When you highlight all the paragraphs and press shift J, it unwraps everything into a single line. This results different paragraphs ending up on the same line. You also need to undo the changes you made to avoid disturbing the original file content.
- aktenlage 3y ago"vapJ" might do the trick for one paragraph. So maybe you can make a mapping that does vapJ and moving to the next paragraph ("]]"?) in your vimrc will let you do this with a count.
- flexagoon 3y agoqfvapJ]]q to record a macro that joins a single paragraph together <N>@f to then replay that macro <N> times
- kyawzazaw 3y agoI have almost never thought about the file size of a program (even for big games) on a daily use machine. I am certainly not gonna be learning and switching to emac just to perform this task for unwrapping a .docx file