Home Explore Blog CI



neovim

27th chunk of `runtime/doc/insert.txt`
88a9ddce9b0f0d4d127d39c6e8b0e21f02509822a3757c100000000100000fa1
 used to insert new text into the buffer.  They
can all be undone and repeated with the "." command.

							*a*
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!

							*A*
A			Append text at the end of the line [count] times.
			For using "A" in Visual block mode see |v_b_A|.

<insert>	or				*i* *insert* *<Insert>*
i			Insert text before the cursor [count] times.
			When using CTRL-O in Insert mode |i_CTRL-O| the count
			is not supported.

							*I*
I			Insert text before the first non-blank in the line
			[count] times.
			When the 'H' flag is present in 'cpoptions' and the
			line only contains blanks, insert start just before
			the last blank.
			For using "I" in Visual block mode see |v_b_I|.

							*gI*
gI			Insert text in column 1 [count] times.

							*gi*
gi			Insert text in the same position as where Insert mode
			was stopped last time in the current buffer.
			This uses the |'^| mark.  It's different from "`^i"
			when the mark is past the end of the line.
			The position is corrected for inserted/deleted lines,
			but NOT for inserted/deleted characters.
			When the |:keepjumps| command modifier is used the |'^|
			mark won't be changed.

							*o*
o			Begin a new line below the cursor and insert text,
			repeat [count] times.

							*O*
O			Begin a new line above the cursor and insert text,
			repeat [count] times.

These commands are used to start inserting text.  You can end insert mode with
<Esc>.  See |mode-ins-repl| for the other special characters in Insert mode.
The effect of [count] takes place after Insert mode is exited.

The following |default-mappings| insert text, but stay in normal mode:

							*]<Space>*
]<Space>		Insert an empty line below the cursor without leaving
			Normal mode, repeat [count] times.

							*[<Space>*
[<Space>		Insert an empty line above the cursor without leaving
			Normal mode, repeat [count] times.

When 'autoindent' is on, the indent for a new line is obtained from the
previous line.  When 'smartindent' or 'cindent' is on, the indent for a line
is automatically adjusted for C programs.

'formatoptions' can be set to copy the comment leader when opening a new
line.

'textwidth' can be set to the maximum width for a line.  When a line becomes
too long when appending characters a line break is automatically inserted.


==============================================================================
9. Ex insert commands					*inserting-ex*

							*:a* *:append*
:{range}a[ppend][!]	Insert several lines of text below the specified
			line.  If the {range} is missing, the text will be
			inserted after the current line.
			Adding [!] toggles 'autoindent' for the time this
			command is executed.

							*:i* *:in* *:insert*
:{range}i[nsert][!]	Insert several lines of text above the specified
			line.  If the {range} is missing, the text will be
			inserted before the current line.
			Adding [!] toggles 'autoindent' for the time this
			command is executed.

These two commands will keep on asking for lines, until you type a line
containing only a ".".  Watch out for lines starting with a backslash, see
|line-continuation|.

Text typed after a "|" command separator is used first. So the following
command in ex mode: >
	:a|one
	two
	.
	:visual
appends the following text, after the cursor line: >
	one
	two
<
NOTE: These commands cannot be used with |:global| or |:vglobal|.
":append" and ":insert" don't work properly in between ":if" and
":endif", ":for" and ":endfor", ":while" and ":endwhile".

							*:start* *:startinsert*
:star[tinsert][!]	Start Insert mode (or |Terminal-mode| in a |terminal|
			buffer) just after executing this command.
			Works like typing "i" in Normal mode.  When the ! is
			included it works like "A", append to the line.
			Otherwise insertion starts at the cursor position.
			Note that when using this command in a function or
			script,

Title: Vim Insert Mode Commands and Ex Insert Commands
Summary
This section details various Vim insert mode commands for adding text, including 'a' (append after cursor), 'A' (append at end of line), 'i' (insert before cursor), 'I' (insert before first non-blank), 'gI' (insert in column 1), 'gi' (insert at last insert position), 'o' (new line below), and 'O' (new line above). It also explains how to use these commands with counts and special conditions like 'autoindent' and 'textwidth'. Additionally, it introduces Ex insert commands ':a' (append) and ':i' (insert), and ':startinsert' to enter insert mode after executing a command.