Select from beginning of line to dot (".")?

I’m on a line, but not at the beginning. The line has a file name and I’d like to change the base name (not the extension). How do I select everything from the beginning of the line up to, but excluding, the first dot (".")?

The closest I got was Alt+i, c, ^.,. and this selected everything from the second character of the line up to but excluding the dot. Can I do this without first moving to the beginning of the line?

Thanks.

xs^[^\.]+<ret>
works without going to the start of the line
if that’s a pain to type make a command out of it
:def select-to-dot %{ exec xs^[^\.]+<ret> }

It’s a lot easier if you just go to the start of the line with
ght.
but this has the disadvantage of wrapping to the next line.

3 Likes

Any specific reason why you don’t want to move to the beginning of the line? Your selection will change anyway.

I was wondering if there were a special trick that allow me to think of the selection more like “select a thing” or “select surrounding a thing”, rather than a line-oriented way of thinking about it. It feels more like “select a basename”, so I’d probably find it easier to remember by thinking of it this way rather than “select the text from the beginning of the line”.