Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 4: | Line 4: | ||
|previous=427 |
|previous=427 |
||
|next=431 |
|next=431 |
||
− | |created=2003 |
+ | |created=February 18, 2003 |
|complexity=basic |
|complexity=basic |
||
|author=Dubhead |
|author=Dubhead |
||
Line 55: | Line 55: | ||
* works at the beginning of a line |
* works at the beginning of a line |
||
* terminates at the end of a line (doesn't do anything weird) |
* terminates at the end of a line (doesn't do anything weird) |
||
− | * doesn't overwrite the unnamed (last used) register < |
+ | * doesn't overwrite the unnamed (last used) register <tt>@"</tt> |
<pre> |
<pre> |
||
Line 67: | Line 67: | ||
What it does: |
What it does: |
||
− | # Cancel insert mode and save < |
+ | # Cancel insert mode and save <tt>@"</tt> to <tt>@z</tt>. This macro will overwrite register z and mark z. Use temporary ones that you would never use manually. |
# Mark position z. |
# Mark position z. |
||
# Move up, and then move right only if the cursor was not at the beginning of the line on an empty line. |
# Move up, and then move right only if the cursor was not at the beginning of the line on an empty line. |
||
− | # If the cursor is now at the end of the line, do nothing (and clear < |
+ | # If the cursor is now at the end of the line, do nothing (and clear <tt>@"</tt> so the paste doesn't duplicate the last paste). Otherwise yank to the next word. |
# Go back to mark z and paste. |
# Go back to mark z and paste. |
||
− | # Restore < |
+ | # Restore <tt>@"</tt> and go into insert mode after the pasted text. |
You can also change the mapping to yank to the end of a word (change "yw" to "ye" on the third line). |
You can also change the mapping to yank to the end of a word (change "yw" to "ye" on the third line). |