How to join all lines till next condition?
join, lines, regex, vim
Solution
Instead of the static `+2` end of the range for the `:join` command, just specify a search range for the next line that only contains a number (`/^\d\+$/`), and then join until the line before (`-1`):
:global/^/,/^\d\+$/-1 join
Problem
I can't find out how to join all lines till a next condition happens (a line with only 1 or more numbers) p.e. input: ``` 1 text text text text (with numbers) text text text text (with numbers) 2 this text text text text text (with numbers) text text text 3 text text text text (with numbers) 4 etc ``` desidered output: ``` 1 text text text text (with numbers) text text text text (with numbers) 2 this text text text text text (with numbers) text text text 3 text text text text (with numbers) 4 etc ``` I normally use `global/^/,+2 join` but the number of lines to join are not always 3 in my example above.