Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The behavior of ; to repeat the last t command bothers me. Can you help me make it better?

Tags:

Okay, suppose we have a line of text:

[s]tackoverflow rocks

where the brackets show the location of the cursor, in normal mode. After pressing tr, you get:

stackov[e]rflow rocks

Now for the fun part. What happens if you push ; to repeat the command? Nothing! Vim finds the next 'r' (immediately to the right of the cursor) and positions itself just left of that (where it already was).

I would prefer that ; advance the cursor to this position:

stackoverflow[ ]rocks

This can be achieved by using l to move right one character before pressing ;, but the extra step is irritating. There is a similar issue with T, but not with f and F. Is there some way to make ; behave the way I want with t and T?

like image 859
Drew Frank Avatar asked Oct 06 '09 04:10

Drew Frank


1 Answers

As of Vim version 7.3.235 this annoyance has been amended. Now the default is the behaviour you had expected in the first place: ; makes the cursor jump to right before the second "r".

This was the patch announcement:

Patch 7.3.235
Problem: ";" gets stuck on a "t" command, it's not useful.
Solution: Add the ';' flag in 'cpo'. (Christian Brabandt)

The old behaviour has been demoted to a compatibility option. You can bring it back with :set cpo+=;. See :h cpo-;.

like image 194
glts Avatar answered Oct 06 '22 14:10

glts