fix(tutor): use legacy syntax for lesson 3.1 #34996

Problem:
- Extmark breaks lesson 3.1 of vim-01-beginner.tutor because when users
  delete the line and put it elsewhere, the extmark doesn't move to the
  put location.
- This doesn't mean the extmark implementation is bad though (note that
  thanks to extmark, for the first time, we can make lesson 2.6 really
  interactive), it's just that the tutor format has never been made for
  kinds of lessons like lesson 3.1, which is why all "expected" in that
  lesson are -1, which also means that lesson is not interactive in the
  first place. Also see lesson 2.1.3 in vim-02-beginner, where the mark
  is just used to mark the first line of the exercise, which also prove
  my point.

Solution:
- For a not-really-interactive lesson like lesson 3.1, just use legacy
  syntax. I borrow the old vimtutor's `--->` to mark the exercises of
  the lesson.
- Less redundant interactive marks also make the json files smaller and
  more maintainable.
This commit is contained in:
Phạm Bình An
2025-07-19 22:31:37 +07:00
committed by GitHub
parent f21ada30e1
commit db1542af3d
7 changed files with 18 additions and 27 deletions

3
runtime/syntax/tutor.lua Normal file
View File

@@ -0,0 +1,3 @@
vim.cmd [[
syntax match tutorExpect /^--->.*$/
]]

View File

@@ -368,7 +368,7 @@ Fiix the errors oon thhis line and reeplace them witth undo.
** Type `p`{normal} to put previously deleted text after the cursor. **
1. Move the cursor to the first line below.
1. Move the cursor to the first `--->` line below.
2. Type `dd`{normal} to delete the line and store it in a Neovim register.
@@ -378,10 +378,10 @@ Fiix the errors oon thhis line and reeplace them witth undo.
5. Repeat steps 2 through 4 to put all the lines in correct order.
d) Can you learn too?
b) Violets are blue,
c) Intelligence is learned,
a) Roses are red,
---> d) Can you learn too?
---> b) Violets are blue,
---> c) Intelligence is learned,
---> a) Roses are red,
NOTE: You can also put the text before the cursor with `P`{normal} (capital P).

View File

@@ -19,10 +19,6 @@
"314": "6) Sugar is sweet",
"315": "7) And so are you.",
"335": "Fix the errors on this line and replace them with undo.",
"381": -1,
"382": -1,
"383": -1,
"384": -1,
"400": "When this line was typed in, someone pressed some wrong keys!",
"401": "When this line was typed in, someone pressed some wrong keys!",
"421": "This line has a few words that need changing using the change operator.",

View File

@@ -368,7 +368,7 @@ This is just a line with words you can move around in.
** 最後に削除された行をカーソルの後に貼り付ける(Put)には `p`{normal} をタイプします。 **
1. と示された以下の最初の行にカーソルを移動しましょう。
1. `--->` と示された以下の最初の行にカーソルを移動しましょう。
2. `dd`{normal} とタイプして行を削除し、Neovim のレジスタに格納しましょう。
@@ -378,10 +378,10 @@ This is just a line with words you can move around in.
5. 順番が正しくなる様にステップ 2 から 4 を繰り返しましょう。
d) 貴方も学ぶことができるか?
b) 菫は青く
c) 知恵とは学ぶもの
a) 薔薇は赤く
---> d) 貴方も学ぶことができるか?
---> b) 菫は青く
---> c) 知恵とは学ぶもの
---> a) 薔薇は赤く
NOTE: `P`{normal} (大文字 P)とタイプすることで、カーソルの前に貼り付ける事もできます。

View File

@@ -19,10 +19,6 @@
"313": "6) 砂糖は甘く",
"314": "7) そして貴方も",
"335": "この行の間違いを修正し、後でそれらの修正を取り消します。",
"381": -1,
"382": -1,
"383": -1,
"384": -1,
"400": "この行を入力した時に、その人は幾つか間違ったキーを押しました!",
"401": "この行を入力した時に、その人は幾つか間違ったキーを押しました!",
"421": "This line has a few words that need changing using the change operator.",

View File

@@ -352,7 +352,7 @@ Fix the errors on this line and replace them with undo.
** 输入 `p`{normal} 可以将之前删除的文本粘贴到光标之后。 **
1. 将光标移动到下面第一个标有 的行。
1. 将光标移动到下面第一个标有 `--->` 的行。
2. 输入 `dd`{normal} 来删除该行,并将其存入 Neovim 的一个寄存器中。
@@ -362,10 +362,10 @@ Fix the errors on this line and replace them with undo.
5. 重复第 2 到 4 步将所有行按正确的顺序abcd排列。
d) Can you learn too?
b) Violets are blue,
c) Intelligence is learned,
a) Roses are red,
---> d) Can you learn too?
---> b) Violets are blue,
---> c) Intelligence is learned,
---> a) Roses are red,
NOTE: 你也可以用 `P`{normal}(大写 P将文本粘贴到光标之前。

View File

@@ -22,10 +22,6 @@
"298": "7) And so are you.",
"318": "Fix the errors on this line and replace them with undo.",
"319": "Fix the errors on this line and replace them with undo.",
"365": -1,
"366": -1,
"367": -1,
"368": -1,
"384": "When this line was typed in, someone pressed some wrong keys!",
"385": "When this line was typed in, someone pressed some wrong keys!",
"405": "This line has a few words that need changing using the change operator.",