{"schemaVersion":1,"contentVersion":"3.4.0","id":"intermediate.2","languages":{"javascript":{"id":"intermediate.2","title":"Repeat and reverse a character search","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p><strong>Before this lesson:</strong> Character boundaries.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h3>Example</h3><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p>","teaches":["char-search-repeat","motion:f","motion:F","motion:T"],"introduces":["f","F","t","T",";",",","count"],"constraints":[],"drills":[{"task":"The auth service tidies the email itself now. Remove <code>.trim().toLowerCase()</code>.","hint":"A count before f goes to a later match on the line: d2f) deletes through the second closing bracket.","mode":"jsx","start":"import { signIn } from \"./auth\";\n\n// Emails are stored in lower case, so the form tidies what people type.\nexport function onSubmit(form) {\n  return signIn(form.elements.email.value.trim().toLowerCase()).then(redirectHome);\n}","startCursor":{"line":4,"ch":41},"paths":[{"keys":["d","2","f",")"],"tier":"idiomatic","technique":"count","core":["count","operator-motion"],"note":"d2f) deletes up to and including the second ), so both calls go and the bracket of signIn stays."}],"target":"import { signIn } from \"./auth\";\n\n// Emails are stored in lower case, so the form tidies what people type.\nexport function onSubmit(form) {\n  return signIn(form.elements.email.value).then(redirectHome);\n}","language":"javascript","evidence":"guided","canonicalKey":"intermediate.2#0","canonicalFingerprint":"1tcoibv"},{"task":"Put the cursor on the comma after <code>\"shipping\"</code>, then back on the one after <code>\"cart\"</code>.","hint":"f, and ; go right along the commas. The comma key goes back one.","mode":"jsx","start":"import { createStepper } from \"../ui/stepper\";\n\n// The checkout steps, in order. The progress bar reads them from here.\nexport const STEPS = [\"cart\", \"shipping\", \"payment\", \"review\", \"done\"];\n\nexport const stepper = createStepper(STEPS, { start: \"cart\" });","startCursor":{"line":3,"ch":0},"paths":[{"keys":["2","f",",",","],"tier":"idiomatic","technique":"char-search-repeat:,","core":["char-search-repeat:,","char-search-repeat"],"note":"The comma key repeats the last f backwards, so it's one key back when you've gone a match too far."}],"kind":"navigate","land":{"line":3,"ch":28},"waypoints":[{"line":3,"ch":40}],"language":"javascript","evidence":"guided","canonicalKey":"intermediate.2#1","canonicalFingerprint":"zqfuxm"},{"task":"Send the captured <code>amount</code> instead of <code>cart.subtotalCents</code>, and stop sending <code>visitor.sessionId</code>.","hint":"ct, changes up to the next comma. Then ; repeats that t, and d; deletes up to the comma after the next one.","mode":"jsx","start":"import { track } from \"../analytics/track\";\n\n// Sent once the payment is captured. The dashboard sums these per currency.\nexport function trackPurchase(cart, amount, visitor) {\n  track(\"purchase\", cart.subtotalCents, cart.currency, visitor.sessionId, \"web\");\n}","startCursor":{"line":4,"ch":2},"paths":[{"keys":["W","c","t",",","amount","<Esc>",";","l","d",";"],"tier":"idiomatic","technique":"char-search-repeat:;","core":["char-search-repeat:;","char-search-repeat","operator:d"],"note":"; moves on to the next comma with the same t, and d; deletes up to the place ; would go."}],"target":"import { track } from \"../analytics/track\";\n\n// Sent once the payment is captured. The dashboard sums these per currency.\nexport function trackPurchase(cart, amount, visitor) {\n  track(\"purchase\", amount, cart.currency, \"web\");\n}","language":"javascript","evidence":"guided","canonicalKey":"intermediate.2#2","canonicalFingerprint":"109uss7"},{"task":"Make the button a little taller: <code>py-3</code> instead of <code>py-2</code>.","hint":"2f2 jumps straight to the second 2 on the line.","mode":"jsx","start":"import { addToCart } from \"../cart/addToCart\";\n\n// The main button on a product page.\nexport function BuyButton({ product }) {\n  return (\n    <button className=\"inline-flex w-full items-center justify-center gap-2 rounded-md border bg-green-600 px-4 py-2 text-white\" onClick={() => addToCart(product.id)}>\n      Add to cart\n    </button>\n  );\n}","startCursor":{"line":5,"ch":4},"paths":[{"keys":["2","f","2","r","3"],"tier":"idiomatic","technique":"count","core":["count","motion:f"],"note":"A count before f skips the matches you don't want, here the 2 of gap-2."}],"target":"import { addToCart } from \"../cart/addToCart\";\n\n// The main button on a product page.\nexport function BuyButton({ product }) {\n  return (\n    <button className=\"inline-flex w-full items-center justify-center gap-2 rounded-md border bg-green-600 px-4 py-3 text-white\" onClick={() => addToCart(product.id)}>\n      Add to cart\n    </button>\n  );\n}","language":"javascript","evidence":"guided","canonicalKey":"intermediate.2#3","canonicalFingerprint":"19hw3tw"}]},"python":{"id":"intermediate.2","title":"Repeat and reverse a character search","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p><strong>Before this lesson:</strong> Character boundaries.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h3>Example</h3><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p>","teaches":["char-search-repeat","motion:f","motion:F","motion:T"],"introduces":["f","F","t","T",";",",","count"],"constraints":[],"drills":[{"task":"The auth backend tidies the email itself now. Remove <code>.strip().lower()</code>.","hint":"A count before f goes to a later match on the line: d2f) deletes through the second closing bracket.","mode":"python","start":"from django.contrib.auth import authenticate\n\n\ndef sign_in(request, form):\n    \"\"\"Emails are stored in lower case, so the form tidies what people type.\"\"\"\n    return authenticate(request, username=form.cleaned_data[\"email\"].strip().lower())","startCursor":{"line":5,"ch":68},"paths":[{"keys":["d","2","f",")"],"tier":"idiomatic","technique":"count","core":["count","operator-motion"],"note":"d2f) deletes up to and including the second ), so both calls go and the bracket of authenticate stays."}],"target":"from django.contrib.auth import authenticate\n\n\ndef sign_in(request, form):\n    \"\"\"Emails are stored in lower case, so the form tidies what people type.\"\"\"\n    return authenticate(request, username=form.cleaned_data[\"email\"])","language":"python","evidence":"guided","canonicalKey":"intermediate.2#0","canonicalFingerprint":"1tcoibv"},{"task":"Put the cursor on the comma after <code>\"shipping\"</code>, then back on the one after <code>\"cart\"</code>.","hint":"f, and ; go right along the commas. The comma key goes back one.","mode":"python","start":"from shop.ui.stepper import Stepper\n\n# The checkout steps, in order. The progress bar reads them from here.\nSTEPS = [\"cart\", \"shipping\", \"payment\", \"review\", \"done\"]\n\nstepper = Stepper(STEPS, start=\"cart\")","startCursor":{"line":3,"ch":0},"paths":[{"keys":["2","f",",",","],"tier":"idiomatic","technique":"char-search-repeat:,","core":["char-search-repeat:,","char-search-repeat"],"note":"The comma key repeats the last f backwards, so it's one key back when you've gone a match too far."}],"kind":"navigate","land":{"line":3,"ch":15},"waypoints":[{"line":3,"ch":27}],"language":"python","evidence":"guided","canonicalKey":"intermediate.2#1","canonicalFingerprint":"zqfuxm"},{"task":"Send the captured <code>amount</code> instead of <code>cart.subtotal_cents</code>, and stop sending <code>visitor.session_id</code>.","hint":"ct, changes up to the next comma. Then ; repeats that t, and d; deletes up to the comma after the next one.","mode":"python","start":"from shop.analytics.client import send_event\n\n\ndef track_purchase(cart, amount, visitor):\n    \"\"\"Sent once the payment is captured. The dashboard sums these per currency.\"\"\"\n    send_event(\"purchase\", cart.subtotal_cents, cart.currency, visitor.session_id, \"web\")","startCursor":{"line":5,"ch":4},"paths":[{"keys":["W","c","t",",","amount","<Esc>",";","l","d",";"],"tier":"idiomatic","technique":"char-search-repeat:;","core":["char-search-repeat:;","char-search-repeat","operator:d"],"note":"; moves on to the next comma with the same t, and d; deletes up to the place ; would go."}],"target":"from shop.analytics.client import send_event\n\n\ndef track_purchase(cart, amount, visitor):\n    \"\"\"Sent once the payment is captured. The dashboard sums these per currency.\"\"\"\n    send_event(\"purchase\", amount, cart.currency, \"web\")","language":"python","evidence":"guided","canonicalKey":"intermediate.2#2","canonicalFingerprint":"109uss7"},{"task":"Sync the prices until 23:00, not 22:00.","hint":"2f2 jumps straight to the second 2 on the line.","mode":"python","start":"from celery.schedules import crontab\n\n# When the background jobs run, in the shop's time zone.\nCELERY_BEAT_SCHEDULE = {\n    \"sync-prices\": {\"task\": \"shop.prices.sync\", \"schedule\": crontab(minute=\"*/15\", hour=\"6-22\")},\n    \"send-digest\": {\"task\": \"shop.mail.digest\", \"schedule\": crontab(minute=0, hour=7)},\n}","startCursor":{"line":4,"ch":4},"paths":[{"keys":["2","f","2","r","3"],"tier":"idiomatic","technique":"count","core":["count","motion:f"],"note":"A count before f skips the matches you don't want, here the first 2 of 22."}],"target":"from celery.schedules import crontab\n\n# When the background jobs run, in the shop's time zone.\nCELERY_BEAT_SCHEDULE = {\n    \"sync-prices\": {\"task\": \"shop.prices.sync\", \"schedule\": crontab(minute=\"*/15\", hour=\"6-23\")},\n    \"send-digest\": {\"task\": \"shop.mail.digest\", \"schedule\": crontab(minute=0, hour=7)},\n}","language":"python","evidence":"guided","canonicalKey":"intermediate.2#3","canonicalFingerprint":"19hw3tw"}]},"text":{"id":"intermediate.2","title":"Repeat and reverse a character search","moduleName":"Boundaries and reusable text","tips":"","concept":"<p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p><strong>Before this lesson:</strong> Character boundaries.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h3>Example</h3><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p>","teaches":["char-search-repeat","motion:f","motion:F","motion:T"],"introduces":["f","F","t","T",";",",","count"],"constraints":[],"drills":[{"task":"The site is served from <code>/srv/shop/site</code> now. Remove the release folders from the path.","hint":"A count before f goes to a later match on the line: d2f/ deletes through the second slash.","mode":"text/plain","start":"# The storefront. Static files come straight from disk.\nserver {\n  listen 443 ssl;\n  server_name northwind.shop;\n  root /srv/shop/releases/2026-11-14/site;\n}","startCursor":{"line":4,"ch":17},"paths":[{"keys":["d","2","f","/"],"tier":"idiomatic","technique":"count","core":["count","operator-motion"],"note":"d2f/ deletes up to and including the second /, so both folders go and site stays."}],"target":"# The storefront. Static files come straight from disk.\nserver {\n  listen 443 ssl;\n  server_name northwind.shop;\n  root /srv/shop/site;\n}","language":"text","evidence":"guided","canonicalKey":"intermediate.2#0","canonicalFingerprint":"1tcoibv"},{"task":"Put the cursor on the comma after <code>placed_at</code>, then back on the one after <code>order_number</code>.","hint":"f, and ; go right along the commas. The comma key goes back one.","mode":"text/plain","start":"# Orders export\n\nThe export is a CSV file with one order per line. Its first line names the columns:\n\norder_number,placed_at,status,total_cents,currency\n\nTotals are in cents, so 4995 means 49.95 euros.","startCursor":{"line":4,"ch":0},"paths":[{"keys":["2","f",",",","],"tier":"idiomatic","technique":"char-search-repeat:,","core":["char-search-repeat:,","char-search-repeat"],"note":"The comma key repeats the last f backwards, so it's one key back when you've gone a match too far."}],"kind":"navigate","land":{"line":4,"ch":12},"waypoints":[{"line":4,"ch":22}],"language":"text","evidence":"guided","canonicalKey":"intermediate.2#1","canonicalFingerprint":"zqfuxm"},{"task":"Send <code>payment.amount</code> instead of <code>order.total_cents</code>, and stop sending <code>visitor.session_id</code>.","hint":"ct, changes up to the next comma. Then ; repeats that t, and d; deletes up to the comma after the next one.","mode":"text/plain","start":"# Purchase events\n\nEach purchase sends one event to the dashboard, with these fields in order:\n\nFields: order.total_cents, order.currency, visitor.session_id, channel\n\nThe dashboard sums them per currency every night.","startCursor":{"line":4,"ch":0},"paths":[{"keys":["W","c","t",",","payment.amount","<Esc>",";","l","d",";"],"tier":"idiomatic","technique":"char-search-repeat:;","core":["char-search-repeat:;","char-search-repeat","operator:d"],"note":"; moves on to the next comma with the same t, and d; deletes up to the place ; would go."}],"target":"# Purchase events\n\nEach purchase sends one event to the dashboard, with these fields in order:\n\nFields: payment.amount, order.currency, channel\n\nThe dashboard sums them per currency every night.","language":"text","evidence":"guided","canonicalKey":"intermediate.2#2","canonicalFingerprint":"109uss7"},{"task":"We're open an hour longer on weekdays now: until <code>23:00</code>.","hint":"2f2 jumps straight to the second 2 on the line.","mode":"text/plain","start":"# When we're open\n\nCustomer service is open Monday to Friday from 9:00 to 22:00, and Saturday from 10:00 to 18:00.\nOn Sundays we answer emails only.\n\nPhone: 020 555 0134","startCursor":{"line":2,"ch":0},"paths":[{"keys":["2","f","2","r","3"],"tier":"idiomatic","technique":"count","core":["count","motion:f"],"note":"A count before f skips the matches you don't want, here the first 2 of 22."}],"target":"# When we're open\n\nCustomer service is open Monday to Friday from 9:00 to 23:00, and Saturday from 10:00 to 18:00.\nOn Sundays we answer emails only.\n\nPhone: 020 555 0134","language":"text","evidence":"guided","canonicalKey":"intermediate.2#3","canonicalFingerprint":"19hw3tw"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Character boundaries.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h2 class=\"prose-subhead\">Example</h2><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Character boundaries.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h2 class=\"prose-subhead\">Example</h2><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Character boundaries.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Jump to a later match on the line, or go back the other way, without starting a new search.</p><p>f and F land on a character, and t and T stop just before it. ; repeats the search in the same direction and a comma goes back the other way. A count such as 2f| goes straight to the second match. These commands only work on the current line, so use / when you need another line.</p><h2 class=\"prose-subhead\">Example</h2><p>In north | centre | south, f| reaches the first bar and ; reaches the second. A comma takes you back to the first.</p><p>Use Start over to try again.</p></div></details>"}}}