{"id":86,"date":"2014-09-14T00:00:26","date_gmt":"2014-09-13T22:00:26","guid":{"rendered":"http:\/\/kurt.www.pinboard.jp\/blog\/?p=86"},"modified":"2014-09-06T15:08:19","modified_gmt":"2014-09-06T13:08:19","slug":"repeat","status":"publish","type":"post","link":"http:\/\/kurt.www.pinboard.jp\/blog\/kurt\/86\/","title":{"rendered":"repeat"},"content":{"rendered":"<p>Time and time again people need to make the same single change in a document in multiple places. I often see people replacing things over and over again with <code>dw i &lt;type new word&gt; &lt;ESC&gt;<\/code>, spending a lot of time and making typing mistakes in the process. There is a very handy command to repeat the last change<!--more--> at the current position of the cursor: . Yes, just a single dot. Lots of time saved and no typing mistakes. This is one of the most worthwhile commands to remember!<\/p>\n<table>\n<tbody valign=\"top\">\n<tr>\n<td style=\"background-color: lightyellow; color: green;\">.<\/td>\n<td>repeat the last change at the current position<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let&#8217;s walk through an example. In the list on the left below, after you went shopping, you want to change <em>o todo<\/em> into <em>x done<\/em> on all the items you bought so it looks like the list on the right.<\/p>\n<table style=\"background-color: #EEEEFF;\">\n<tbody valign=\"top\">\n<tr>\n<th>before<\/th>\n<th>after<\/th>\n<\/tr>\n<tr>\n<td>\no todo: call mommy<br \/>\no todo: buy milk<br \/>\no todo: post letters<br \/>\no todo: buy meat<br \/>\no todo: buy vegetables<br \/>\no todo: checkup for car\n<\/td>\n<td>\no todo: call mommy<br \/>\n<b>x done<\/b>: buy milk<br \/>\no todo: post letters<br \/>\no todo: buy meat<br \/>\n<b>x done<\/b>: buy vegetables<br \/>\no todo: checkup for car\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>go to the first position where something needs to be changed<\/li>\n<li>type <span style=\"color: green;\">R<\/span> to enter overwrite mode<\/li>\n<li>type <span style=\"color: green;\">x done<\/span> to change the text<\/li>\n<li><span style=\"color: green;\">ESC<\/span> to exit overwrite mode<\/li>\n<li>move to the next position where you need to make the same change<\/li>\n<li>type <span style=\"color: green;\">.<\/span> (a single dot) to repeat the change at this position<\/li>\n<\/ol>\n<p><BR><br \/>\nThis can also be (and often is) combined with some search command. So if your list is much longer, you might prefer the following:<\/p>\n<ol>\n<li>type <span style=\"color: green;\">1G<\/span> to move to the first line of the document\n<li>type <span style=\"color: green;\">\/buy<\/span> followed by <span style=\"color: green;\">ENTER<\/span> to search for the string <em>buy<\/em>\n<li>type <span style=\"color: green;\">0<\/span> to move to the start of the current line\n<li>type <span style=\"color: green;\">2cw<\/span> followed by <span style=\"color: green;\">x done<\/span> followed by <span style=\"color: green;\">ESC<\/span> to change the first two words\n<li>type <span style=\"color: green;\">jn<\/span> to move to the next line and search for the next occurrence of the string <em>buy<\/em>\n<li>because you did not buy meat type <span style=\"color: green;\">n<\/span> again to search for the next occurrence of the string <em>buy<\/em>\n<li>move to the start of the current line by typing <span style=\"color: green;\">0<\/span>\n<li>repeat the last change by typing <span style=\"color: green;\">.<\/span> (a single dot)\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Time and time again people need to make the same single change in a document in multiple places. I often see people replacing things over and over again with dw i &lt;type new word&gt; &lt;ESC&gt;, spending a lot of time and making typing mistakes in the process. There is a very handy command to repeat [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[15],"_links":{"self":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/86"}],"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=86"}],"version-history":[{"count":5,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":115,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions\/115"}],"wp:attachment":[{"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kurt.www.pinboard.jp\/blog\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}