1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
Elvis 1.4 CUT BUFFERS Page 6-1
E6. CUT BUFFERSF
When elvis deletes text, it stores that text in a cut buffer.
This happens in both visual mode and EX mode. There is no
practical limit to how much text a cut buffer can hold.
There are 36 cut buffers: 26 named buffers ("a through "z), 9
anonymous buffers ("1 through "9), and 1 extra cut buffer (".).
In EX mode, the :move and :copy commands use a cut buffer to
temporarily hold the text to be moved/copied.
E6.1 FillingF
In visual mode, text is copied into a cut buffer when you use
the d, y, c, C, or s commands.
By default, the text goes into the "1 buffer. The text that
used to be in "1 gets shifted into "2, "2 gets shifted into "3, and
so on. The text that used to be in "9 is lost. This way, the last
9 things you deleted are still accessible.
You can also put the text into a named buffer -- "a through "z.
To do this, you should type the buffer's name (two keystrokes: a
double-quote and a lowercase letter) before the d/y/c/C/s command.
When you do this, "1 through "9 are not affected by the cut.
You can append text to one of the named buffers. To do this,
type the buffer's name in uppercase (a double-quote and an
uppercase letter) before the d/y/c/C/s command.
The ". buffer is special. It isn't affected by the d/y/c/C/s
command. Instead, it stores the text that you typed in the last
time you were in input mode. It is used to implement the . visual
command, and ^A in input mode.
In EX mode (also known as colon mode), the :delete, :change, and
:yank commands all copy text into a cut buffer. Like the visual
commands, these EX commands normally use the "1 buffer, but you can
use one of the named buffers by giving its name after the command.
For example,
:20,30y a
will copy lines 20 through 30 into cut buffer "a.
You can't directly put text into the ". buffer, or the "2
through "9 buffers.
Elvis 1.4 CUT BUFFERS Page 6-2
E6.2 Pasting from a Cut BufferF
There are two styles of pasting: line-mode and character-mode.
If a cut buffer contains whole lines (from a command like "dd")
then line-mode pasting is used; if it contains partial lines (from
a command like "dw") then character-mode pasting is used. The EX
commands always cut whole lines.
Character-mode pasting causes the text to be inserted into the
line that the cursor is on.
Line-mode pasting inserts the text on a new line above or below
the line that the cursor is on. It doesn't affect the cursor's
line at all.
In visual mode, the p and P commands insert text from a cut
buffer. Uppercase P will insert it before the cursor, and
lowercase p will insert it after the cursor. Normally, these
commands will paste from the "1 buffer, but you can specify any
other buffer to paste from. Just type its name (a double-quote and
another character) before you type the P or p.
In EX mode, the (pu)t command pastes text after a given line.
To paste from a buffer other that "1, enter its name after the
command.
E6.3 MacrosF
The contents of a named cut buffer can be executed as a series
of ex/vi commands.
To put the instructions into the cut buffer, you must first
insert them into the file, and then delete them into a named cut
buffer.
To execute a cut buffer's contents as EX commands, you should
give the EX command "@" and the name of the buffer. For example,
:@z will execute "z as a series of EX commands.
To execute a cut buffer's contents as visual commands, you
should give the visual command "@" and the letter of the buffer's
name. The visual "@" command is different from the EX "@"
command. They interpret the cut buffer's contents differently.
The visual @ command can be rather finicky. Each character in
the buffer is interpretted as a keystroke. If you load the
instructions into the cut buffer via a "zdd command, then the
newline character at the end of the line will be executed just like
any other character, so the cursor would be moved down 1 line. If
you don't want the cursor to move down 1 line at the end of each @z
command, then you should load the cut buffer by saying 0"zD
instead.
Although cut buffers may hold any amount of text, elvis can only
-1execute-0 small buffers. For EX mode, the buffer is limited to about
1k bytes. For visual mode, the buffer is limited to about 80
bytes. If a buffer is too large to execute, an error message is
Elvis 1.4 CUT BUFFERS Page 6-3
displayed.
You can't nest @ commands. You can't run @ commands from your
.exrc file, or any other :source file either. Similarly, you can't
run a :source command from within an @ command. Hopefully, these
restrictions will be lifted in a later version.
E6.4 The Effect of Switching FilesF
When elvis first starts up, all cut buffers are empty. When you
switch to a different file (via the :n or :e commands perhaps) the
9 anonymous cut buffers are emptied again, but the other 27 buffers
retain their text.
|