0

Possible Duplicate:
Writing a vim function to insert a block of static text

How can i add multi line abbreviations in vi editor ?
I am using vi from ssh terminal.

if i type "head " the vi should replace "head" with 2 line sentence in the format as shown below

MAINTENANCE HISTORY
DATE AUTHOR AND DETAILS

Thanks.

Community
  • 1
  • 1
basilbc
  • 69
  • 1
  • 1
  • 9
  • dupe of http://stackoverflow.com/questions/690386/writing-a-vim-function-to-insert-a-block-of-static-text? – zsalzbank Jan 06 '11 at 02:23

1 Answers1

0

With vim you can do:

:iab head MAINTENANCE HISTORY<CR>DATE AUTHOR AND DETAILS

(Or use imap/inoremap instead of iab if you don't want to have to insert whitespace/punctuation before it activates) No clue if this is possible in vi.

frabjous
  • 1,019
  • 9
  • 13
  • yes that will do. I was also looking to insert system date too. so far it is under the iab dts strftime("%d-%m-%y") & i need to type this separately. Is there any way to insert "# BAS TR-ORIGINAL" string as last line. – basilbc Jan 06 '11 at 03:48
  • I think that would be OS-specific. On Unix-type systems and vim, try `iab head MAINTENANCE HISTORY=system("echo -n $(date)") BASTR-ORIGINAL` – frabjous Jan 06 '11 at 04:28