1011 Vim Quizzes
'){out+='(?{const matches=args.slice(0,-2);return parts.map(p=>typeof p==='string'?p:matches[p.group]||'').join('')};
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
'){out+='(?{const matches=args.slice(0,-2);return parts.map(p=>typeof p==='string'?p:matches[p.group]||'').join('')}; } root.VimRegex={compile,source,replacement,escapePattern:text=>text.replace(/[\.^$*[]~]/g,'\$&')}; })(typeof globalThis==='undefined'?window:globalThis); // Generated from content/quizzes.json by scripts/build-course.py. Do not edit. const missions = [{"topic":"Character repairs","title":"Fix “teh” to read “the”.","before":"Read teh manual.","after":"Read the manual.","cursor":[0,6],"keys":["x","p"],"hint":"Delete the e with x, then put it after the h with p.","why":"Deleting a character stores it in a register. xp puts it after the next character, swapping adjacent letters.","legacyIndex":32,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Word boundaries","title":"Rename “count” to “total”, keeping the comma.","before":"send(count, limit);","after":"send(total, limit);","cursor":[0,5],"keys":["c","w","t","o","t","a","l",""],"hint":"At the start of count, cw changes the word without consuming the comma.","why":"For a word under the cursor, cw changes through its end. Punctuation makes a useful boundary for a small rename.","legacyIndex":40,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Word boundaries","title":"Remove the “--verbose” flag.","before":"build --verbose --release","after":"build --release","cursor":[0,10],"keys":["d","a","W"],"hint":"daW removes the whitespace-delimited WORD and its following space.","why":"The around-WORD object includes the hyphens and the separating space. The remaining command keeps exactly one space.","legacyIndex":37,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Character search","title":"Change the first CSV field to “Mina”.","before":"Alex,design,remote","after":"Mina,design,remote","cursor":[0,0],"keys":["c","t",",","M","i","n","a",""],"hint":"ct, changes up to the next comma, keeping the comma.","why":"A delimiter is a better boundary than a word when a field may contain spaces. This change preserves the rest of the row.","legacyIndex":62,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Lines, meet operators","title":"Swap the first two lines.","before":"second\nfirst\nthird","after":"first\nsecond\nthird","cursor":[0,0],"keys":["d","d","p"],"hint":"dd cuts the line. After it disappears, p puts it below the current line.","why":"Delete and put compose into a move. You don’t need a separate cut command.","legacyIndex":17,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Replace mode","title":"Overwrite the three-letter month without disturbing the date.","before":"2026-Jan-24","after":"2026-Oct-24","cursor":[0,5],"keys":["R","O","c","t",""],"hint":"Use R, type Oct, then Escape.","why":"Replace mode overwrites consecutive characters; this fixed-width field is a good fit.","legacyIndex":270,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Move with intention","title":"Change the first comma to a colon.","before":"name, email, city","after":"name: email, city","cursor":[0,0],"keys":["f",",","r",":"],"hint":"f followed by a character finds its next occurrence on the same line.","why":"f, lands directly on the comma. rb would replace it with b; here r: makes it a colon.","legacyIndex":7,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Line boundaries","title":"Delete only the indentation before the heading.","before":" Release notes","after":"Release notes","cursor":[0,10],"keys":["0","d","^"],"hint":"Use 0d^.","why":"Deleting from column zero to the first nonblank character removes indentation alone.","legacyIndex":324,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Line boundaries","title":"Comment out the indented “return” line.","before":"if (ready) {\n return result;\n}","after":"if (ready) {\n // return result;\n}","cursor":[1,10],"keys":["I","/","/"," ",""],"hint":"I inserts before the first nonblank character, preserving the two-space indentation.","why":"I targets the start of the content, not column zero. That distinction keeps an indented comment aligned with its block.","legacyIndex":43,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Speak in text objects","title":"Empty the parentheses.","before":"invite(alex, sam, jo)","after":"invite()","cursor":[0,9],"keys":["d","i","("],"hint":"di( deletes inside the surrounding parentheses.","why":"The inner object keeps its delimiters. The same pattern works with brackets and braces.","legacyIndex":12,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Dot repeat","title":"Add a semicolon to each of the three statements.","before":"load()\nrender()\nsave()","after":"load();\nrender();\nsave();","cursor":[0,0],"keys":["A",";","","j",".","j","."],"hint":"A; followed by Escape makes the first edit. Move down and use dot on each remaining line.","why":"A records an end-of-line insertion, so dot works even when the lines have different lengths.","legacyIndex":85,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Character search","title":"Change the colon after “port” to “=”.","before":"server:port:8080","after":"server:port=8080","cursor":[0,14],"keys":["F",":","r","="],"hint":"Capital F searches backward on the current line. F: finds the nearest colon to the left.","why":"Backward character search is useful when the cursor has already passed the edit. Lowercase f would look in the wrong direction.","legacyIndex":60,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Indentation","title":"Indent both statements inside the block by two spaces.","before":"if (ready) {\nload();\nsend();\n}","after":"if (ready) {\n load();\n send();\n}","cursor":[1,0],"keys":["V","j",">"],"hint":"V selects the current line, j includes the next, and > indents both.","why":"Visual line selection makes the scope visible before a block operation. The closing brace is deliberately excluded.","legacyIndex":82,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Word boundaries","title":"Replace the file path with “src/app.ts”.","before":"open old/lib/main.js now","after":"open src/app.ts now","cursor":[0,12],"keys":["c","i","W","s","r","c","/","a","p","p",".","t","s",""],"hint":"Capital W treats the entire non-space path as one WORD. Use ciW.","why":"iw stops at punctuation; iW includes slashes and dots. Choose the object that matches the whole value you want to replace.","legacyIndex":36,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Character search","title":"Delete the two leading path components.","before":"workspace/packages/ui/button.ts","after":"ui/button.ts","cursor":[0,0],"keys":["d","2","f","/"],"hint":"Use d2f/.","why":"A counted find includes the second slash in the deletion.","legacyIndex":393,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Numbers","title":"Raise the shard count from 9 to 12, leaving replicas alone.","before":"shards=9 replicas=2","after":"shards=12 replicas=2","cursor":[0,0],"keys":["3",""],"hint":"Use 3 Ctrl+A from the beginning of the line.","why":"Ctrl+A finds the next number on the current line.","legacyIndex":305,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Search & repeat","title":"Delete everything before the semicolon.","before":"remove me;keep me","after":";keep me","cursor":[0,0],"keys":["d","t",";"],"hint":"dt; deletes up to, but not including, the semicolon.","why":"t stops just before a character. Pair it with d to express a precise boundary without counting.","legacyIndex":24,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Word boundaries","title":"Change the suffix “Name” to “Id”.","before":"userName = value","after":"userId = value","cursor":[0,4],"keys":["c","e","I","d",""],"hint":"The cursor is on N. ce changes from here to the end of the word.","why":"ce can replace just a suffix. ciw would replace the entire identifier, including the user prefix.","legacyIndex":41,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Line boundaries","title":"Put “// ” at absolute column zero, preserving the call’s original indentation.","before":" feedGoose();","after":"// feedGoose();","cursor":[0,0],"keys":["g","I","/","/"," ",""],"hint":"Use gI rather than I to insert before indentation.","why":"gI targets column zero; I targets the first nonblank character.","legacyIndex":980,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Character search","title":"Change only the second comma to a semicolon.","before":"name,email,role,active","after":"name,email;role,active","cursor":[0,0],"keys":["2","f",",","r",";"],"hint":"2f, finds the second comma. r; replaces that one character.","why":"A count can select the second occurrence of a delimiter. Other separators stay unchanged.","legacyIndex":59,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Character motions","title":"Delete the final path segment, keeping its slash.","before":"/srv/assets/old-logo.svg","after":"/srv/assets/","cursor":[0,23],"keys":["F","/","l","D"],"hint":"Use F/ to find the preceding slash, l to move past it, then D.","why":"The slash stays intact while D removes the entire remaining segment.","legacyIndex":183,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Joining","title":"Join the path without adding a space.","before":"/usr/local/\nbin/tool","after":"/usr/local/bin/tool","cursor":[0,0],"keys":["g","J"],"hint":"gJ joins with the next line without inserting a space.","why":"J is right for prose; gJ is right when adjacent pieces must touch, such as a split path or identifier.","legacyIndex":50,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Nested objects","title":"Replace only the nested parentheses contents with “user”.","before":"save(load(old, stale), config)","after":"save(load(user), config)","cursor":[0,12],"keys":["c","i","(","u","s","e","r",""],"hint":"Use ci( within load(...), type user, then Escape.","why":"The inner object chooses the nearest enclosing pair.","legacyIndex":384,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Dot repeat","title":"Indent the two nonadjacent return statements once.","before":"return a;\n// branch\nreturn b;","after":" return a;\n// branch\n return b;","cursor":[0,0],"keys":[">",">","2","j","."],"hint":"Indent this line with >>, move down two lines, then dot.","why":"Separate navigation from the repeated change to skip untouched lines.","legacyIndex":296,"learning":{"stage":1,"focus":"Precision without counting characters","difficulty":2,"pass":"core"}},{"topic":"Composed edits","title":"Convert the two-line robot greeting into one line with a colon.","before":"ROBOT\nHello, human.","after":"ROBOT: Hello, human.","cursor":[0,0],"keys":["A",":","","J"],"hint":"Append a colon before joining the next line.","why":"J supplies the one separating space.","l
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。