{"id":25,"date":"2014-07-06T00:00:17","date_gmt":"2014-07-05T22:00:17","guid":{"rendered":"http:\/\/kurt.www.pinboard.jp\/blog\/?p=25"},"modified":"2014-07-15T17:11:04","modified_gmt":"2014-07-15T15:11:04","slug":"25","status":"publish","type":"post","link":"http:\/\/kurt.www.pinboard.jp\/blog\/kurt\/25\/","title":{"rendered":"undo &#8211; redo"},"content":{"rendered":"<p>Quite obviously, there are people who do not know about the undo and redo functions when editing in vim. That&#8217;s a pity, because it is really helpful. I frequently use this when testing the effects of some small changes in configuration files or scripts;<!--more--> just leave the editor open in one window, make the changes, save the file and run the script or program in another terminal window to check the outcome of the changes. If it does not work as you intended and you want to go back, simply use the undo command as often as necessary to go back to the point where you want to be. This way you can be sure you really undo exactly the changes you made and do not inadvertently introduce a mistake.<\/p>\n<p>All these commands are used in <em>normal mode<\/em>.<\/p>\n<table border=\"0\">\n<tbody valign=\"top\">\n<tr>\n<td style=\"background-color:lightyellow; color: green;\">u<\/td>\n<td>undo the last edit<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:lightyellow; color: green;\">CTRL-r<\/td>\n<td>redo the last edit (undo the last undo)<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:lightyellow; color: green;\">U<\/td>\n<td>undo all the edits in the last line edited<\/p>\n<p>This only works on the last line edited. Once you make an edit to another line, this command then attaches itself to that line.<\/p>\n<p>You can undo and redo all changes you made to the last line edited as often as you want:<\/p>\n<ol>\n<li>make some changes in a line<\/li>\n<li><span style=\"color: green;\">ESC<\/span> \u21d2 go back to command mode; do <i>not<\/i> edit another line<\/li>\n<li><span style=\"color: green;\">U<\/span> \u21d2 undo all changes in the line<\/li>\n<li><span style=\"color: green;\">U<\/span> \u21d2 redo all changes in the line (undo the undo)<\/li>\n<li><span style=\"color: green;\">U<\/span> \u21d2 undo all changes in the line again (undo the undo of the undo)<\/li>\n<li>&#8230;<\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>There are more ways to undo and redo, there is branching in the undo stack and you can go back and forth to specific times. Check out <span style=\"color: green;\">:help undo<\/span> if you are interested. I won&#8217;t mention those commands here, that would be too big a bite to swallow at once.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quite obviously, there are people who do not know about the undo and redo functions when editing in vim. That&#8217;s a pity, because it is really helpful. I frequently use this when testing the effects of some small changes in configuration files or scripts;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[4],"_links":{"self":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/25"}],"collection":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":4,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":43,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions\/43"}],"wp:attachment":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}