Deleting spaces at the beginning of lines in vim


Sometimes I'll copy the text from a web page and paste it into a local text file so that I can manipulate it, search through it, etc. But when pasted into the text file it sometimes gets mis-formatted, with a bunch of spaces preceding some lines, such as this

Ampan Victor Speech 6698
      Anderson Mike Orchestra 6660
      Anderson Bob Pupil Support 6668
             Bancroft Mark Grade 4 6672
             Hartee Jeanette Pupil Support 6680
             Henshoof Harry Building PC/LAN Tech 6705 7130
             Herg Sara Social Worker 6676
                   Looks Dean Pupil Support 6673
                   Murkstrand Lance Special Education 6673 7171

To eliminate those spaces in vim (may or may not work in vi, depending on version), use this command:

:%s/^\s\+//
Translation:

10/27/2006