Home Explore Blog CI



neovim

4th chunk of `runtime/doc/usr_24.txt`
07f9729b65022a65dc2f6a5c6b4e8899524857dc46ce11950000000100000fa0
 make sure
filetype plugins are enabled.  Your vimrc file should contain a line like
this: >
	filetype plugin on
Or: >
	filetype plugin indent on

For C code you need to create a tags file and set the 'tags' option.  That is
explained |ft-c-omni|.  For other filetypes you may need to do something
similar, look below |compl-omni-filetypes|.  It only works for specific
filetypes.  Check the value of the 'omnifunc' option to find out if it would
work.

==============================================================================
*24.4*	Repeating an insert

If you press CTRL-A, the editor inserts the text you typed the last time you
were in Insert mode.
   Assume, for example, that you have a file that begins with the following: >

	"file.h" ~
	/* Main program begins */ ~

You edit this file by inserting "#include " at the beginning of the first
line: >

	#include "file.h" ~
	/* Main program begins */ ~

You go down to the beginning of the next line using the commands "j^".  You
now start to insert a new "#include" line.  So you type: >

	i CTRL-A

The result is as follows: >

	#include "file.h" ~
	#include /* Main program begins */ ~

The "#include " was inserted because CTRL-A inserts the text of the previous
insert.  Now you type  "main.h"<Enter>  to finish the line: >


	#include "file.h" ~
	#include "main.h" ~
	/* Main program begins */ ~

The CTRL-@ command does a CTRL-A and then exits Insert mode.  That's a quick
way of doing exactly the same insertion again.

==============================================================================
*24.5*	Copying from another line

The CTRL-Y command inserts the character above the cursor.  This is useful
when you are duplicating a previous line.  For example, you have this line of
C code:

	b_array[i]->s_next = a_array[i]->s_next; ~

Now you need to type the same line, but with "s_prev" instead of "s_next".
Start the new line, and press CTRL-Y 14 times, until you are at the "n" of
"next":

	b_array[i]->s_next = a_array[i]->s_next; ~
	b_array[i]->s_ ~

Now you type "prev":

	b_array[i]->s_next = a_array[i]->s_next; ~
	b_array[i]->s_prev ~

Continue pressing CTRL-Y until the following "next":

	b_array[i]->s_next = a_array[i]->s_next; ~
	b_array[i]->s_prev = a_array[i]->s_ ~

Now type "prev;" to finish it off.

The CTRL-E command acts like CTRL-Y except it inserts the character below the
cursor.

==============================================================================
*24.6*	Inserting a register

The command CTRL-R {register} inserts the contents of the register.  This is
useful to avoid having to type a long word.  For example, you need to type
this:

	r = VeryLongFunction(a) + VeryLongFunction(b) + VeryLongFunction(c) ~

The function name is defined in a different file.  Edit that file and move the
cursor on top of the function name there, and yank it into register v: >

	"vyiw

"v is the register specification, "yiw" is yank-inner-word.  Now edit the file
where the new line is to be inserted, and type the first letters:

	r = ~

Now use CTRL-R v to insert the function name:

	r = VeryLongFunction ~

You continue to type the characters in between the function name, and use
CTRL-R v two times more.
   You could have done the same with completion.  Using a register is useful
when there are many words that start with the same characters.

If the register contains characters such as <BS> or other special characters,
they are interpreted as if they had been typed from the keyboard.  If you do
not want this to happen (you really want the <BS> to be inserted in the text),
use the command CTRL-R CTRL-R {register}.

==============================================================================
*24.7*	Abbreviations

An abbreviation is a short word that takes the place of a long one.  For
example, "ad" stands for "advertisement".  Vim enables you to type an
abbreviation and then will automatically expand it for you.
   To tell Vim to expand "ad" into "advertisement" every time you insert

Title: Vim User Manual: Repeating Inserts, Copying Lines, Inserting Registers and Abbreviations
Summary
This section explains how to repeat inserts using CTRL-A (repeat last insert) and CTRL-@ (repeat and exit insert mode). It describes copying from another line using CTRL-Y (character above) and CTRL-E (character below). It details inserting register contents using CTRL-R {register} and CTRL-R CTRL-R to avoid interpreting special characters. The section ends with a description of how to use abbreviations for quick text expansion.