I want to unwrap text in Vim. When I join lines I get an additional space between sentences.
Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Formatting destroys information. There are many different blocks of text which will result in the same one once formatted. Therefore, there’s no way to reverse the operation without prior knowledge (i.e. undo).
Unformatted:
Formatted:
If you want your paragraph all on one line, or if you’re okay with a little manual fiddling, you can use
Jto join lines back together. You can use visual mode to apply theJcommand to several lines at once, perhaps combined withaporipto select a paragraph, e.g.vipJ. Again, you’ll still lose some information – multiple spaces at line breaks before formatting will end up collapsed to single spaces. (You can actually join without modifying spaces by usinggJinstead ofJ, but you’ll already have lost them when you formatted)If you’re bothered by the extra spaces after sentences (lines ending in !, ?, or .), turn off joinspaces:
set nojoinspaces