Friday, April 14, 2017

What do you do when you make the wrong movement with 'c'?

Hi everyone, I'm new here... I hope you don't mind if I jump in with a question...

I often make the wrong movement when changing text with 'c'. For example, I was just editing this line in bash vi mode:

grep org:date_founded official.cross_ling.sorted.tab | cutc -d tab 6 | hist

I was in normal mode at the start of the line (having just hit <esc>k to edit the previous command), and I wanted to change the "org:date_founded" to another search string, so I typed:

wcw

This was not what I really wanted. I should have typed wcW, but now I'm stuck in insert mode with the insertion point to the left of the colon:

grep :date_founded official.cross_ling.sorted.tab | cutc -d tab 6 | hist

So I hit

<esc>cW

Except that wasn't what I wanted either. When I now hit <esc>, the cursor goes to the column before the change, which is the space after "grep". When I hit cW, it replaces the space, and I have:

grep:date_founded official.cross_ling.sorted.tab | cutc -d tab 6 | hist

And the insertion point is still to the left of the colon. I could get out of this by typing

<esc>lcW<space>

but by this point I've lost my flow.

What do you do when you use the wrong movement with a change? Do you soldier on in insert mode? Escape and undo? Escape and move to the right place before changing? Do you have habits or mnemonics that help you know where the cursor will be after you hit Escape? Or do you just chalk it up as a learning experience and try to avoid making the same mistake again?

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

Post a Comment