The up to motion

Vim has an exciting motion I didn’t know about yet. Imagine you’ve the following expression and would like to replace the arrow function with something else. How would you do that?

let foo = (el, index) => {

}

With the so known „up to“ modifier1 how I’d call it. It allows you to do something up to a character2. Whether it is to change, delete or visually select. One could replace above with an object literal or a closure by placing the cursor after the equals sign and type dt or ct followed by an opening curly brace. This would delete anything between and the latter would also put you into insert mode.

let foo = {
         ^
}

It might not be the best example and with plugins like expand region a lot easier to do. But I do like the fact, I can still survive, maybe even in a foreign environment with nothing but vanilla vim. This is usually the case where vi plays its strenghts: It is very portable and comes almost preinstalled on any system running some sort of linux out there.

Footnotes:

1

also known as till

2

as long as it is on the same line