By breaking into sentences I mean that each new sentence should start with a new line.

How to repeat )i<CR><Esc> to the end of the paragraph }? (<CR> = Enter)

If I make a macro )i<CR><Esc> as "q", can I execute it until the end of the paragraph?

link|improve this question

55% accept rate
feedback

3 Answers

You can do a search and replace. I just wrote this out. It works, but you could probably do better.

:%s/\v[ ]*([^\.]*\.)/\1\r/g
link|improve this answer
feedback
vap:s/\. /.^M/g
  • vap selects your current paragraph
  • :s/\. /.^M/g replace all periods followed by a space with a period followed by a newline. (Note that to get that literal newline (^M) in the replacement expression, you'll have to type <CTRL-V><CR>.)
link|improve this answer
feedback

My solution, start in normal mode and type:

vip:'<,'>s/\n/ /|'<,'>s/\([.?!]\)\s/\1\r/g

Note that the first '<,'> will automatically be inserted on the command line when you press the ":" key after typing "vip" in normal mode.

The first substitute joins the paragraph into one line, then the "|" character delimits a second :-command within the same command line, and this time the "'<,'>" must be typed by hand. The second substitute command replaces a period, question mark, or exclamation mark followed by a space with the matching symbol and a newline.

This won't catch instances where a sentence ends with a period/excalmation/question and a quote character, etc. but the pattern can be extended to do so.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.