Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 941 Bytes

tip71.md

File metadata and controls

34 lines (25 loc) · 941 Bytes

Tip71: Edit the Contents of a Macro

The Problem: Nonstandard Formatting tip71_1

~

toggles the case of the letter under the cursor.

vU

uppercase the letter under the cursor.

Paste the Macro into a Document

:put a

paste the macro into the document(below the current line). "ap paste the contents of a register after the cursor position on the current line.

Edit the Text tip71_2

Yank the Macro from the Document Back into a Register

"add

the dd command performs a line-wise deletion, the register contains a trailing ^J character. this character represents a newline.

As a precaution, using a character-wise yank: tip71_3

"ay$

yank every character on that line except for the carriage return.

Discussion

:let @a=substitute(@a, '~', 'vU', 'g')

perform the same edit as before.