Home Explore Blog CI



neovim

5th chunk of `runtime/doc/usr_24.txt`
d1be76a31abb57326b4126d57d5b8567fcf6a9821a6514370000000100000fa6
 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 it,
use the following command: >

	:iabbrev ad advertisement

Now, when you type "ad", the whole word "advertisement" will be inserted into
the text.  This is triggered by typing a character that can't be part of a
word, for example a space:

	What Is Entered		What You See
	I saw the a		I saw the a ~
	I saw the ad		I saw the ad ~
	I saw the ad<Space>	I saw the advertisement<Space> ~

The expansion doesn't happen when typing just "ad".  That allows you to type a
word like "add", which will not get expanded.  Only whole words are checked
for abbreviations.


ABBREVIATING SEVERAL WORDS

It is possible to define an abbreviation that results in multiple words.  For
example, to define "JB" as "Jack Benny", use the following command: >

	:iabbrev JB Jack Benny

As a programmer, I use two rather unusual abbreviations: >

	:iabbrev #b /****************************************
	:iabbrev #e <Space>****************************************/

These are used for creating boxed comments.  The comment starts with #b, which
draws the top line.  I then type the comment text and use #e to draw the
bottom line.
   Notice that the #e abbreviation begins with a space.  In other words, the
first two characters are space-star.  Usually Vim ignores spaces between the
abbreviation and the expansion.  To avoid that problem, I spell space as seven
characters: <, S, p, a, c, e, >.

	Note:
	":iabbrev" is a long word to type.  ":iab" works just as well.
	That's abbreviating the abbreviate command!


FIXING TYPING MISTAKES

It's very common to make the same typing mistake every time.  For example,
typing "teh" instead of "the".  You can fix this with an abbreviation: >

	:abbreviate teh the

You can add a whole list of these.  Add one each time you discover a common
mistake.


LISTING ABBREVIATIONS

The ":abbreviate" command lists the abbreviations: >

	:abbreviate
	i  #e		  ****************************************/
	i  #b		 /****************************************
	i  JB		 Jack Benny
	i  ad		 advertisement
	!  teh		 the

The "i" in the first column indicates Insert mode.  These abbreviations are
only active in Insert mode.  Other possible characters are:

	c	Command-line mode			:cabbrev
	!	both Insert and Command-line mode	:abbreviate

Since abbreviations are not often useful in Command-line mode, you will mostly
use the ":iabbrev" command.  That avoids, for example, that "ad" gets expanded
when typing a command like: >

	:edit ad


DELETING ABBREVIATIONS

To get rid of an abbreviation, use the ":unabbreviate" command.  Suppose you
have the following abbreviation: >

	:abbreviate @f fresh

You can remove it with this command: >

	:unabbreviate @f

While you type this, you will notice that @f is expanded to "fresh".  Don't
worry about this, Vim understands it anyway (except when you have an
abbreviation for "fresh", but that's very unlikely).
   To remove all the abbreviations: >

	:abclear

":unabbreviate" and ":abclear" also come in the variants for Insert mode
(":iunabbreviate

Title: Vim User Manual: Abbreviations - Defining, Using, Listing, and Deleting
Summary
This section focuses on Vim abbreviations, which allow short words to expand into longer text automatically. It covers defining abbreviations using `:iabbrev`, including multi-word abbreviations and workarounds for spaces. It discusses using abbreviations for fixing common typing mistakes and listing them with `:abbreviate`, noting the different modes (Insert, Command-line, both). Finally, it explains how to delete abbreviations using `:unabbreviate` and `:abclear`.