use cases for o_v/V/<c-v> (:help o_v)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

use cases for o_v/V/<c-v> (:help o_v)

Enno
When do the operator mappings v/V/<c-v> (:help o_v) come in handy?
The obvious use cases seem covered by `t` (instead of `f`), so how
do people over here commonly use these operator mappings?


--
--
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: use cases for o_v/V/<c-v> (:help o_v)

glts
On Thursday, January 29, 2015 at 4:56:46 PM UTC+1, Enno wrote:
> When do the operator mappings v/V/<c-v> (:help o_v) come in handy?
> The obvious use cases seem covered by `t` (instead of `f`), so how
> do people over here commonly use these operator mappings?

Only one use, but one that feels quite natural for me:

dvj
cvj

-- like Shift-Down followed by Backspace in common non-modal editors.

--
--
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: use cases for o_v/V/<c-v> (:help o_v)

Ethan Hereth


Ethan Alan

On Thu, Jan 29, 2015 at 1:44 PM, glts <[hidden email]> wrote:
On Thursday, January 29, 2015 at 4:56:46 PM UTC+1, Enno wrote:
> When do the operator mappings v/V/<c-v> (:help o_v) come in handy?
> The obvious use cases seem covered by `t` (instead of `f`), so how
> do people over here commonly use these operator mappings?

Only one use, but one that feels quite natural for me:

dvj
cvj

May I ask, how is functionally different that dd or cc? Is there a side effect? AFAIKT dvj does the same thing as dd and cvj does the same think as cc. Am I missing something?
 

-- like Shift-Down followed by Backspace in common non-modal editors.

--
--
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: use cases for o_v/V/<c-v> (:help o_v)

Tim Chase
On 2015-01-29 14:56, Ethan Hereth wrote:
>> dvj
>> cvj
>
> May I ask, how is functionally different that dd or cc? Is there a
> side effect? AFAIKT dvj does the same thing as dd and cvj does the
> same think as cc. Am I missing something?

"dd" deletes the current line.  "dvj" and "vjd" delete characterwise
from the current position to the same column in the next line.  Same
goes for "c".  AFAIK, "dvj" and "vjd" behave identically (same with
"dVl" and "Vld", as well as "d^V/term<cr>" and "^V/term<cr>d").

Various motions default to behaving {character,line,block}wise, so the
use of the v/V/^V infix notation in operator-pending mode allows you
to override that.  For example, in the following paragraph:
 
  It was in Warwick Castle that I came across the curious
  stranger whom I am going to talk about.  He attracted me by
  three things: his candid simplicity, his marvelous

with the cursor on the "C" in "Castle", compare the results of an
unmodified "d/talk<cr>" with "dv/talk<cr>", "dV/talk<cr>", and
"d^V/talk<cr>".  In this case, because a search-as-motion is
characterwise, it's the same as the first one, but the behavior
differs in the 2nd two.  Likewise, try "dj" vs. "dvj" vs. "dVj"

-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: use cases for o_v/V/<c-v> (:help o_v)

glts
In reply to this post by Enno
On Thursday, January 29, 2015 at 4:56:46 PM UTC+1, Enno wrote:
> When do the operator mappings v/V/<c-v> (:help o_v) come in handy?
> The obvious use cases seem covered by `t` (instead of `f`), so how
> do people over here commonly use these operator mappings?

I had forgotten about this one:

dvb
cvb

-- occasionally useful when you want to erase backwards to the beginning
of the word, and erase the character under the cursor, too. Though in
this case, you could achieve the same using Visual mode.

--
--
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: use cases for o_v/V/<c-v> (:help o_v)

Ethan Hereth
In reply to this post by Tim Chase


On Thu, Jan 29, 2015 at 3:40 PM, Tim Chase <[hidden email]> wrote:
On 2015-01-29 14:56, Ethan Hereth wrote:
>> dvj
>> cvj
>
> May I ask, how is functionally different that dd or cc? Is there a
> side effect? AFAIKT dvj does the same thing as dd and cvj does the
> same think as cc. Am I missing something?

"dd" deletes the current line.  "dvj" and "vjd" delete characterwise
from the current position to the same column in the next line.  Same
goes for "c".  AFAIK, "dvj" and "vjd" behave identically (same with
"dVl" and "Vld", as well as "d^V/term<cr>" and "^V/term<cr>d").

Ah, bingo. I must have been trying these at the beginning of a line as I could see no difference between them and the dd/cc versions. I see and understand the difference now between them; it is obvious if you run dvj from somewhere in the middle of the line.
 
Various motions default to behaving {character,line,block}wise, so the
use of the v/V/^V infix notation in operator-pending mode allows you
to override that.  For example, in the following paragraph:

  It was in Warwick Castle that I came across the curious
  stranger whom I am going to talk about.  He attracted me by
  three things: his candid simplicity, his marvelous

with the cursor on the "C" in "Castle", compare the results of an
unmodified "d/talk<cr>" with "dv/talk<cr>", "dV/talk<cr>", and
"d^V/talk<cr>".  In this case, because a search-as-motion is
characterwise, it's the same as the first one, but the behavior
differs in the 2nd two.  Likewise, try "dj" vs. "dvj" vs. "dVj"

Great example, thanks! 

-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: use cases for o_v/V/<c-v> (:help o_v)

Arun Easi-2
In reply to this post by Enno
<c-v> is something I use quite frequently for block insertions/delete.
    :h blockwise-operators

As a simple example, to comment a bunch of adjacent shell script lines, I use:
    ^
    <c-v>jjj
    I#<esc>

v/V, very rarely, I mapped it to :n/:N

Regards,
-Arun

On Thu, Jan 29, 2015 at 7:56 AM, Enno <[hidden email]> wrote:
When do the operator mappings v/V/<c-v> (:help o_v) come in handy?
The obvious use cases seem covered by `t` (instead of `f`), so how
do people over here commonly use these operator mappings?


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