Why can't I insert at the end of a line in vim if there's no whitespace at the end? Let's take for example my SSH config file:

enter image description here

I try to use $, l, e, but I can't seem to get to the end of the word. When I start typing in insert mode, I get the following:

enter image description here

What gives? How do I make sure I can insert at the very end of a line?

2 Answers 2


What you want is to use is the a command instead of the i command to enter insert mode. Or if you want to jump to the end of the line and start insert mode, use A. Note that I will jump to the beginning of the line and enter insert mode.

  • 1
    Works, thanks. Note that I didn't put I, but l, which look the same :/ May 23, 2015 at 2:06
  • I did see that, but it was clear from context that you were trying to position the cursor for the i command, so I responded accordingly.
    – Heptite
    May 23, 2015 at 2:07

You can also put set ve+=onemore into your .vimrc; that'll let you put the cursor onto the "empty" space at the end of every line.  Note that $ will still put you on the last character; you'll need to use something like $l (lowercase "L"),  /$Enter or  99| (vertical bar).

  • 1
    noremap $ $l seems like a reasonable addition to .vimrc to me :)
    – Samie Bee
    May 23, 2020 at 18:21
  • 1
    In addition to what Samy stated: by default, if the virtualedit option is set to onemore you can use g$ to put the cursor onto the "empty" space at the end of any line. That is, there is no need to map the $ key to $l.
    – gfe
    Jun 1, 2020 at 4:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .