Append after last character in line in vim editor
8,539
Solution 1
just press A:
A Append text at the end of the line [count] times.
(from :help A
)
your initial try is not working because you go to EOL with $, but then you use i instead of a:
i Insert text before the cursor [count] times.
When using CTRL-O in Insert mode |i_CTRL-O| the count
is not supported.
while
a Append text after the cursor [count] times. If the
cursor is in the first column of an empty line Insert
starts there. But not when 'virtualedit' is set!
but as i said: the real solution is A.
Solution 2
Create a .vimrc file in your home directory. An empty one will do. This will get vim out of its default vi compatibility mode. This will allow you to move the cursor to the end of the line using End or the arrow keys when in insert mode.
Related videos on Youtube
Author by
mit
Updated on September 17, 2022Comments
-
mit over 1 year
I am using vim in the cygwin terminal right now.
I am looking for a way to go behind the last character of a line to append words. When I use
$i
all I type is inserted before the last character. -
Daenyth almost 14 yearsThis doesn't address the question at all.
-
eylon shabtay almost 14 yearsEdited to explain how getting out of compatibility mode can help.
-
mit almost 14 yearsActually this is what I really wanted. I was not aware that on all my other (non cygwin) installations the .vimrc file already existed. This explains the unused behaviouor of vim on cygwin.
-
eylon shabtay almost 14 yearsOr they disable vi compatibility mode in vim's global config.