i_CTRL-R to the end of current line (and related stuff)

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

i_CTRL-R to the end of current line (and related stuff)

David Fishburn-2
I routinely use i_CTRL-R CTRL-w while typing in a command and grabbing the contents of the current word my cursor is on.

I wanted a few more options, for example, I wanted to grab from my cursor to the end of the line (i.e. y$).  To do this of course I could y$, before typing the command, which I do as a work around. But this means I have to abandon what I have already typed, then redo it.

I was trying to find in the help what options are available to me and I can't even find the one I use all the time.

:h i_CTRL-R

Shows me a bunch of special items:
'"' the unnamed register, containing the text of
the last delete or yank

So I can do:
i_CTRL-R" (to grab register ")
i_CTRL-Ra (to grab register a)

Based on the help, to find my CTRL-w, I thought it would be:
:h i_CTRL-R_CTRL-w

But that help location does not exist, even though these do:
:h i_CTRL-R_CTRL-r
:h i_CTRL-R_CTRL-w


So 2 questions:

1.  How do I find in the help where it says I can do i_CTRL-R followed by CTRL-w

2.  Does anyone have a suggestion on how I can do i_CTRL-R followed by something like y$ to get to the end of the line in some way.  I was thinking I could do this using the expression register.  i_CTRL-R= then do something like y$, but that didn't work.  If I can do something along that line, then that opens the door to using whatever standard Vim keys I need.

TIA,
David


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: i_CTRL-R to the end of current line (and related stuff)

Tim Chase
On 2015-09-11 09:34, David Fishburn wrote:
> 1.  How do I find in the help where it says I can do i_CTRL-R
> followed by CTRL-w

You're confusing i_CTRL-R & c_CTRL-R_CTRL-W

The help on the first one talks about its use in insert-mode ("i")
and the second one is about the particular sub-use in the
command-line ("c").

> 2.  Does anyone have a suggestion on how I can do i_CTRL-R followed
> by something like y$ to get to the end of the line in some way.  I
> was thinking I could do this using the expression register.
> i_CTRL-R= then do something like y$, but that didn't work.  If I
> can do something along that line, then that opens the door to using
> whatever standard Vim keys I need.

I don't know of anything easy (out-of-the-box) that gets the
*remainder* of the line.  It's pretty straight forward to get the
*entire* line using the expression register:

  <c-r>=getline('.')<cr>

You can get fairly close to what you want with

  :cnoremap <f3> <c-r>=getline('.')[col('.'):]<cr>

which will insert the contents of the current line from the cursor to
the end.  You'd have to do some fancier twiddling to get the
entire current word through the end of the line.

-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

---
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: i_CTRL-R to the end of current line (and related stuff)

Nikolay Aleksandrovich Pavlov
2015-09-11 17:06 GMT+03:00 Tim Chase <[hidden email]>:

> On 2015-09-11 09:34, David Fishburn wrote:
>> 1.  How do I find in the help where it says I can do i_CTRL-R
>> followed by CTRL-w
>
> You're confusing i_CTRL-R & c_CTRL-R_CTRL-W
>
> The help on the first one talks about its use in insert-mode ("i")
> and the second one is about the particular sub-use in the
> command-line ("c").
>
>> 2.  Does anyone have a suggestion on how I can do i_CTRL-R followed
>> by something like y$ to get to the end of the line in some way.  I
>> was thinking I could do this using the expression register.
>> i_CTRL-R= then do something like y$, but that didn't work.  If I
>> can do something along that line, then that opens the door to using
>> whatever standard Vim keys I need.
>
> I don't know of anything easy (out-of-the-box) that gets the
> *remainder* of the line.  It's pretty straight forward to get the
> *entire* line using the expression register:
>
>   <c-r>=getline('.')<cr>
>
> You can get fairly close to what you want with
>
>   :cnoremap <f3> <c-r>=getline('.')[col('.'):]<cr>

This must be col('.')-1. Remember that columns start with 1, indexes
start with zero.

>
> which will insert the contents of the current line from the cursor to
> the end.  You'd have to do some fancier twiddling to get the
> entire current word through the end of the line.
>
> -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
>
> ---
> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: i_CTRL-R to the end of current line (and related stuff)

Justin M. Keyes


On Sep 11, 2015 5:56 PM, "Nikolay Pavlov" <[hidden email]> wrote:
>
> 2015-09-11 17:06 GMT+03:00 Tim Chase <[hidden email]>:
> > On 2015-09-11 09:34, David Fishburn wrote:
> >> 1.  How do I find in the help where it says I can do i_CTRL-R
> >> followed by CTRL-w
> >
> > You're confusing i_CTRL-R & c_CTRL-R_CTRL-W
> >
> > The help on the first one talks about its use in insert-mode ("i")
> > and the second one is about the particular sub-use in the
> > command-line ("c").
> >
> >> 2.  Does anyone have a suggestion on how I can do i_CTRL-R followed
> >> by something like y$ to get to the end of the line in some way.  I
> >> was thinking I could do this using the expression register.
> >> i_CTRL-R= then do something like y$, but that didn't work.  If I
> >> can do something along that line, then that opens the door to using
> >> whatever standard Vim keys I need.
> >
> > I don't know of anything easy (out-of-the-box) that gets the
> > *remainder* of the line.  It's pretty straight forward to get the
> > *entire* line using the expression register:
> >
> >   <c-r>=getline('.')<cr>
> >
> > You can get fairly close to what you want with
> >
> >   :cnoremap <f3> <c-r>=getline('.')[col('.'):]<cr>
>
> This must be col('.')-1. Remember that columns start with 1, indexes
> start with zero.

Why not this (in insert mode):

<c-o>y$

---
Justin M. Keyes

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: i_CTRL-R to the end of current line (and related stuff)

Tim Chase
On 2015-09-11 18:02, Justin M. Keyes wrote:

>>>   <c-r>=getline('.')<cr>
>>>
>>> You can get fairly close to what you want with
>>>
>>>   :cnoremap <f3> <c-r>=getline('.')[col('.'):]<cr>
>>
>> This must be col('.')-1. Remember that columns start with 1,
>> indexes start with zero.
>
> Why not this (in insert mode):
>
> <c-o>y$

In insert mode, this would work.  However, David's use of ^R^W isn't
available in insert mode, only command-entry mode, so that wouldn't
work in this case.

-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

---
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.