Meino Christian Cramer wrote:
From: "A.J.Mechelynck" <[EMAIL PROTECTED]>
[...]
It should be possible (though less obvious) to do it with only a substitute. Let's try:

        :'<,'>s/^.*\S.*$/# \0

i.e. prepend a hash sign and a space wherever we find start-of-line, zero or more of anything, one nonblank, zero or more of anything, end-of-line (in the range, here shown as a Visual area).


Best regards,
Tony.


 Hi Tony!

 :)

There are more ways to confuse a newbie... :O)
 Let me explain just to see whether I got this riddle solved this time
 by myself:

 '<,'>          for a range marked in visual mode
 s/             substitue/replace
 ^.*\S.*$       match "beginning of line,something,at least one
                                non-whitespace,something,end of line"

or in more detail:
        ^       start of line
        .       anything except a line break
        *       zero or more (as many as possible) of the preceding atom
        \S      one character, but not a space, not a tab and not a linebreak
        .*      zero or more of anything except a line break (as before)
        $       end of line

 /              with
 # \0           "# ",the whole line

\0 is, more precisely, the whole "match" (which is the whole line here since we matched something with no line breaks, going from start-of-line to end-of-line).



 Right?

 :)

 vim-sudoku.... ;))))

 Have a nice weekend!
 mcc


Right. Come to the front of the class and let me paste a gold star on your forehead.


Best regards,
Tony.

Reply via email to