Type less with abbreviations
You may not know that Vim has a built-in system for expanding text abbreviations into longer strings. This has numerous applications for all types of Vim users. You might be writing prose and often have long, difficult-to-type names. Or if you’re writing code, you might have common snippets you want to insert by typing just a short abbreviation. Here’s how to save time by storing abbreviation mappings in Vim:
Add the mapping to Vim’s abbreviation registry:
:ab short_string Longer Description
In the screencast, I first define the new abbreviation. In this case, I want
spacex to expand to
Space Exploration Technologies Corp. automatically. I define it like so:
:ab spacex Space Exploration Technologies Corp.
Then, back in insert mode I simply type
spacex and when I press space, it auto expands.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?