Sunday, July 28, 2013

Re: Is it possible to redirect echo to either the Scratch buffer, or QuickFix?

On Sunday, July 28, 2013 1:31:32 PM UTC-5, Dahong Tang wrote:
> Hi, I have several vimscript string variables. One of them, x, has many lines. When I use the command :echo x, the screen is redrawn to make room for the echo output so that the top of the vim gets pushed out of the screen (i.e., cutoff), and vim only returns to normal after I hit ENTER.
>
> I would like to stay in vim when I echo x to the screen, and I am wondering if it is possible to dump the variable to the Scratch buffer or QuickFix?
>
> Ideally, instead of opening a new Scratch buffer each time the variable is echoed into the buffer, I would like to do a Replace of the old content with the new one, or just append the content of new variables to the existing Scratch buffer or QuickFix. Does anyone know if this is possible? If so, could you please give an example? Thanks!

":put =x" will put the content of variable x into the current buffer just under the cursor line.

So to replace the contents of a buffer just do:

:%d | put =x

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