History Report a problem
Article Edit this page Discussion

Abbreviations only on shortcut

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 481Previous TipNext Tip

Created: June 3, 2003 Complexity: basic Author: maurice Minimum version: 6.0 Karma: 14/11 Imported from: Tip#481


This is just a more flexible completion.

I made the following (example) to have a unique abbreviation:

iabbrev date^A <c-r>=strftime("%F")<cr>

Note that ^A is Control-A (insert with <c-v><c-a>).

This is to avoid the completion if you really want to write 'date'.

And now this mapping:

inoremap <c-b> <c-v><c-a><c-[>a

Now type date<c-b> in insert-mode and you will get the date.

[edit] Comments

So why not just use this?

iabbrev date^B <c-r>=strftime("%F")<cr>

Admittedly, it requires you to do something after the control-b (such as another key or escape), but you would do precisely the same thing anyway with the original procedure.


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Terminator Wiki
Legend of Zelda Wiki
Flash Gordon
Everquest II Wiki
Yo-Yo Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for featured Wikia!

Send this article to a friend
"Abbreviations only on shortcut"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation