Saturday, November 2, 2013

Re: Insert comand output on current text

On 02/11/2013 01:06 p.m., Ben Fritz wrote:
> [...]
> 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.

Many thanks Ben. It is what I wanted.

Regards,

--
Cesar

--
--
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.

No comments:

Post a Comment