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