Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting at the end of a line in VIM

Tags:

vim

So for a long time I've had a bad habit of going to the end of a line, hitting the i key and then hitting the right arrow to insert after that last character. However, this is extremely inefficient and impossible to do with hjkl.

What's a better way to insert at the VERY end of the line?

like image 277
GenTel Avatar asked Jan 15 '17 04:01

GenTel


People also ask

How do I paste at the end of a line in Vim?

Therefore, the key sequence would from command mode, A to get into insert mode at end of line, <space> to insert a space, then Ctrl-v to paste. Alternatively, while in insert mode, use the mouse to put the cursor at the end of a line, <space> then Ctrl-v .

How do I add a character to the end of a line in Vim?

On a character in the first line, press Ctrl-V (or Ctrl-Q if Ctrl-V is paste). Press jj to extend the visual block over three lines. Press $ to extend the visual block to the end of each line.

How do you add a word at the end of each line in Vim?

In a visual block, you can insert text in each line before the selection with I , and you can append text in each line after the selection with A . If you use $ to convert the visual selection to select to the end of line, then A will append text to the end of each line in the visual block.

How do I add a line to the end of a file in Vim?

To type the "^A" first press Ctrl-V, then press Ctrl-A. You can then use Ctrl-A to append at the end of the file when not in insert or visual mode.


Video Answer


1 Answers

Use A command instead of i. The command appends text at the end of the line. See :help A.


In normal mode press A (uppercase). Vim will be switched to insert mode, and the cursor will be moved to the end of the current line ready for input.

like image 81
Ruslan Osmanov Avatar answered Nov 10 '22 01:11

Ruslan Osmanov