Siddhartha Kasivajhula wrote:
> Hi VI gurus,
> I have a text document with ~500 lines. I want to add a numbering ~to~
> this document at the beginning of every line. So for example if it's:
>
> This is sentence 1
> This is sentence 2
> And this is sentence 3
>
> I want it to become:
>
> 1. This is sentence 1
> 2. This is sentence 2
> 3. And this is sentence 3
>
> Is there a way to do this in VI? To be clear, I want to actually add the
> numbering to the document, as opposed just have line numbering of the
> document in a sidebar.
:%s/^/\=line('.') . '. '/
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment