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

Answer by Peter Rincker for Unexpected behavior from cb command

$
0
0

The b motion is an exclusive motion. Visual mode is inclusive by default (See :h 'selection').

From :h exclusive:

A character motion is either inclusive or exclusive.  When inclusive, the
start and end position of the motion are included in the operation.  When
exclusive, the last character towards the end of the buffer is not included.
Linewise motions always include the start and end position.

You are using b when you probably want to use the iw text object instead, e.g. cb vs ciw. See :h iw and :h text-objects.

You can also force inclusivity on a motion by using v after an operator, e.g. cvb will do a change over motion b but inclusively. See :h o_v.


Viewing all articles
Browse latest Browse all 3

Trending Articles



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