[ale] Appending in VIM

Richard Bronosky richardbronosky at gmail.com
Wed Feb 6 00:20:55 EST 2013


Alex's visual block explanation is THE answer to the question you asked.
You should really learn that.

I will add that while you can't do a number followed by a dot to repeat it
N times (because that would do it all to the same line), this may be a good
time for you to learn to record macros.

As you've discovered, you can repeat adding this text by doing:
.0j
On each line, which is: repeat the insert, go back to column 0, drop down a
line

That's a real easy macro to start with. You hit q and any letter and it
begins recording to the register named by that letter. Then you hit the
keystrokes you want recorded. Stop recording by hitting q one more time.
Play back any register by hitting @ followed by the letter. For me the
fastest is to just use the q register. So that makes it:
qq.0jq
To record it, assuming you did the insert once before to get the dot ready
to repeat, otherwise you could use I#<Esc> to record the insert. Then to
replay it 10 times:
10 at q

I would be willing to show you these things in a shared tmux session if you
are interested. I love teaching vim.
On Feb 5, 2013 7:00 PM, "Alex Carver" <agcarver+ale at acarver.net> wrote:

> On 2/5/2013 15:09, Chris Fowler wrote:
>
>> On 02/05/2013 04:49 PM, JD wrote:
>>
>>> If you know the line number range, doesn't this work?
>>>
>>> 7,53s/$/#_/g
>>>
>>
>> That is one way and it works,  but need to use ^ for beginning instead
>> of the end of line.
>>
>>
> There's also visual-block mode.  Move to the first column of the first
> line you want to change, Ctrl-V then move the cursor down to the last line
> (you can use any cursor movement such as [n]j to move n lines down or use /
> to search for a keyword but then that will highlight extra columns so use
> 'h' to shrink back to one column).  Now use captial i (I) to do a
> visual-block insert, type in the # once, press <ESC>, and move away from
> the line.
>
> Or you can do it during the mysql command and avoid hand editing
> completely.  Pipe through sed on its way to the file:
>
> mysql .... | sed 's/^/#/g' >> perlfile.pl
> ______________________________**_________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/**listinfo/ale<http://mail.ale.org/mailman/listinfo/ale>
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/**listinfo<http://mail.ale.org/mailman/listinfo>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130206/8ce836e3/attachment.html>


More information about the Ale mailing list