?

Log in

Previous Entry | Next Entry

VIM Tip of the day

VIM Tip of the day

Even as the long term Fedora VIM maintainer I'm using only a minimal subset of VIM's features and commands.
But there are lots of small tips and tricks that I think every VIM user should know about and I'll try to post them occasionally in a small series of blog posts.

So today it is about Ctrl-p. Have you ever tried to remember and pronounce a function name or maybe just a name correctly several times in a document ? That's not necessary, you just have to get it correct the first time and then use Ctrl-p to make VIM do this job for you.


Lets take this text from Volcanology of Iceland which I chose because of those hard to get correct names:

The eruption under Eyjafjallajökull ("glacier of Eyjafjöll") in 2010 was notable because the volcanic ash plume disrupted air travel in northern Europe for several weeks; however this volcano is minor in Icelandic terms. In the past, eruptions of Eyjafjallajökull have been followed by eruption of the larger volcano Katla, but after the 2010 eruption no signs of an imminent eruption of Katla were seen

If you have to type that volcano name again, just (in insert mode)type Ey and then press Ctrl-p.
Vim shows you a text menu where you can choose between

Eyjafjöll
Eyjafjallajökull

with the cursor keys and selct one with ENTER. VIM inserts the selected word into your document.

That's it, fast and easy ;-)

Comments

( 1 comment — Leave a comment )
mbooth.id.fedoraproject.org
Feb. 18th, 2014 06:31 pm (UTC)
You are a wizard.
I have been using vim 10 years and did not know about this. Thanks!
( 1 comment — Leave a comment )