30.32 Using vi Abbreviations as Commands (Cut and Paste Between vi's)
Here's an example. If you have a windowing terminal or have more than one terminal, you might have vi sessions running in more than one place. Your system might have a way to transfer text between windows, but it can be easier to use files in /tmp ( 21.2 ) - especially for handling lots of text. Here are some abbreviations from my .exrc ( 4.9 ) file:
ab aW w! /tmp/jerry.temp.a ab aR r /tmp/jerry.temp.a ab bW w! /tmp/jerry.temp.b ab bR r /tmp/jerry.temp.b ...
I use those abbreviations this way. To write the current and next 45 lines to temporary file a , I type this command in one vi session:
To read those saved lines into another vi session, I use:
You can do the same thing in a single vi session by using named buffers ( 30.5 ) , but temporary files are the only method that works between two separate vi sessions.