Ctrl+H, Alt+R, replace following pattern with a single space: (?<!\s)([^\S\r\n]{2,}) @see https://stackoverflow.com/questions/3469080/match-whitespace-but-not-newlines @see https://stackoverflow.com/questions/39915644/regex-look-behind-in-vs-code