Skip to content

Commit f5be1ea

Browse files
dfishburnvim-scripts
authored andcommitted
Version 1.6
NF: YRSearch is similar to YRGetElem. Given a regular expression it will interactively display all the elements in the yankring that match the regular expression. You can enter the number of the element to paste it. If you have many elements within the yankring, this can help you identify them more easily. NF: Updated the default history size from 30 to 100, which is partially the reason for the YRSearch command. NF: By default it supports "gp" and "gP", in addition to "p" and "P". NF: Added support for the expression register (:h quote=). Here is an example of how it is used: "="X"<CR>P
1 parent 049a0f5 commit f5be1ea

File tree

2 files changed

+227
-38
lines changed

2 files changed

+227
-38
lines changed

doc/yankring.txt

Lines changed: 89 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
*yankring.txt* For Vim version 6.2.
22

3-
Author: David Fishburn March 28, 2005
4-
Version: 1.4
3+
Author: David Fishburn May 7, 2005
4+
Version: 1.6
55

66
For instructions on installing this file, type
77
:help add-local-help |add-local-help| inside Vim.
@@ -32,6 +32,7 @@ For instructions on installing this file, type
3232
4.13 YRReplace.........................: |YRReplace|
3333
4.14 YRMapsCreate......................: |YRMapsCreate|
3434
4.15 YRMapsDelete......................: |YRMapsDelete|
35+
4.16 YRSearch..........................: |YRSearch|
3536
5. Tutorial...............................: |yankring-tutorial|
3637
5.1 YRShow............................: |YRShow-example|
3738
5.2 YRReplace.........................: |YRReplace-example|
@@ -44,6 +45,7 @@ For instructions on installing this file, type
4445
5.9 Visual modes......................: |yankring-visual-example|
4546
5.10 Using ranges......................: |YRYankRange-example|
4647
5.11 :global...........................: |global-example|
48+
5.12 YRSearch..........................: |YRSearch-example|
4749
6. History................................: |yankring-history|
4850

4951
==============================================================================
@@ -254,6 +256,7 @@ For instructions on installing this file, type
254256

255257
4.2 YRClear *YRClear*
256258
Clears all elements from the yankring.
259+
See also |YRClear-example|.
257260

258261

259262
4.3 YRShow *YRShow*
@@ -280,7 +283,8 @@ For instructions on installing this file, type
280283

281284
Examples: >
282285
:YRSetTop 3 " Sets element 3 as the next pasted element
283-
<
286+
< See also |YRSetTop-example|.
287+
284288

285289
4.5 YRGetElem *YRGetElem*
286290
This command has two modes. If no parameters are provided, it
@@ -290,7 +294,8 @@ For instructions on installing this file, type
290294
number specified is outside of the yankring an error is returned.
291295
You may want to create a separate mapping for this call. >
292296
nnoremap <silent> <Leader>yr :YRGetElem<CR>
293-
<
297+
< See also |YRSearch|.
298+
294299
Examples:
295300
Assume there are 10 elements in the yankring and element 6 is
296301
at the top of the ring. >
@@ -299,7 +304,8 @@ For instructions on installing this file, type
299304
:YRGetElem 12 " Will paste element 6.
300305
:YRGetElem 99 " Error, invalid choice is reported
301306
:YRGetElem 0 " Error, invalid choice is reported
302-
<
307+
< See also |YRGetElem-example|.
308+
303309

304310
4.6 YRGetMultiple *YRGetMultiple*
305311
Will paste many elements from the yankring in one command.
@@ -317,7 +323,8 @@ For instructions on installing this file, type
317323
:YRGetMultiple 12 " Will paste elements 6,5,4,3,2,1,10,9,8,7
318324
:YRGetMultiple 99 " Will paste elements 6,5,4,3,2,1,10,9,8,7
319325
:YRGetMultiple 0 " Will paste element 6
320-
<
326+
< See also |YRGetMultiple-example|.
327+
321328

322329
4.7 YRPush *YRPush*
323330
Allows the user to "push" additional entries into the yankring.
@@ -329,7 +336,8 @@ For instructions on installing this file, type
329336
:YRPush " Push the " register's contents
330337
:YRPush * " Push the * register's contents (clipboard)
331338
:YRPush a " Push the "a register's contents
332-
<
339+
< See also |YRPush-example|.
340+
333341

334342
4.8 YRPop *YRPop*
335343
Allows you to pop off the top elements from the yankring. You
@@ -343,7 +351,8 @@ For instructions on installing this file, type
343351
yankring
344352
:YRPop 5 " Removes the 5 highest numbered elements from the
345353
yankring
346-
<
354+
< See also |YRPop-example|.
355+
347356

348357
4.9 YRYankCount *YRYankCount*
349358
This command has the most mappings created for it. If you are
@@ -384,6 +393,7 @@ For instructions on installing this file, type
384393
and the "a register.
385394
10"zyy - Places 10 lines into both the yankring and the "z
386395
register.
396+
See also |yankring-tutorial|.
387397

388398

389399
4.10 YRYankRange *YRYankRange*
@@ -401,10 +411,11 @@ For instructions on installing this file, type
401411
Repeat using V and Control-V.
402412

403413
Normal mode
404-
-----------
414+
----------- >
405415
:5,20YRYankRange " Will yank lines 5-20 into the yankring
406416
:5,20YRDeleteRange " Will delete lines 5-20 and add them to
407417
the yankring
418+
< See also |YRYankRange-example|.
408419

409420

410421
4.11 YRDeleteRange *YRDeleteRange*
@@ -426,6 +437,7 @@ For instructions on installing this file, type
426437
"ap " Ignore the yankring and paste the contents of register "a
427438
5"ap " Ignore the yankring and paste the contents of register "a
428439
5 times
440+
See also |yankring-tutorial|.
429441

430442

431443
4.13 YRReplace *YRReplace*
@@ -450,6 +462,15 @@ For instructions on installing this file, type
450462
This public function removes the yankring maps and disables
451463
the yankring. This function is called by the YRToggle command.
452464

465+
466+
4.16 YRSearch *YRSearch*
467+
This command is similar to |YRGetElem|. The command takes
468+
one parameter which is a regular expression. Similar to
469+
YRGetElem, it will display all items in the yankring that match
470+
the regular expression. It is also interactive, and will
471+
prompt you to enter which match you wish pasted.
472+
See also |YRSearch-example|.
473+
453474

454475
==============================================================================
455476
5. Tutorial *yankring-tutorial*
@@ -554,6 +575,7 @@ For instructions on installing this file, type
554575
which so happened to be the line 'two^@'. Since it had a
555576
newline character in it (when it was yanked) the newline is
556577
included when it is pasted.
578+
557579
*YRPush-example*
558580
Assume you need to paste text from the system clipboard, and this
559581
is text you will need routinely. We can simulate this by running
@@ -717,7 +739,50 @@ For instructions on installing this file, type
717739
order, therefore the elements are reversed. Using YRGetMultiple! will
718740
paste the elements in FIFO (First In First Out) maintaining the order of
719741
the original buffer (since you read and yanked from top to bottom).
720-
*YRPop-example*
742+
743+
*YRSearch-example*
744+
You can remove elements from the top of the yankring with the YRPop
745+
command. It optionally takes one parameter. >
746+
:YRShow
747+
--- YankRing ---
748+
Elem Content
749+
4 Three Mississippi
750+
3 Two Mississippi
751+
2 One Mississippi
752+
1 @", '\\/.*$^~[]' )
753+
:YRSearch Mississippi
754+
--- YankRing ---
755+
Elem Content
756+
4 Three Mississippi
757+
3 Two Mississippi
758+
2 One Mississippi
759+
:Enter # to paste:
760+
< Consider some items which require escaping the search string: >
761+
:YRSearch @", '\\
762+
--- YankRing ---
763+
Elem Content
764+
1 @", '\\/.*$^~[]' )
765+
:Enter # to paste:
766+
< Forward slashes and various other symbols require escapes, in this
767+
case the slash was not escaped enough: >
768+
:YRSearch @", '\\/
769+
--- YankRing ---
770+
Elem Content
771+
:Hit ENTER or type command to continue
772+
< There are enough escapes this time: >
773+
:YRSearch @", '\\\\/
774+
--- YankRing ---
775+
Elem Content
776+
1 @", '\\/.*$^~[]' )
777+
:Enter # to paste:
778+
< Period, star, dollar and so on require one slash: >
779+
:YRSearch @", '\\\\/\.\*\$\^\~\[\]
780+
--- YankRing ---
781+
Elem Content
782+
1 @", '\\/.*$^~[]' )
783+
:Enter # to paste:
784+
785+
< *YRPop-example*
721786
You can remove elements from the top of the yankring with the YRPop
722787
command. It optionally takes one parameter. >
723788
:YRPop
@@ -772,11 +837,24 @@ For instructions on installing this file, type
772837
:g - for each line in the buffer
773838
/addme - check if the string "addme" is in the line
774839
/YRYankCount 'yy' - Ask the yankring to execute the 'yy' command
775-
840+
776841
777842
==============================================================================
778843
6. History *yankring-history*
779844

845+
1.6: April 20, 2005:
846+
NF: YRSearch is similar to YRGetElem. Given a regular expression
847+
it will interactively display all the elements in the yankring
848+
that match the regular expression. You can enter the number
849+
of the element to paste it. If you have many elements within
850+
the yankring, this can help you identify them more easily.
851+
NF: Updated the default history size from 30 to 100, which is
852+
partially the reason for the YRSearch command.
853+
NF: By default it supports "gp" and "gP", in addition to "p" and "P".
854+
NF: Added support for the expression register (:h quote=). Here
855+
is an example of how it is used:
856+
"="X"<CR>P
857+
780858
1.5: March 30, 2005:
781859
NF: The yankring now respects the cpoptions setting, if 'y' is
782860
included and you press '.', the previous yank command is executed

0 commit comments

Comments
 (0)