{"schemaVersion":1,"contentVersion":"3.4.0","id":"foundation.8","languages":{"javascript":{"id":"foundation.8","title":"Count a known region","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p><strong>Before this lesson:</strong> Compose an edit.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><div class=\"pkeys\"><kbd>2w</kbd> <kbd>3x</kbd> <kbd>2dd</kbd> <kbd>d2w</kbd></div><h3>Example</h3><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><h4>Worked text</h4><pre class=\"lesson-example\">// Obsolete first\n// Obsolete second\n// Keep</pre><h4>After the edit</h4><pre class=\"lesson-example\">// Keep</pre><p>Use Start over to try again.</p>","teaches":["count"],"introduces":["count"],"constraints":[],"drills":[{"task":"The old tracker is gone for good. Delete the three lines about it.","hint":"Count the lines first. A number before dd deletes that many.","mode":"jsx","start":"import { plausible } from \"./plausible.js\";\n\nexport function trackPurchase(order) {\n  // The old tracker, switched off in October.\n  // window.oldTracker.push([\"purchase\", order.number]);\n  // window.oldTracker.push([\"revenue\", order.total]);\n  plausible(\"Purchase\", { props: { total: order.total } });\n}","startCursor":{"line":2,"ch":7},"paths":[{"keys":["j","3","d","d"],"tier":"idiomatic","technique":"count","core":["count","linewise"],"note":"3dd deletes three lines in one change."}],"target":"import { plausible } from \"./plausible.js\";\n\nexport function trackPurchase(order) {\n  plausible(\"Purchase\", { props: { total: order.total } });\n}","language":"javascript","evidence":"guided","canonicalKey":"foundation.8#0","canonicalFingerprint":"1q9dw3m"},{"task":"The confirmation shouts. Make it end with one <code>!</code>.","hint":"Count the characters first. A number before x deletes that many.","mode":"jsx","start":"// The text on the checkout pages.\nexport const checkout = {\n  pay: \"Pay now\",\n  placed: \"Thanks, your order is placed!!!!\",\n  failed: \"The payment didn't go through. Try again.\",\n  address: \"Where should we send it?\",\n};","startCursor":{"line":2,"ch":2},"paths":[{"keys":["j","$","b","3","x"],"tier":"idiomatic","technique":"char-delete","core":["char-delete","count"],"note":"A count before x deletes that many characters, all in one change."}],"target":"// The text on the checkout pages.\nexport const checkout = {\n  pay: \"Pay now\",\n  placed: \"Thanks, your order is placed!\",\n  failed: \"The payment didn't go through. Try again.\",\n  address: \"Where should we send it?\",\n};","language":"javascript","evidence":"guided","canonicalKey":"foundation.8#1","canonicalFingerprint":"1qaxav8"},{"task":"Say it once. Remove <code>and irreversibly </code> from the warning.","hint":"A count before w covers that many words, so d2w deletes two.","mode":"jsx","start":"// The last step before an account is deleted.\nexport function DeleteAccount({ onConfirm }) {\n  return (\n    <section className=\"danger-zone\">\n      <p>This permanently and irreversibly deletes your orders and addresses.</p>\n      <button onClick={onConfirm}>Delete my account</button>\n    </section>\n  );\n}","startCursor":{"line":4,"ch":14},"paths":[{"keys":["w","d","2","w"],"tier":"idiomatic","technique":"operator-motion","core":["operator-motion","count"],"note":"d2w deletes two words and the space after them."}],"target":"// The last step before an account is deleted.\nexport function DeleteAccount({ onConfirm }) {\n  return (\n    <section className=\"danger-zone\">\n      <p>This permanently deletes your orders and addresses.</p>\n      <button onClick={onConfirm}>Delete my account</button>\n    </section>\n  );\n}","language":"javascript","evidence":"guided","canonicalKey":"foundation.8#2","canonicalFingerprint":"3majim"}]},"python":{"id":"foundation.8","title":"Count a known region","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p><strong>Before this lesson:</strong> Compose an edit.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><div class=\"pkeys\"><kbd>2w</kbd> <kbd>3x</kbd> <kbd>2dd</kbd> <kbd>d2w</kbd></div><h3>Example</h3><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><h4>Worked text</h4><pre class=\"lesson-example\"># Obsolete first\n# Obsolete second\n# Keep</pre><h4>After the edit</h4><pre class=\"lesson-example\"># Keep</pre><p>Use Start over to try again.</p>","teaches":["count"],"introduces":["count"],"constraints":[],"drills":[{"task":"The old tracker is gone for good. Delete the three lines about it.","hint":"Count the lines first. A number before dd deletes that many.","mode":"python","start":"from shop.plausible import plausible\n\n\ndef track_purchase(order):\n    # The old tracker, switched off in October.\n    # old_tracker.push(\"purchase\", order.number)\n    # old_tracker.push(\"revenue\", order.total)\n    plausible(\"Purchase\", props={\"total\": order.total})","startCursor":{"line":3,"ch":8},"paths":[{"keys":["j","3","d","d"],"tier":"idiomatic","technique":"count","core":["count","linewise"],"note":"3dd deletes three lines in one change."}],"target":"from shop.plausible import plausible\n\n\ndef track_purchase(order):\n    plausible(\"Purchase\", props={\"total\": order.total})","language":"python","evidence":"guided","canonicalKey":"foundation.8#0","canonicalFingerprint":"1q9dw3m"},{"task":"The confirmation shouts. Make it end with one <code>!</code>.","hint":"Count the characters first. A number before x deletes that many.","mode":"python","start":"\"\"\"The text on the checkout pages.\"\"\"\n\nPAY = \"Pay now\"\nPLACED = \"Thanks, your order is placed!!!!\"\nFAILED = \"The payment didn't go through. Try again.\"\nADDRESS = \"Where should we send it?\"","startCursor":{"line":2,"ch":0},"paths":[{"keys":["j","$","b","3","x"],"tier":"idiomatic","technique":"char-delete","core":["char-delete","count"],"note":"A count before x deletes that many characters, all in one change."}],"target":"\"\"\"The text on the checkout pages.\"\"\"\n\nPAY = \"Pay now\"\nPLACED = \"Thanks, your order is placed!\"\nFAILED = \"The payment didn't go through. Try again.\"\nADDRESS = \"Where should we send it?\"","language":"python","evidence":"guided","canonicalKey":"foundation.8#1","canonicalFingerprint":"1qaxav8"},{"task":"Say it once. Remove <code>and irreversibly </code> from the warning.","hint":"A count before w covers that many words, so d2w deletes two.","mode":"python","start":"\"\"\"Text for the page where you delete your account.\"\"\"\n\nDELETE_TITLE = \"Delete your account\"\nDELETE_WARNING = \"This permanently and irreversibly deletes your orders and addresses.\"\nDELETE_BUTTON = \"Delete my account\"\nDELETE_DONE = \"Your account is gone. We've emailed you a copy of your data.\"","startCursor":{"line":3,"ch":23},"paths":[{"keys":["w","d","2","w"],"tier":"idiomatic","technique":"operator-motion","core":["operator-motion","count"],"note":"d2w deletes two words and the space after them."}],"target":"\"\"\"Text for the page where you delete your account.\"\"\"\n\nDELETE_TITLE = \"Delete your account\"\nDELETE_WARNING = \"This permanently deletes your orders and addresses.\"\nDELETE_BUTTON = \"Delete my account\"\nDELETE_DONE = \"Your account is gone. We've emailed you a copy of your data.\"","language":"python","evidence":"guided","canonicalKey":"foundation.8#2","canonicalFingerprint":"3majim"}]},"text":{"id":"foundation.8","title":"Count a known region","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p><strong>Before this lesson:</strong> Compose an edit.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><div class=\"pkeys\"><kbd>2w</kbd> <kbd>3x</kbd> <kbd>2dd</kbd> <kbd>d2w</kbd></div><h3>Example</h3><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><h4>Worked text</h4><pre class=\"lesson-example\">Obsolete first\nObsolete second\nKeep</pre><h4>After the edit</h4><pre class=\"lesson-example\">Keep</pre><p>Use Start over to try again.</p>","teaches":["count"],"introduces":["count"],"constraints":[],"drills":[{"task":"The dates for last winter have passed. Delete the first three.","hint":"Count the lines first. A number before dd deletes that many.","mode":"text/plain","start":"# Shop holidays\n\nThe shop and the warehouse are closed on these days.\n- 25 December 2025\n- 26 December 2025\n- 1 January 2026\n- 25 December 2026\n- 26 December 2026\n- 1 January 2027","startCursor":{"line":2,"ch":31},"paths":[{"keys":["j","3","d","d"],"tier":"idiomatic","technique":"count","core":["count","linewise"],"note":"3dd deletes three lines in one change."}],"target":"# Shop holidays\n\nThe shop and the warehouse are closed on these days.\n- 25 December 2026\n- 26 December 2026\n- 1 January 2027","language":"text","evidence":"guided","canonicalKey":"foundation.8#0","canonicalFingerprint":"1q9dw3m"},{"task":"The email shouts. Make the first line end with one <code>!</code>.","hint":"Count the characters first. A number before x deletes that many.","mode":"text/plain","start":"Subject: We've got your order\n\nThanks, your order is placed!!!!\nWe'll email you again when it leaves the warehouse.\nYou can see it any time in your account.\n\nSee you soon,\nNorthwind","startCursor":{"line":3,"ch":6},"paths":[{"keys":["k","$","b","3","x"],"tier":"idiomatic","technique":"char-delete","core":["char-delete","count"],"note":"A count before x deletes that many characters, all in one change."}],"target":"Subject: We've got your order\n\nThanks, your order is placed!\nWe'll email you again when it leaves the warehouse.\nYou can see it any time in your account.\n\nSee you soon,\nNorthwind","language":"text","evidence":"guided","canonicalKey":"foundation.8#1","canonicalFingerprint":"1qaxav8"},{"task":"Say it once. Remove <code>and irreversibly </code> from the warning.","hint":"A count before w covers that many words, so d2w deletes two.","mode":"text/plain","start":"# Deleting your account\n\nYou can delete your account from the Privacy page.\nThis permanently and irreversibly deletes your orders and addresses.\nWe email you a copy of your data first.\nGift card balances are refunded to the card you paid with.","startCursor":{"line":3,"ch":5},"paths":[{"keys":["w","d","2","w"],"tier":"idiomatic","technique":"operator-motion","core":["operator-motion","count"],"note":"d2w deletes two words and the space after them."}],"target":"# Deleting your account\n\nYou can delete your account from the Privacy page.\nThis permanently deletes your orders and addresses.\nWe email you a copy of your data first.\nGift card balances are refunded to the card you paid with.","language":"text","evidence":"guided","canonicalKey":"foundation.8#2","canonicalFingerprint":"3majim"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Compose an edit.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><h2 class=\"prose-subhead\">Example</h2><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><p>Use Start over to try again.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Compose an edit.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><h2 class=\"prose-subhead\">Example</h2><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><p>Use Start over to try again.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Compose an edit.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Use a count when you know exactly how many, and leave the text around it alone.</p><p>A number before a motion or edit repeats it, as in 2w, 3x or 2dd. d2w and 2dw both delete two words. Count only what you want to change. When you're not sure how long it is, a word or line boundary is safer. A counted edit is one change, so one u undoes it.</p><h2 class=\"prose-subhead\">Example</h2><p>If exactly two obsolete lines sit above “Keep”, 2dd removes both in one edit. If there are three, the same command leaves one behind. Look at the lines before you pick a count.</p><p>Use Start over to try again.</p></div></details>"}}}