1

I'm quite used to the very basic action of inserting some text, entering normal mode, moving to somewhere else I'd like the same text, and hitting . to do so.

This doesn't work if the insert needs to be right at the end of a line though, as in normal mode you can't move the cursor far right enough, and the insert will happen before the existing last character of the line.

What's the solution?

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
Codemonkey
  • 411
  • 4
  • 10
  • 2
    Couldn't you just use a (or A) instead of i? Or do you not know in advance in which locations you'll be inserting the text? – Rich Jan 24 '23 at 09:00
  • 3
    The solution is to be mindful about your edits and make them repeatable by default. It comes with practice and I'm afraid there is no easy recipe for that. In this case, using a instead of i might be a good start. Or A<C-a>? Anyway, the more commands you know, the better you will be at picking the right one. – romainl Jan 24 '23 at 09:02
  • It's strange. When I started with vim I regularly used a....... and at some point my brain seems to have forgotten it and I've always defaulted to i instead. – Codemonkey Jan 24 '23 at 09:30

1 Answers1

2

With :set virtualedit=onemore you would be able to move the one extra space to the right.

Friedrich
  • 1,846
  • 1
  • 11
  • 21
  • Thanks Friedrich, I assumed there would be a 1 or 2 keystroke combination that would do what I wanted, but a global setting is maybe a good solution. Though I think @Rich is right in the comment on my question, and I should just have known that a was a thing – Codemonkey Jan 24 '23 at 09:29
  • 1
    @Codemonkey using a is probably the better solution. Judging from your question I assumed it was not applicable. – Friedrich Jan 24 '23 at 09:32