From the course: Learning Vim
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Abbreviations
- [Instructor] I wrote my book, Forging Python, in vim. The book is written as a dialogue between Greybeard, a seasoned developer and Youngstar a bright young developer. As you can imagine, writing these names got old very quickly. To solve this, I used abbreviations. You can define an abbreviation with :abb command. So let's start vim and then :abb _ys, which is the abbreviation, space and then what it's going to expand to, Youngstar: and then enter. And now when I write, I for insert mode _ys and when I do space it will be replaced with Youngstar and now I can continue writing. And how do I do that? Try to pick an abbreviation that can't be part of a regular word. That's why I used underscore at the beginning of the abbreviation. However, if you'd like to stop an abbreviation from expanding, use Control + V. So, enter _ys and then Control + V and space, not expanded. Another use for abbreviation is to fix common typos. Let's say I often misspell receive as recieve. I can do, escape…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Configuration files1m 57s
-
(Locked)
Challenge: Set line numbers5s
-
(Locked)
Solution: Set line numbers15s
-
(Locked)
Map keys1m 14s
-
(Locked)
Challenge: Map key6s
-
(Locked)
Solution: Map key19s
-
(Locked)
Abbreviations1m 47s
-
(Locked)
Challenge: Abbreviate email14s
-
(Locked)
Solution: Abbreviate email27s
-
(Locked)
Add commands1m 35s
-
Challenge: Create command15s
-
(Locked)
Solution: Create command27s
-
(Locked)
Various settings2m 46s
-
(Locked)
Challenge: Edit .vimrc10s
-
(Locked)
Solution: Edit .vimrc34s
-
(Locked)
-
-