Quantcast
Channel: Unexpected behavior from cb command - Vi and Vim Stack Exchange
Viewing all articles
Browse latest Browse all 3

Unexpected behavior from cb command

$
0
0

One of the most basic editing commands is c<motion> to change text, e.g. cw - change word, c$ - change to end of line, cc - change entire line, c3l - change 3 characters to the right.

My question is, why then does cb at the end of a word prepare for replacement, excluding the last character of the word (i.e. the character that the cursor was over when typing the command)?

vb at the end of a word will select the entire word, including the last character. Should cb not be expected to have the same behavior?

In short: The behavior of vbc is expected, but behavior of hvbc is equivalent to cb.

I'm using Vim 8.0.1350.

It seems this behavior follows more the idea that the cursor is "between" characters (insert mode) rather than "over" a character (normal mode).


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>