Buffers in command line?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Buffers in command line?

Ven Tadipatri
Hi,
   I was wondering if there was a way to paste the contents of a
buffer when in command line mode. For example, if I want to search for
the word that I'm on, I was thinking of highlighting it in visual
mode, yanking it into a buffer, then searching for what I yanked.

Thanks,
Ven

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

Gary Johnson-4
On 2010-10-04, Ven Tadipatri wrote:
> Hi,
>    I was wondering if there was a way to paste the contents of a
> buffer when in command line mode. For example, if I want to search for
> the word that I'm on, I was thinking of highlighting it in visual
> mode, yanking it into a buffer, then searching for what I yanked.

First off, in Vim, a buffer is the thing you edit, the in-memory
representation of a file.  The thing you yank into and paste from is
called a register.

In answer to your question, yes, you can insert the contents of any
register into the command line by first typing Ctrl-R, then the name
of the register.  Since the name of the default register is "
(double-quote), you could do what you want by yanking the word under
the cursor with

    yiw

and pasting it at the desired point in the command line with

    ^R"

See

    :help c_CTRL-R

Regards,
Gary

--
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
Reply | Threaded
Open this post in threaded view
|

RE: Buffers in command line?

JohnBeckett
In reply to this post by Ven Tadipatri
Ven Tadipatri wrote:
>    I was wondering if there was a way to paste the contents
> of a buffer when in command line mode. For example, if I want
> to search for the word that I'm on, I was thinking of
> highlighting it in visual mode, yanking it into a buffer,
> then searching for what I yanked.

Yes: Ctrl-R followed by register letter. See:
http://vim.wikia.com/wiki/Paste_registers_in_search_or_colon_commands_instead_of_using_the_clipboard

BTW I think you mean "register" and not "buffer". See:
http://vim.wikia.com/wiki/Vim_buffer_FAQ

John

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

scott-268
In reply to this post by Ven Tadipatri
On Monday 04 October 2010 16:03:28 Ven Tadipatri wrote:

> Hi,
>   I was wondering if there was a way to paste the contents of
> a buffer when in command line mode. For example, if I want to
> search for the word that I'm on, I was thinking of
> highlighting it in visual mode, yanking it into a buffer,
> then searching for what I yanked.

and i'm wondering if what you're really looking for here is
the '*' and '#' commands -- no need to yank anything, no need
for visual anything, just put the cursor over the word you
want to search for and hit the asterisk -- a real convenience
feature -- asterisk searches forward, hash searches backward

sc

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

Ven Tadipatri
On Mon, Oct 4, 2010 at 7:16 PM, sc <[hidden email]> wrote:
> On Monday 04 October 2010 16:03:28 Ven Tadipatri wrote:
>
>> Hi,
>>   I was wondering if there was a way to paste the contents of
>> a buffer when in command line mode. For example, if I want to

>
> and i'm wondering if what you're really looking for here is
> the '*' and '#' commands -- no need to yank anything, no need

Wow, that's great! I learned two new features of vim with one e-mail
thread- using * and #, as well as how to paste buffer contents with
ctrl+r.

Thanks,
Ven


> sc
>

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

Tim Chase
On 10/05/10 15:01, Ven Tadipatri wrote:
> Wow, that's great! I learned two new features of vim with one
> e-mail thread- using * and #, as well as how to paste buffer
> contents with ctrl+r.

And hopefully you can also learn that the vim term is
"registers", not "buffers" ;-)

The right terminology will also help you as you navigate the help
files, as well as prevent confusion here on the mailing list.

-tim


--
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
BC
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

BC

> On 10/05/10 15:01, Ven Tadipatri wrote:
>
> > Wow, that's great! I learned two new features of vim with one
> > e-mail thread- using * and #, as well as how to paste buffer
> > contents with ctrl+r.
>

For what it's worth, if you don't mind using the mouse, you can also
right click on a selection, choose "copy", then at the command line
use shift-insert to paste from the clipboard.  Sometimes that can be
quicker, at least until you're adept at using the various registers
with built-in commands.

-B

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Buffers in command line?

Ven Tadipatri
On Tue, Oct 5, 2010 at 9:14 PM, BC <[hidden email]> wrote:
>
>
> For what it's worth, if you don't mind using the mouse, you can also
> right click on a selection, choose "copy", then at the command line
> use shift-insert to paste from the clipboard.  Sometimes that can be

That doesn't work when using putty, because right-click automatically pastes.
There's no menu that pops up. But I'll try that on Unix machines.


> quicker, at least until you're adept at using the various registers
> with built-in commands.

I'm hoping to get really good with the registers. Sometimes when I'm
copying things around I like
storing them in different registers (yes, I'm also getting the hang of
calling them registers rather than buffers)

Thanks for the tip,
Ven


>
> -B
>

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