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?

3
  • 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
    Commented Jan 24, 2023 at 9: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
    Commented Jan 24, 2023 at 9: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
    Commented Jan 24, 2023 at 9:30

1 Answer 1

2

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

2
  • 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
    Commented Jan 24, 2023 at 9:29
  • 1
    @Codemonkey using a is probably the better solution. Judging from your question I assumed it was not applicable.
    – Friedrich
    Commented Jan 24, 2023 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.