Friday, January 30, 2015

Re: use cases for o_v/V/ (:help o_v)



On Thu, Jan 29, 2015 at 3:40 PM, Tim Chase <vim@tim.thechases.com> 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 vim_use+unsubscribe@googlegroups.com.
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: