Loading ...
Sorry, an error occurred while loading the content.
 

Re: Change text-object from start of line

Expand Messages
  • Nathan Neff
    ... Ah, thanks, this explains it. If I had the cursor on d and typed di( it would be ambiguous for Vim to either delete the (123) or to delete the entire
    Message 1 of 4 , Dec 2, 2011
      > On Nov 21, 10:09 pm, Nathan Neff <nathan.n...@...> wrote:
      >> I like the ci" feature in Vim, especially how
      >> you can type ci" from *outside* a quoted string.
      >>
      >> Vim figures out that I want to change the contents
      >> of the first quoted string on the line.  But, Vim only does
      >> this for single quotes and double quotes.  Why is that?
      >>
      >> For example, if my cursor is at ">" below,
      >> and I type ci" then this:
      >>
      >> >He said "Hello World"
      >>
      >> becomes this:
      >>
      >> He said ""
      >>
      >> But, if I have this line:
      >>
      >> >He said (Hello World)
      >>
      >> and I type ci( to change the contents of the parens,
      >> the cursor remains at the start of the line.
      >>
      >> Can I get Vim to treat parens, "<" etc the same as it
      >> does with quotes when the cursor is outside the quotes?.
      >>
      >
      > It may be because quotes of all kinds are the only multi-word text
      > objects which cannot span multiple lines. Additionally, in general,
      > such quotes do not nest. With these two limits, it is easy to pick out
      > the item of interest in a line. But if the object can extend multiple
      > lines, and can nest, it is not at all easy to discern the intent.
      >
      > Consider:
      >
      > abc(
      >  def(1,2,3)
      >  ghi(4))
      >
      > Placing the cursor on the 'd' and trying to operate on an ab object
      > currently (and correctly) gets all three lines. But trying to make Vim
      > guess whether you really meant this, or the block on the line itself,
      > would be difficult and/or confusing to users.
      >

      Ah, thanks, this explains it. If I had the cursor on "d" and
      typed "di(" it would be ambiguous for Vim to either delete the (123) or to
      delete the entire contents of abc()

      Thanks,
      --Nate

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.