On Thu, 4 Nov 2010, rameo wrote:

I find myself often to align blocks of text and thought to create a regex to remove all leading spaces in a block.

p.e.

         text a
          text b
             text c
          text d

I would like to select a visual block around these 4 pieces of text and remove all leading spaces, how can I do this? - I can't use "^" because it aligns the block at the beginning of the line.


:'<,'>s/\%V\s*//
 |    | |  \- \s* - zero or more spaces
 |    | \- \%V - matches inside the visual area
 |    \- s/// - substitution
 \- '<,'> = visual range

(Can't use \s\+ because it fails if the line contains, but doesn't start with, spaces).

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to