On Friday, November 1, 2013 2:44:35 PM UTC-5, andalou wrote:
>
>
>
> If I go after the end of "enlace" and do :1,.s/^# /&/n
>
> I get, say:
>
> 8 matches on 8 lines
>
>
>
> then I'd like to have ch007.html after "enlace."
>
>
>
> If the above command outputs:
>
> 35 matches on 35 lines
>
>
>
> then I'd like to have ch034.html after "enlace."
>
>
OK, now THAT is a much better problem description. We can work with that.
>
> I suppose, I can do it manually. Thanks anyway.
>
>
My comment about doing it manually was because your initial problem description gave NO indication as to where "ch007" came from, nor how you wanted to insert it.
Actually, you STILL give zero indication how you want to insert it. How do you determine where in the line to insert the number?
To get everything ready for insertion, do:
:redir => var
:1,.s/^# /&/n
:redir END
:let @"="ch".printf("%03d",(substitute(var, '^\(\d\+\).*', '\1', '')-1)).".html"
Now you can paste with p and you'll get ch007.html or similar at the cursor.
If that's not what you want to do for insertion, you need to share where the text should be inserted, what you want to do to insert it, etc.
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Saturday, November 2, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment