Move and Retain Text
By the end of this chapter, you will have copied a native region, undone a yank and inserted the same retained text into another buffer.
After leaving the previous exercise, create a new practice file and start Editing:
printf 'one two\n' > editing.txt
cargo run --locked -p rur-editor --bin rur-terminal-proof -- --profile nonmodal editing.txt
Press Home, Ctrl-Space, then Alt-f. Point moves past one and the active region
contains that word. Alt-w copies it; End then Ctrl-Y appends it at point. The
line is now one twoone. Ctrl-Z undoes that insertion; Ctrl-X Ctrl-Z redoes it.
Copy does not change text history. Ctrl-W would kill and retain the region;
delete-region through Alt-x would delete it without changing retained text.
Typing while a region is active inserts at point and deactivates the region.
Select one again with Home, Ctrl-Space, Alt-f. Through Alt-x, choose
store-region-text, enter sample, and press Enter. Ctrl-X b, slot-demo,
Enter creates another buffer. Through Alt-x, choose insert-slot, enter
sample, and press Enter. The new buffer contains one. Named slots and the
unnamed kill ring are shared across live buffers and profiles. Their values
survive closing the source buffer, but do not persist after exiting Rur.
Ctrl-Y yanks the newest unnamed retained entry. Immediately following an unnamed
yank, Alt-y rotates to an older complete entry when one exists. Motion, another
command or an incompatible context change ends that rotation opportunity.
insert-slot uses the named value instead of the unnamed ring.
Ctrl-U begins a numeric argument. Digits replace its initial value of four; a leading minus gives a signed argument where the command supports it. For example, Ctrl-U 2 Ctrl-F moves two graphemes, and Ctrl-U 2 Ctrl-Y inserts two copies as one undoable edit if the complete result fits. Ctrl-G cancels an unfinished argument. Counts do not cause a Ruby command to run once per repetition.
Alt-u/l/c changes native words using Unicode uppercase/lowercase/capitalization.
Tab and Backspace use the current indentation policy while in leading indentation;
elsewhere Backspace removes a complete grapheme. set-indentation-width and
set-display-tab-width through Alt-x change independent values. Policy changes
leave bytes unchanged; explicit indentation/normalization commands edit them.
To review a local replacement before applying it, use Alt-x search-results,
enter one, and press Enter. Press e, type three, and use Ctrl-S to stage it.
The document still contains one. Press d to inspect the exact old and new text;
Page Down reads later diff pages. Press k, then q: choose k to keep editing, x to
discard, or a to apply and close the result source. Applying changes the document
to three; Ctrl-Z restores one in one step. Use q again to close a retained
clean source before continuing. See Editable Local Result Fields
for empty-field deletion, multiline paste and all controls.
Save slot-demo with Ctrl-X Ctrl-S, choose slot-demo.txt, then Ctrl-Q to exit.
Save or discard each remaining modified buffer through its actual exit decision.
At the shell, cat slot-demo.txt should show one.
For task recipes, see Edit Regions and Repeat Changes.
Previous: Editing | Part | User Guide | Next: Repeat and Record Changes