Vim: Just once space revisited
At the beginning of last year I wrote a weblog entry about how to write a function that removes all space but one in Vim. It didn’t work like I wanted, but now it does. function JustOneSpace() " replace all whitespace around the cursor with a space s/\s*\%#\s*/ /e " search backwards for a space call search(' ', 'be') " move to the first character after the space normal l endfunction nmap <space> :call JustOneSpace()<cr> I added the call to the search() function to move to the space that was substituted....