Short for vim advanced topic (iab, AB, abbreviate)

Source: Internet
Author: User

Over the past few days, vim's learning has almost reached the level of fanaticism. I forgot to learn vim for programming. There is no way to do it. I just like it. I just hope this kind of fanatic feeling.
Abbreviation (abbreviations ):
The abbreviation is used in insert, replace, and command line mode. If you enter a abbreviated word, It will be replaced with the represented word. This allows you to reduce the number of times you enter long words. It can also be used to automatically correct frequent spelling mistakes. For example:
 
 
: Iab MS Microsoft
: Iab tihs this (iab is the same as AB, but only used in insert mode. In this article, the default iab = AB)
 
 
Example of a string that cannot be abbreviated: "a. B", "# def", "a B", "_ $ r"
 
 
The abbreviation is recognized only when you enter a non-Keyword character.
For example: ({CURSOR} is where you enter a non-Keyword character)
: AB foo four old otters
"Foo {CURSOR}" extended to "four old otters"
"Foobar {CURSOR}" not extended
"Barfoo {CURSOR}" not extended
 
 
: AB # I # include
"# I {CURSOR}" extended to "# include"
"> # I {CURSOR}" not extended
 
 
: AB; <endofline>
"Test;" not extended
"Test;" extended to "test <endofline>"
 
 
 
 
Note:
: AB hh hello
"Hh <Space>" extended to "Hello <Space>"
"Hh <Ctrl +]" expanded to "Hello"
 
If you do not want to replace the entered characters, you only need to enter Ctrl + V after the abbreviation;
 
 
To view all abbreviations, you only need to enter AB in command mode.
 
 
Abbreviations in command mode:
: Ca s set nu
: Ca sn set nonu
Clear Abbreviation:
: Una [abbreviation]
For example, una s
Clear all abbreviations:
: Abclear
 
 
References: http://vimcdoc.sourceforge.net/doc/map.html#abbreviations
 
 
 
Author lalor

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.