Vim Tips Wiki
No edit summary
 
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=481
 
|id=481
  +
|previous=480
|title=abbreviations only on shortcut
 
  +
|next=482
|created=June 3, 2003 15:44
+
|created=June 3, 2003
 
|complexity=basic
 
|complexity=basic
 
|author=maurice
 
|author=maurice
 
|version=6.0
 
|version=6.0
 
|rating=14/11
 
|rating=14/11
 
}}
|text=
 
Actually, this is just a more flexible completion.
+
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>).
I made the following (example) to have a unique abbreviation:
 
   
 
This is to avoid the completion if you really want to write 'date'.
   
 
And now this mapping:
   
iabbrev date^A <c-r>=strftime("%F")<cr>
+
inoremap <c-b> <c-v><c-a><c-[>a
   
 
Now type date<c-b> in insert-mode and you will get the date.
   
 
==Comments==
 
So why not just use this?
   
Note that ^A is Control-A (insert with <c-v><c-a>).
+
iabbrev date^B <c-r>=strftime("%F")<cr>
 
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.
 
 
 
}}
 
 
== 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.
 
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.
   
salmanhalim--AT--hotmail.com
 
, May 5, 2004 21:28
 
 
----
 
----
<!-- parsed by vimtips.py in 0.493019 seconds-->
 

Revision as of 06:46, 4 November 2007

Tip 481 Printable Monobook Previous Next

created June 3, 2003 · complexity basic · author maurice · version 6.0


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.

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.