mirror of
https://github.com/neovim/neovim.git
synced 2026-05-23 21:30:11 +00:00
refactor(tutor): use inline comments instead of json file #39714
Problem: Expected text for interactive marks is in a separate json file from the tutor file. When the tutor file is updated, line numbers (potentially many) have to be updated in the json file. This is a burden for maintenance and automatic testing. Solution: Put the expected text inline in the tutor file, marked with `[[]]`. Parse and remove the comments before opening the tutor file so extmarks can be applied.
This commit is contained in:
@@ -12,10 +12,9 @@ function! tutor#SetupVim()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Loads metadata file, if available
|
||||
" Load inline metadata
|
||||
function! tutor#LoadMetadata()
|
||||
let l:metadata_file = exists('b:tutor_file') ? b:tutor_file : expand('%')
|
||||
let b:tutor_metadata = json_decode(readfile(l:metadata_file .. '.json'))
|
||||
lua require('nvim.tutor').load_metadata()
|
||||
endfunction
|
||||
|
||||
" Mappings: {{{1
|
||||
|
||||
@@ -16,6 +16,30 @@ local tutor_hl_ns = vim.api.nvim_create_namespace('nvim.tutor.hl')
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Extract inline comments into metadata.
|
||||
-- Example: "This is wrong. [[This is right.]]" => { '1' = 'This is right.'}
|
||||
function M.load_metadata()
|
||||
---@type table<string, string|-1>
|
||||
local data = {}
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
|
||||
for i, line in ipairs(lines) do
|
||||
local text, expected_text = line:match('^(.-)%s%[%[(.-)%]%]$')
|
||||
|
||||
if text then
|
||||
if expected_text == '-1' then
|
||||
data[tostring(i)] = -1
|
||||
else
|
||||
data[tostring(i)] = expected_text
|
||||
end
|
||||
lines[i] = text
|
||||
end
|
||||
end
|
||||
|
||||
vim.b.tutor_metadata = { expect = data }
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
|
||||
end
|
||||
|
||||
---@param line integer 1-based
|
||||
local function check_line(line)
|
||||
if vim.b.tutor_metadata and vim.b.tutor_metadata.expect and vim.b.tutor_extmarks then
|
||||
|
||||
@@ -102,7 +102,7 @@ NOTE: [:q!](:q) `<Enter>`{normal} discards any changes you made. In a few lesson
|
||||
|
||||
4. Repeat steps 2 through 4 until the sentence is correct.
|
||||
|
||||
The ccow jumpedd ovverr thhe mooon.
|
||||
The ccow jumpedd ovverr thhe mooon. [[The cow jumped over the moon.]]
|
||||
|
||||
5. Now that the line is correct, go on to Lesson 1.4.
|
||||
|
||||
@@ -124,8 +124,8 @@ NOTE: As you go through this tutorial, do not try to memorize everything,
|
||||
4. As each error is fixed press `<Esc>`{normal} to return to Normal mode.
|
||||
Repeat steps 2 through 4 to correct the sentence.
|
||||
|
||||
There is text misng this .
|
||||
There is some text missing from this line.
|
||||
There is text misng this . [[There is some text missing from this line.]]
|
||||
There is some text missing from this line. [[There is some text missing from this line.]]
|
||||
|
||||
5. When you are comfortable inserting text move to Lesson 1.5.
|
||||
|
||||
@@ -144,10 +144,10 @@ There is some text missing from this line.
|
||||
4. Move the cursor to the second line marked ✗ and repeat
|
||||
steps 2 and 3 to correct this sentence.
|
||||
|
||||
There is some text missing from th
|
||||
There is some text missing from this line.
|
||||
There is also some text miss
|
||||
There is also some text missing here.
|
||||
There is some text missing from th [[There is some text missing from this line.]]
|
||||
There is some text missing from this line. [[There is some text missing from this line.]]
|
||||
There is also some text miss [[There is also some text missing here.]]
|
||||
There is also some text missing here. [[There is also some text missing here.]]
|
||||
|
||||
5. When you are comfortable appending text move to Lesson 1.6.
|
||||
|
||||
@@ -215,7 +215,7 @@ Now continue with Lesson 2.
|
||||
|
||||
4. Type [d](d)[w](w) to make the word disappear.
|
||||
|
||||
There are a some words fun that don't belong paper in this sentence.
|
||||
There are a some words fun that don't belong paper in this sentence. [[There are some words that don't belong in this sentence.]]
|
||||
|
||||
5. Repeat steps 3 and 4 until the sentence is correct and go to Lesson 2.2.
|
||||
|
||||
@@ -231,7 +231,7 @@ There are a some words fun that don't belong paper in this sentence.
|
||||
|
||||
4. Type `d$`{normal} to delete to the end of the line.
|
||||
|
||||
Somebody typed the end of this line twice. end of this line twice.
|
||||
Somebody typed the end of this line twice. end of this line twice. [[Somebody typed the end of this line twice.]]
|
||||
|
||||
5. Move on to Lesson 2.3 to understand what is happening.
|
||||
|
||||
@@ -270,7 +270,7 @@ NOTE: Pressing just the motion while in Normal mode without an operator
|
||||
|
||||
5. Repeat steps 2 and 3 with different numbers.
|
||||
|
||||
This is just a line with words you can move around in.
|
||||
This is just a line with words you can move around in. [[-1]]
|
||||
|
||||
6. Move on to Lesson 2.5.
|
||||
|
||||
@@ -289,7 +289,7 @@ insert a count before the motion to delete more:
|
||||
3. Repeat steps 1 and 2 with a different count to delete the consecutive
|
||||
UPPER CASE words with one command
|
||||
|
||||
This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
||||
This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. [[This line of words is cleaned up.]]
|
||||
|
||||
# Lesson 2.6: OPERATING ON LINES
|
||||
|
||||
@@ -306,13 +306,13 @@ it would be easier to simply type two d's to delete a line.
|
||||
|
||||
4. Type `2dd`{normal} to delete two lines.
|
||||
|
||||
1) Roses are red,
|
||||
2) Mud is fun,
|
||||
3) Violets are blue,
|
||||
4) I have a car,
|
||||
5) Clocks tell time,
|
||||
6) Sugar is sweet
|
||||
7) And so are you.
|
||||
1) Roses are red, [[1) Roses are red,]]
|
||||
2) Mud is fun, [[]]
|
||||
3) Violets are blue, [[3) Violets are blue,]]
|
||||
4) I have a car, [[]]
|
||||
5) Clocks tell time, [[]]
|
||||
6) Sugar is sweet [[6) Sugar is sweet]]
|
||||
7) And so are you. [[7) And so are you.]]
|
||||
|
||||
# Lesson 2.7: THE UNDO COMMAND
|
||||
|
||||
@@ -332,7 +332,7 @@ it would be easier to simply type two d's to delete a line.
|
||||
|
||||
7. Now type `<C-r>`{normal} (Control + R) a few times to redo the commands.
|
||||
|
||||
Fiix the errors oon thhis line and reeplace them witth undo.
|
||||
Fiix the errors oon thhis line and reeplace them witth undo. [[Fix the errors on this line and replace them with undo.]]
|
||||
|
||||
8. These are very useful commands. Now move on to the Lesson 2 Summary.
|
||||
|
||||
@@ -397,8 +397,8 @@ NOTE: You can also put the text before the cursor with `P`{normal} (capital P).
|
||||
|
||||
4. Repeat steps 2 and 3 until the first line is equal to the second one.
|
||||
|
||||
Whan this lime was tuoed in, someone presswd some wrojg keys!
|
||||
When this line was typed in, someone pressed some wrong keys!
|
||||
Whan this lime was tuoed in, someone presswd some wrojg keys! [[When this line was typed in, someone pressed some wrong keys!]]
|
||||
When this line was typed in, someone pressed some wrong keys! [[When this line was typed in, someone pressed some wrong keys!]]
|
||||
|
||||
5. Now move on to Lesson 3.3.
|
||||
|
||||
@@ -418,8 +418,8 @@ NOTE: Remember that you should be learning by doing, not memorizing.
|
||||
|
||||
5. Repeat steps 3 and 4 until the first sentence is the same as the second.
|
||||
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator.
|
||||
This line has a few words that need changing using the change operator.
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
This line has a few words that need changing using the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
|
||||
Notice that [c](c)e deletes the word and places you in Insert mode.
|
||||
|
||||
@@ -439,8 +439,8 @@ Notice that [c](c)e deletes the word and places you in Insert mode.
|
||||
|
||||
5. Type `c$`{normal} and type the rest of the line like the second and press `<Esc>`{normal}.
|
||||
|
||||
The end of this line needs some help to make it like the second.
|
||||
The end of this line needs to be corrected using the c$ command.
|
||||
The end of this line needs some help to make it like the second. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
The end of this line needs to be corrected using the c$ command. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
|
||||
NOTE: You can use the Backspace key to correct mistakes while typing.
|
||||
|
||||
@@ -503,7 +503,7 @@ NOTE: You may see the cursor position in the lower right corner of the
|
||||
(keep `<Ctrl>`{normal} pressed down while pressing the letter `o`{normal}).
|
||||
Repeat to go back further. `<C-i>`{normal} goes forward.
|
||||
|
||||
"errroor" is not the way to spell error; errroor is an error.
|
||||
"errroor" is not the way to spell error; errroor is an error. [[-1]]
|
||||
|
||||
NOTE: When the search reaches the end of the file it will continue at the
|
||||
start, unless the ['wrapscan']('wrapscan') option has been reset.
|
||||
@@ -522,7 +522,7 @@ NOTE: When the search reaches the end of the file it will continue at the
|
||||
|
||||
5. Move the cursor to another (, ), [, ], {, or } and see what `%`{normal} does.
|
||||
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. ))
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. )) [[-1]]
|
||||
|
||||
NOTE: This is very useful in debugging a program with unmatched parentheses!
|
||||
|
||||
@@ -545,7 +545,7 @@ NOTE: This is very useful in debugging a program with unmatched parentheses!
|
||||
Adding the g [flag](:s_flags) means to substitute globally in the line,
|
||||
change all occurrences of "thee" in the line.
|
||||
|
||||
Usually thee best time to see thee flowers is in thee spring.
|
||||
Usually thee best time to see thee flowers is in thee spring. [[Usually the best time to see the flowers is in the spring.]]
|
||||
|
||||
4. To change every occurrence of a character string between two lines, type
|
||||
~~~ cmd
|
||||
@@ -740,12 +740,12 @@ NOTE: You can also read the output of an external command. For example,
|
||||
|
||||
3. Now type some text and press `<Esc>`{normal} to exit Insert mode. Remove your opened lines after you're done.
|
||||
|
||||
After typing `o`{normal} the cursor is placed on the open line in Insert mode.
|
||||
After typing `o`{normal} the cursor is placed on the open line in Insert mode. [[-1]]
|
||||
|
||||
4. To open up a line ABOVE the cursor, simply type a [capital O](O), rather
|
||||
than a lowercase `o`{normal}. Try this on the line below. Remove your opened lines after you're done.
|
||||
|
||||
Open up a line above this by typing O while the cursor is on this line.
|
||||
Open up a line above this by typing O while the cursor is on this line. [[-1]]
|
||||
|
||||
# Lesson 6.2: THE APPEND COMMAND
|
||||
|
||||
@@ -761,8 +761,8 @@ Open up a line above this by typing O while the cursor is on this line.
|
||||
|
||||
5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4.
|
||||
|
||||
This li will allow you to pract appendi text to a line.
|
||||
This line will allow you to practice appending text to a line.
|
||||
This li will allow you to pract appendi text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
This line will allow you to practice appending text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
|
||||
NOTE: [a](a), [i](i), and [A](A) all go to the same Insert mode, the only
|
||||
difference is where the characters are inserted.
|
||||
@@ -782,8 +782,8 @@ NOTE: [a](a), [i](i), and [A](A) all go to the same Insert mode, the only
|
||||
|
||||
4. Repeat the steps to replace the remaining "xxx".
|
||||
|
||||
Adding 123 to xxx gives you xxx.
|
||||
Adding 123 to 456 gives you 579.
|
||||
Adding 123 to xxx gives you xxx. [[Adding 123 to 456 gives you 579.]]
|
||||
Adding 123 to 456 gives you 579. [[Adding 123 to 456 gives you 579.]]
|
||||
|
||||
NOTE: Replace mode is like Insert mode, but every typed character
|
||||
replaces an existing character.
|
||||
@@ -809,8 +809,8 @@ NOTE: Replace mode is like Insert mode, but every typed character
|
||||
7. Use Visual mode to select "item.", yank it with `y`{normal}, move to the
|
||||
end of the next line with `j$`{normal} and put the text there with `p`{normal}
|
||||
|
||||
a) This is the first item.
|
||||
b)
|
||||
a) This is the first item. [[a) This is the first item.]]
|
||||
b) [[b) This is the second item.]]
|
||||
|
||||
NOTE: You can use `y`{normal} as an operator: `yw`{normal} yanks one word.
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"105": "The cow jumped over the moon.",
|
||||
"127": "There is some text missing from this line.",
|
||||
"128": "There is some text missing from this line.",
|
||||
"147": "There is some text missing from this line.",
|
||||
"148": "There is some text missing from this line.",
|
||||
"149": "There is also some text missing here.",
|
||||
"150": "There is also some text missing here.",
|
||||
"218": "There are some words that don't belong in this sentence.",
|
||||
"234": "Somebody typed the end of this line twice.",
|
||||
"273": -1,
|
||||
"292": "This line of words is cleaned up.",
|
||||
"309": "1) Roses are red,",
|
||||
"310": "",
|
||||
"311": "3) Violets are blue,",
|
||||
"312": "",
|
||||
"313": "",
|
||||
"314": "6) Sugar is sweet",
|
||||
"315": "7) And so are you.",
|
||||
"335": "Fix the errors on this line and replace them with undo.",
|
||||
"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.",
|
||||
"422": "This line has a few words that need changing using the change operator.",
|
||||
"442": "The end of this line needs to be corrected using the c$ command.",
|
||||
"443": "The end of this line needs to be corrected using the c$ command.",
|
||||
"506": -1,
|
||||
"525": -1,
|
||||
"548": "Usually the best time to see the flowers is in the spring.",
|
||||
"743": -1,
|
||||
"748": -1,
|
||||
"764": "This line will allow you to practice appending text to a line.",
|
||||
"765": "This line will allow you to practice appending text to a line.",
|
||||
"785": "Adding 123 to 456 gives you 579.",
|
||||
"786": "Adding 123 to 456 gives you 579.",
|
||||
"812": "a) This is the first item.",
|
||||
"813": "b) This is the second item."
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
- Try with other operators: `ciw`{normal} (change), `yiw`{normal} (yank),
|
||||
`gqiw`{normal} (format)
|
||||
|
||||
Practice on: "Vim's", (text_object), and 'powerful' words here.
|
||||
Practice on: "Vim's", (text_object), and 'powerful' words here. [[-1]]
|
||||
|
||||
2. Work with bracketed content:
|
||||
- Put cursor inside any () {} [] <> pair below
|
||||
@@ -33,7 +33,7 @@ Practice on: "Vim's", (text_object), and 'powerful' words here.
|
||||
- Type `da(`{normal} or `dab`{normal} (delete around brackets)
|
||||
- Try same with `i"`{normal}/`a"`{normal} for quotes, `it`{normal}/`at`{normal} for HTML/XML tags
|
||||
|
||||
Test cases: {curly}, [square], <angle>, and "quoted" items.
|
||||
Test cases: {curly}, [square], <angle>, and "quoted" items. [[-1]]
|
||||
|
||||
3. Paragraph and sentence manipulation:
|
||||
- Use `dip`{normal} to delete inner paragraph (cursor anywhere in paragraph)
|
||||
@@ -46,7 +46,7 @@ Test cases: {curly}, [square], <angle>, and "quoted" items.
|
||||
- `gUit`{normal} - Uppercase inner HTML tag content
|
||||
- `va"p`{normal} - Select quoted text and paste over it
|
||||
|
||||
Final exercise: (Modify "this" text) by [applying {various} operations]<
|
||||
Final exercise: (Modify "this" text) by [applying {various} operations]< [[-1]]
|
||||
|
||||
|
||||
# Lesson 2.1.2: THE NAMED REGISTERS
|
||||
@@ -68,8 +68,8 @@ Final exercise: (Modify "this" text) by [applying {various} operations]<
|
||||
|
||||
5. Navigate to any point on the word 'cake' and type `ciw<CTRL-R>b<ESC>`{normal}
|
||||
|
||||
a) Edward will henceforth be in charge of the cookie rations
|
||||
b) In this capacity, Vince will have sole cake discretionary powers
|
||||
a) Edward will henceforth be in charge of the cookie rations [[-1]]
|
||||
b) In this capacity, Vince will have sole cake discretionary powers [[b) In this capacity, Edward will have sole cookie discretionary powers]]
|
||||
|
||||
NOTE: Delete also works into registers, i.e. `"sdiw`{normal} will delete
|
||||
the word under the cursor into register s.
|
||||
@@ -96,8 +96,8 @@ REFERENCE: [Registers](registers)
|
||||
NOTE: All calls to system are OS dependent, e.g. on Windows use
|
||||
`system('date /t')`{vim} or `:r!date /t`{vim}
|
||||
|
||||
I have forgotten the exact number of seconds in a day, is it 84600?
|
||||
Today's date is:
|
||||
I have forgotten the exact number of seconds in a day, is it 84600? [[I have forgotten the exact number of seconds in a day, is it 86400]]
|
||||
Today's date is: [[-1]]
|
||||
|
||||
NOTE: the same can be achieved with `:pu=`{normal}`system('date')`{vim}
|
||||
or, with fewer keystrokes `:r!date`{vim}
|
||||
@@ -123,7 +123,7 @@ NOTE: You should notice that old full-line deletions move down the list
|
||||
|
||||
5. Now (p)aste the following registers in order; c, 7, 4, 8, 2. i.e. `"7p`{normal}
|
||||
|
||||
0. This
|
||||
0. This [[-1]]
|
||||
9. wobble
|
||||
8. secret
|
||||
7. is
|
||||
@@ -155,7 +155,7 @@ REFERENCE: [Numbered Registers](quote0)
|
||||
- `"+p`{normal} - Paste from system clipboard
|
||||
- `"*`{normal} is primary selection on X11 (middle-click), `"+`{normal} is clipboard
|
||||
|
||||
Try: "+yy then paste into another application with Ctrl-V or Cmd+V
|
||||
Try: "+yy then paste into another application with Ctrl-V or Cmd+V [[-1]]
|
||||
|
||||
2. Blackhole register `_`{normal} discards text:
|
||||
- `"_daw`{normal} - Delete word without saving to any register
|
||||
@@ -166,7 +166,7 @@ Try: "+yy then paste into another application with Ctrl-V or Cmd+V
|
||||
- `"_dap`{normal} - Delete paragraph without saving
|
||||
- Combine with counts: `3"_dw`{normal}
|
||||
|
||||
Practice: "_diw on any word to delete it without affecting yank history
|
||||
Practice: "_diw on any word to delete it without affecting yank history [[-1]]
|
||||
|
||||
3. Combine with visual selections:
|
||||
- Select text with V then `"+y`{normal}
|
||||
@@ -215,7 +215,7 @@ NOTE: exact position on line is NOT important!
|
||||
NOTE: practice this operation multiple times to become fluent `ma$%"ad'a`{normal}
|
||||
|
||||
~~~ cmd
|
||||
AAA
|
||||
AAA [[-1]]
|
||||
function itGotRealBigRealFast() {
|
||||
if ( somethingIsTrue ) {
|
||||
doIt()
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"28": -1,
|
||||
"36": -1,
|
||||
"49": -1,
|
||||
"71": -1,
|
||||
"72": "b) In this capacity, Edward will have sole cookie discretionary powers",
|
||||
"99": "I have forgotten the exact number of seconds in a day, is it 86400",
|
||||
"100": -1,
|
||||
"126": -1,
|
||||
"158": -1,
|
||||
"169": -1,
|
||||
"218": -1
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ NOTE: [:q!](:q) `<Enter>`{normal} は全ての変更を破棄します。
|
||||
|
||||
4. 文が正しくなるまで ステップ 2 から 4 を繰り返しましょう。
|
||||
|
||||
その ううさぎ は つつきき を こええてて とびはねたた
|
||||
その ううさぎ は つつきき を こええてて とびはねたた [[その うさぎ は つき を こえて とびはねた]]
|
||||
|
||||
5. 行が正しくなったら、レッスン 1.4 へ進みましょう。
|
||||
|
||||
@@ -126,8 +126,8 @@ NOTE: 全てのレッスンを通じて、頭だけで覚えようとしない
|
||||
4. 間違いを修正したら `<Esc>`{normal} を押してノーマルモードに戻り、正しい文になる様にス
|
||||
テップ 2 から 4 を繰り返しましょう。
|
||||
|
||||
この には 足り テキスト が 。
|
||||
この 行 には 幾つか 足りない テキスト が ある。
|
||||
この には 足り テキスト が 。 [[この 行 には 幾つか 足りない テキスト が ある。]]
|
||||
この 行 には 幾つか 足りない テキスト が ある。 [[この 行 には 幾つか 足りない テキスト が ある。]]
|
||||
|
||||
5. 挿入の方法がわかったらレッスン 1.5 へ進みましょう。
|
||||
|
||||
@@ -145,10 +145,10 @@ NOTE: 全てのレッスンを通じて、頭だけで覚えようとしない
|
||||
4. 2行目の ✗ と示された場所へ移動し、ステップ 2 から 3 を繰り返して文章を修正し
|
||||
ましょう。
|
||||
|
||||
この 行 には 間違った テキスト が あり
|
||||
この 行 には 間違った テキスト が あります。
|
||||
ここ にも 間違った テキス
|
||||
ここ にも 間違った テキスト が あります。
|
||||
この 行 には 間違った テキスト が あり [[この 行 には 間違った テキスト が あります。]]
|
||||
この 行 には 間違った テキスト が あります。 [[この 行 には 間違った テキスト が あります。]]
|
||||
ここ にも 間違った テキス [[ここ にも 間違った テキスト が あります。]]
|
||||
ここ にも 間違った テキスト が あります。 [[ここ にも 間違った テキスト が あります。]]
|
||||
|
||||
5. テキストの追加が軽快になってきたらレッスン 1.6 へ進みましょう。
|
||||
|
||||
@@ -216,7 +216,7 @@ NOTE: `<Esc>`{normal} キーを押すとノーマルモードに移行します
|
||||
|
||||
4. 単語を削除するために [d](d)[w](w) とタイプしましょう。
|
||||
|
||||
この 文 紙 には いくつか たのしい 必要のない 単語 が 含まれて います。
|
||||
この 文 紙 には いくつか たのしい 必要のない 単語 が 含まれて います。 [[この 文 には いくつか 必要のない 単語 が 含まれて います。]]
|
||||
|
||||
5. ステップ 3 と 4 を文が正しくなるまで繰り返し、レッスン 2.2 へ進みましょう。
|
||||
|
||||
@@ -232,7 +232,7 @@ NOTE: `<Esc>`{normal} キーを押すとノーマルモードに移行します
|
||||
|
||||
4. 行末まで削除するために `d$`{normal} とタイプしましょう。
|
||||
|
||||
誰かがこの行の最後を2度タイプしました。 2度タイプしました。
|
||||
誰かがこの行の最後を2度タイプしました。 2度タイプしました。 [[誰かがこの行の最後を2度タイプしました。]]
|
||||
|
||||
5. どういうことか理解するために、レッスン 2.3 へ進みましょう。
|
||||
|
||||
@@ -271,7 +271,7 @@ NOTE: ノーマルモードにてオペレータなしにモーションを押
|
||||
|
||||
5. ステップ 2 と 3 を違う数値を使って繰り返します。
|
||||
|
||||
This is just a line with words you can move around in.
|
||||
This is just a line with words you can move around in. [[-1]]
|
||||
|
||||
6. レッスン 2.5 に進みましょう。
|
||||
|
||||
@@ -290,7 +290,7 @@ This is just a line with words you can move around in.
|
||||
3. 異なるカウントを使ってステップ 1 と 2 を繰り返し、残りの連続した大文字の単語
|
||||
を削除します。
|
||||
|
||||
このABC DE行のFGHI JK LMN OP単語はQ RS TUV綺麗になった。
|
||||
このABC DE行のFGHI JK LMN OP単語はQ RS TUV綺麗になった。 [[この行の単語は綺麗になった。]]
|
||||
|
||||
# レッスン 2.6: 行の操作
|
||||
|
||||
@@ -307,13 +307,13 @@ This is just a line with words you can move around in.
|
||||
|
||||
4. `2dd`{normal} とタイプして2行を削除します。
|
||||
|
||||
1) 薔薇は赤く
|
||||
2) 泥は楽しい
|
||||
3) 菫は青く
|
||||
4) 私は車をもっている
|
||||
5) 時計が時刻を告げる
|
||||
6) 砂糖は甘く
|
||||
7) そして貴方も
|
||||
1) 薔薇は赤く [[1) 薔薇は赤く]]
|
||||
2) 泥は楽しい [[]]
|
||||
3) 菫は青く [[3) 菫は青く]]
|
||||
4) 私は車をもっている [[]]
|
||||
5) 時計が時刻を告げる [[]]
|
||||
6) 砂糖は甘く [[6) 砂糖は甘く]]
|
||||
7) そして貴方も [[7) そして貴方も]]
|
||||
|
||||
# Lesson 2.7: やり直しコマンド
|
||||
|
||||
@@ -334,7 +334,7 @@ This is just a line with words you can move around in.
|
||||
7. ではコマンドを再実行するのに `<C-r>`{normal} (Ctrl + R)を数回タイプしてみましょう(取り
|
||||
消しの取り消し)。
|
||||
|
||||
このの行のの間違いを修正々し、後でそれらの修正をを取り消しまますす。
|
||||
このの行のの間違いを修正々し、後でそれらの修正をを取り消しまますす。 [[この行の間違いを修正し、後でそれらの修正を取り消します。]]
|
||||
|
||||
8. これはとても便利なコマンドです。さぁレッスン 2 要約へ進みましょう。
|
||||
|
||||
@@ -399,8 +399,8 @@ NOTE: `P`{normal} (大文字 P)とタイプすることで、カーソルの前
|
||||
|
||||
4. 最初の行が正しくなるまでステップ 2 から 3 を繰り返しましょう。
|
||||
|
||||
この合を人力した時ね、その人は幾つか問違ったキーを押しもした!
|
||||
この行を入力した時に、その人は幾つか間違ったキーを押しました!
|
||||
この合を人力した時ね、その人は幾つか問違ったキーを押しもした! [[この行を入力した時に、その人は幾つか間違ったキーを押しました!]]
|
||||
この行を入力した時に、その人は幾つか間違ったキーを押しました! [[この行を入力した時に、その人は幾つか間違ったキーを押しました!]]
|
||||
|
||||
5. さぁ、レッスン 3.3 へ進みましょう。
|
||||
|
||||
@@ -420,8 +420,8 @@ NOTE: 実際に試しましょう。決して覚えるだけにはしないこ
|
||||
|
||||
5. 最初の行が次の行の様になるまでステップ 3 と 4 を繰り返します。
|
||||
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator.
|
||||
This line has a few words that need changing using the change operator.
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
This line has a few words that need changing using the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
|
||||
[c](c)e は単語を削除した後、挿入モードに入ることに注意しましょう。
|
||||
|
||||
@@ -441,8 +441,8 @@ This line has a few words that need changing using the change operator.
|
||||
|
||||
5. `c$`{normal} とタイプして行の残りを2行目の様にし、`<Esc>`{normal} を押しましょう。
|
||||
|
||||
The end of this line needs some help to make it like the second.
|
||||
The end of this line needs to be corrected using the c$ command.
|
||||
The end of this line needs some help to make it like the second. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
The end of this line needs to be corrected using the c$ command. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
|
||||
NOTE: タイプ中の間違いはバックスペースキーを使って直すこともできます。
|
||||
|
||||
@@ -504,7 +504,7 @@ NOTE: 画面の右下隅にカーソルの座標が既に表示されている
|
||||
5. 元の場所に戻るには `<C-o>`{normal} (`<Ctrl>`{normal} を押し続けながら `o`{normal} をタイプ)を入力します。
|
||||
さらに戻るにはこれを繰り返します。`<C-i>`{normal} は前方向です。
|
||||
|
||||
"errroor" は error とスペルが違います; errroor はいわゆる error です。
|
||||
"errroor" は error とスペルが違います; errroor はいわゆる error です。 [[-1]]
|
||||
|
||||
NOTE: 検索がファイルの終わりに達すると、オプション ['wrapscan']('wrapscan') が設定されている場
|
||||
合は、ファイルの先頭から検索を続行します。
|
||||
@@ -523,7 +523,7 @@ NOTE: 検索がファイルの終わりに達すると、オプション ['wraps
|
||||
|
||||
5. 他の (, ), [, ], {, } でカーソルを移動し、`%`{normal} が何をしているか確認しましょう。
|
||||
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. ))
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. )) [[-1]]
|
||||
|
||||
NOTE: この機能は括弧が一致していないプログラムのデバッグにとても役立ちます!
|
||||
|
||||
@@ -547,7 +547,7 @@ NOTE: この機能は括弧が一致していないプログラムのデバッ
|
||||
追加した g [フラグ](:s_flags)は行全体を置換することを意味します。
|
||||
この変更はその行で見つかった全ての箇所に対して行われます。
|
||||
|
||||
Usually thee best time to see thee flowers is in thee spring.
|
||||
Usually thee best time to see thee flowers is in thee spring. [[Usually the best time to see the flowers is in the spring.]]
|
||||
|
||||
4. 複数行から見つかる文字の全ての箇所を変更するには:
|
||||
~~~ cmd
|
||||
@@ -737,12 +737,12 @@ NOTE: 外部コマンドの出力を読み込むこともできます。例え
|
||||
3. いくつか文字をタイプしてから、挿入モードを終了する為に `<Esc>`{normal} を入力します。
|
||||
その後、追加した行を削除してください。
|
||||
|
||||
`o`{normal} をタイプするとカーソルは開いた行へ移動し挿入モードに入ります。
|
||||
`o`{normal} をタイプするとカーソルは開いた行へ移動し挿入モードに入ります。 [[-1]]
|
||||
|
||||
4. カーソルの上の行に挿入するには、小文字の `o`{normal} ではなく、[大文字の O](O) をタイプしま
|
||||
す。次の行で試してみましょう。試し終わったら追加した行を削除してください。
|
||||
|
||||
この行の上へ挿入するには、この行へカーソルを置いて `O`{normal} をタイプします。
|
||||
この行の上へ挿入するには、この行へカーソルを置いて `O`{normal} をタイプします。 [[-1]]
|
||||
|
||||
# レッスン 6.2: 追加コマンド
|
||||
|
||||
@@ -758,8 +758,8 @@ NOTE: 外部コマンドの出力を読み込むこともできます。例え
|
||||
|
||||
5. `e`{normal} を使って次の不完全な単語へ移動し、ステップ 3 と 4 を繰り返します。
|
||||
|
||||
This li will allow you to pract appendi text to a line.
|
||||
This line will allow you to practice appending text to a line.
|
||||
This li will allow you to pract appendi text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
This line will allow you to practice appending text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
|
||||
NOTE: [a](a), [i](i) と [A](A) は同じ挿入モードへ移りますが、文字が挿入される位置は異なります。
|
||||
|
||||
@@ -776,8 +776,8 @@ NOTE: [a](a), [i](i) と [A](A) は同じ挿入モードへ移りますが、文
|
||||
|
||||
4. 残った "xxx" をステップを繰り返して置換しましょう。
|
||||
|
||||
Adding 123 to xxx gives you xxx.
|
||||
Adding 123 to 456 gives you 579.
|
||||
Adding 123 to xxx gives you xxx. [[Adding 123 to 456 gives you 579.]]
|
||||
Adding 123 to 456 gives you 579. [[Adding 123 to 456 gives you 579.]]
|
||||
|
||||
NOTE: 置換モードは挿入モードに似ていますが、全てのタイプされた文字は既存の文字を
|
||||
削除します。
|
||||
@@ -802,8 +802,8 @@ NOTE: 置換モードは挿入モードに似ていますが、全てのタイ
|
||||
7. ビジュアルモードで "item." を選択、`y`{normal} で yank、次の行の行末まで `j$`{normal} で移動
|
||||
し、 `p`{normal} でテキストをそこに put します。
|
||||
|
||||
a) This is the first item.
|
||||
b)
|
||||
a) This is the first item. [[a) This is the first item.]]
|
||||
b) [[b) This is the second item.]]
|
||||
|
||||
NOTE: `y`{normal} をオペレータとして使うこともできます。`yw`{normal} は単語を1つ yank します。
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"107": "その うさぎ は つき を こえて とびはねた",
|
||||
"129": "この 行 には 幾つか 足りない テキスト が ある。",
|
||||
"130": "この 行 には 幾つか 足りない テキスト が ある。",
|
||||
"148": "この 行 には 間違った テキスト が あります。",
|
||||
"149": "この 行 には 間違った テキスト が あります。",
|
||||
"150": "ここ にも 間違った テキスト が あります。",
|
||||
"151": "ここ にも 間違った テキスト が あります。",
|
||||
"219": "この 文 には いくつか 必要のない 単語 が 含まれて います。",
|
||||
"235": "誰かがこの行の最後を2度タイプしました。",
|
||||
"274": -1,
|
||||
"293": "この行の単語は綺麗になった。",
|
||||
"310": "1) 薔薇は赤く",
|
||||
"311": "",
|
||||
"312": "3) 菫は青く",
|
||||
"313": "",
|
||||
"314": "",
|
||||
"315": "6) 砂糖は甘く",
|
||||
"316": "7) そして貴方も",
|
||||
"337": "この行の間違いを修正し、後でそれらの修正を取り消します。",
|
||||
"402": "この行を入力した時に、その人は幾つか間違ったキーを押しました!",
|
||||
"403": "この行を入力した時に、その人は幾つか間違ったキーを押しました!",
|
||||
"423": "This line has a few words that need changing using the change operator.",
|
||||
"424": "This line has a few words that need changing using the change operator.",
|
||||
"444": "The end of this line needs to be corrected using the c$ command.",
|
||||
"445": "The end of this line needs to be corrected using the c$ command.",
|
||||
"507": -1,
|
||||
"526": -1,
|
||||
"550": "Usually the best time to see the flowers is in the spring.",
|
||||
"740": -1,
|
||||
"745": -1,
|
||||
"761": "This line will allow you to practice appending text to a line.",
|
||||
"762": "This line will allow you to practice appending text to a line.",
|
||||
"779": "Adding 123 to 456 gives you 579.",
|
||||
"780": "Adding 123 to 456 gives you 579.",
|
||||
"805": "a) This is the first item.",
|
||||
"806": "b) This is the second item."
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
5. 単語 'cake' の上に移動した後、`ciw<CTRL-r>b<ESC>`{normal} とタイプします。
|
||||
|
||||
a) Edward will henceforth be in charge of the cookie rations
|
||||
b) In this capacity, Vince will have sole cake discretionary powers
|
||||
a) Edward will henceforth be in charge of the cookie rations [[-1]]
|
||||
b) In this capacity, Vince will have sole cake discretionary powers [[b) In this capacity, Edward will have sole cookie discretionary powers]]
|
||||
|
||||
NOTE: 削除した文字列もレジスタに格納されます。例えば `"sdiw`{normal} はカーソル下の単語を
|
||||
削除し、レジスタ s に格納します。
|
||||
@@ -63,8 +63,8 @@ REFERENCE: [レジスタ](registers)
|
||||
NOTE: すべてのシステムコールは OS 依存です。例えば Windows では以下を使います:
|
||||
`system('date /t')`{vim} または `:r!date /t`{vim}
|
||||
|
||||
一日って何秒だっけ、 84600 秒かな?
|
||||
本日の日付は:
|
||||
一日って何秒だっけ、 84600 秒かな? [[一日って何秒だっけ、 86400 秒かな?]]
|
||||
本日の日付は: [[-1]]
|
||||
|
||||
NOTE: 日付を入力するには、`:pu=`{normal}`system('date')`{vim} や、よりキーストロークの少ない
|
||||
`:r!date`{vim} でも可能です。
|
||||
@@ -90,7 +90,7 @@ NOTE: 新たに削除された項目が追加される度に、古い項目が
|
||||
|
||||
5. 次の順番でレジスタをペーストします: c, 7, 4, 8, 2。例: `"7p`{normal}
|
||||
|
||||
0. ねがわくは
|
||||
0. ねがわくは [[-1]]
|
||||
9. おちゃめな
|
||||
8. ゔぃまーと
|
||||
7. いつまでも
|
||||
@@ -135,7 +135,7 @@ NOTE: 行内におけるカーソル位置は重要ではありません!
|
||||
NOTE: `ma$%"ad'a`{normal} という操作に慣れるまで何度も練習しましょう。
|
||||
|
||||
~~~ cmd
|
||||
AAA
|
||||
AAA [[-1]]
|
||||
function itGotRealBigRealFast() {
|
||||
if ( somethingIsTrue ) {
|
||||
doIt()
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"38": -1,
|
||||
"39": "b) In this capacity, Edward will have sole cookie discretionary powers",
|
||||
"66": "一日って何秒だっけ、 86400 秒かな?",
|
||||
"67": -1,
|
||||
"93": -1,
|
||||
"138": -1
|
||||
}
|
||||
}
|
||||
@@ -53,27 +53,27 @@ is displayed like
|
||||
|
||||
1. Format the line below so it becomes a lesson description:
|
||||
|
||||
This is text with important information
|
||||
This is text with **important information**
|
||||
This is text with important information [[This is text with **important information**]]
|
||||
This is text with **important information** [[This is text with **important information**]]
|
||||
|
||||
Note: Some words (e.g., NOTE, IMPORTANT, tip, ATTENTION, etc.) will also be
|
||||
highlighted. You don't need to mark them specially.
|
||||
|
||||
2. Turn the line below into a TODO item:
|
||||
|
||||
Document '&variable'
|
||||
TODO: Document '&variable'
|
||||
Document '&variable' [[TODO: Document '&variable']]
|
||||
TODO: Document '&variable' [[TODO: Document '&variable']]
|
||||
|
||||
### Headers *headers*
|
||||
|
||||
3. Practice fixing the lines below:
|
||||
|
||||
This is a level 1 header
|
||||
# This is a level 1 header
|
||||
This is a level 3 header
|
||||
### This is a level 3 header
|
||||
This is a header with a label
|
||||
# This is a header with a label {*label*}
|
||||
This is a level 1 header [[# This is a level 1 header]]
|
||||
# This is a level 1 header [[# This is a level 1 header]]
|
||||
This is a level 3 header [[### This is a level 3 header]]
|
||||
### This is a level 3 header [[### This is a level 3 header]]
|
||||
This is a header with a label [[# This is a header with a label {*label*}]]
|
||||
# This is a header with a label {*label*} [[# This is a header with a label {*label*}]]
|
||||
|
||||
4. Now, create a 4th level section here, and add a label like in the previous
|
||||
exercise:
|
||||
@@ -98,8 +98,8 @@ If the target of a link matches a help topic, opening it will open it.
|
||||
|
||||
5. Fix the following line:
|
||||
|
||||
A link to help for the 'breakindent' option
|
||||
A link to help for the ['breakindent']('breakindent') option
|
||||
A link to help for the 'breakindent' option [[A link to help for the ['breakindent']('breakindent') option]]
|
||||
A link to help for the ['breakindent']('breakindent') option [[A link to help for the ['breakindent']('breakindent') option]]
|
||||
|
||||
#### Anchor links
|
||||
|
||||
@@ -113,8 +113,8 @@ and are hidden by default. Links to them look like
|
||||
|
||||
6. Add the appropriate link:
|
||||
|
||||
A link to the Links section
|
||||
A link to the [Links](*links*) section
|
||||
A link to the Links section [[A link to the [Links](*links*) section]]
|
||||
A link to the [Links](*links*) section [[A link to the [Links](*links*) section]]
|
||||
|
||||
7. Now, create a link to the section you created on exercise 4
|
||||
above.
|
||||
@@ -129,8 +129,8 @@ You can also have links to other tutorials. For this, you'll write the anchor in
|
||||
|
||||
7. Create a link to this tutorial:
|
||||
|
||||
A link to the vim-tutor-mode tutorial
|
||||
A link to [the vim-tutor-mode tutorial](@tutor:tutor)
|
||||
A link to the vim-tutor-mode tutorial [[A link to [the vim-tutor-mode tutorial](@tutor:tutor)]]
|
||||
A link to [the vim-tutor-mode tutorial](@tutor:tutor) [[A link to [the vim-tutor-mode tutorial](@tutor:tutor)]]
|
||||
|
||||
### Codeblocks *codeblocks*
|
||||
|
||||
@@ -147,13 +147,13 @@ echom "hello"
|
||||
|
||||
8. Copy the viml section below
|
||||
|
||||
[[~~~ viml]]
|
||||
[[echom 'the value of &number is'.string(&number)]]
|
||||
[[~~~]]
|
||||
|
||||
|
||||
|
||||
|
||||
~~~ viml
|
||||
echom 'the value of &number is'.string(&number)
|
||||
~~~
|
||||
~~~ viml [[~~~ viml]]
|
||||
echom 'the value of &number is'.string(&number) [[echom 'the value of &number is'.string(&number)]]
|
||||
~~~ [[~~~]]
|
||||
|
||||
You can inline viml code using "\`" and "\`{vim}":
|
||||
|
||||
@@ -178,13 +178,13 @@ Note: you can also write `norm` or `normal`.
|
||||
|
||||
9. Copy the normal section below
|
||||
|
||||
[[~~~ normal]]
|
||||
[[d2w]]
|
||||
[[~~~]]
|
||||
|
||||
|
||||
|
||||
|
||||
~~~ normal
|
||||
d2w
|
||||
~~~
|
||||
~~~ normal [[~~~ normal]]
|
||||
d2w [[d2w]]
|
||||
~~~ [[~~~]]
|
||||
|
||||
You can also inline normal commands by using "\`" and "\`{normal}":
|
||||
|
||||
@@ -196,8 +196,8 @@ is displayed:
|
||||
|
||||
10. Complete the line as shown
|
||||
|
||||
d
|
||||
`d2w`{normal}
|
||||
d [[`d2w`{normal}]]
|
||||
`d2w`{normal} [[`d2w`{normal}]]
|
||||
|
||||
Commands to run in the system shell can be highlighted by indenting a line
|
||||
starting with "$".
|
||||
@@ -216,25 +216,15 @@ to the left. Otherwise, a ✗ sign is displayed.
|
||||
### expect *expect*
|
||||
|
||||
"expect" lines check that the contents of the line are identical to some preset text
|
||||
(like in the exercises above).
|
||||
(like in the exercises above). The expected text is defined in inline comments that
|
||||
are not visible to the user.
|
||||
|
||||
These elements are specified in separate JSON files like this
|
||||
An example line is written like "This is wrong. [[This is right.]]"
|
||||
The user will see "This is wrong." and have an interactive sign.
|
||||
|
||||
~~~ json
|
||||
{
|
||||
"expect": {
|
||||
"1": "This is how this line should look.",
|
||||
"2": "This is how this line should look.",
|
||||
"3": -1
|
||||
}
|
||||
}
|
||||
~~~
|
||||
A value of [[-1]] means that the condition for the line will always be satisfied,
|
||||
no matter what (this is useful for letting the user play a bit).
|
||||
|
||||
These files contain an "expect" dictionary, for which the keys are line numbers and
|
||||
the values are the expected text. A value of -1 means that the condition for the line
|
||||
will always be satisfied, no matter what (this is useful for letting the user play a bit).
|
||||
This is an "expect" line that is always satisfied. Try changing it. [[-1]]
|
||||
|
||||
This is an "expect" line that is always satisfied. Try changing it.
|
||||
|
||||
These files conventionally have the same name as the tutorial document with the `.json`
|
||||
extension appended (for a full example, see the file that corresponds to this tutorial).
|
||||
For a full example, see the file that corresponds to this tutorial.
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"56": "This is text with **important information**",
|
||||
"57": "This is text with **important information**",
|
||||
"64": "TODO: Document '&variable'",
|
||||
"65": "TODO: Document '&variable'",
|
||||
"71": "# This is a level 1 header",
|
||||
"72": "# This is a level 1 header",
|
||||
"73": "### This is a level 3 header",
|
||||
"74": "### This is a level 3 header",
|
||||
"75": "# This is a header with a label {*label*}",
|
||||
"76": "# This is a header with a label {*label*}",
|
||||
"101": "A link to help for the ['breakindent']('breakindent') option",
|
||||
"102": "A link to help for the ['breakindent']('breakindent') option",
|
||||
"116": "A link to the [Links](*links*) section",
|
||||
"117": "A link to the [Links](*links*) section",
|
||||
"132": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)",
|
||||
"133": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)",
|
||||
"150": "~~~ viml",
|
||||
"151": "echom 'the value of &number is'.string(&number)",
|
||||
"152": "~~~",
|
||||
"154": "~~~ viml",
|
||||
"155": "echom 'the value of &number is'.string(&number)",
|
||||
"156": "~~~",
|
||||
"181": "~~~ normal",
|
||||
"182": "d2w",
|
||||
"183": "~~~",
|
||||
"185": "~~~ normal",
|
||||
"186": "d2w",
|
||||
"187": "~~~",
|
||||
"199": "`d2w`{normal}",
|
||||
"200": "`d2w`{normal}",
|
||||
"237": -1
|
||||
}
|
||||
}
|
||||
@@ -93,8 +93,8 @@ NOTE: [:q!](:q) `<Enter>`{normal} 会丢弃你做的任何更改。在接下来
|
||||
|
||||
4. 重复第 2 到 4 步,直到句子正确为止。
|
||||
|
||||
The ccow jumpedd ovverr thhe mooon.
|
||||
The cow jumped over the moon.
|
||||
The ccow jumpedd ovverr thhe mooon. [[The cow jumped over the moon.]]
|
||||
The cow jumped over the moon. [[The cow jumped over the moon.]]
|
||||
|
||||
5. 现在句子已经正确了,请继续学习第 1.4 课。
|
||||
|
||||
@@ -114,8 +114,8 @@ NOTE: 在学习本教程时,不必试图记住所有内容,你的 Neovim 词
|
||||
4. 每个错误修正后,按 `<Esc>`{normal} 键回到普通模式。
|
||||
重复第 2 到 4 步来修正整个句子。
|
||||
|
||||
There is text misng this .
|
||||
There is some text missing from this line.
|
||||
There is text misng this . [[There is some text missing from this line.]]
|
||||
There is some text missing from this line. [[There is some text missing from this line.]]
|
||||
|
||||
5. 当你熟练掌握插入文本后,请继续学习第 1.5 课。
|
||||
|
||||
@@ -132,10 +132,10 @@ There is some text missing from this line.
|
||||
|
||||
4. 将光标移动到标有 ✗ 的第二行,并重复第 2 和第 3 步来修正这个句子。
|
||||
|
||||
There is some text missing from th
|
||||
There is some text missing from this line.
|
||||
There is also some text miss
|
||||
There is also some text missing here.
|
||||
There is some text missing from th [[There is some text missing from this line.]]
|
||||
There is some text missing from this line. [[There is some text missing from this line.]]
|
||||
There is also some text miss [[There is also some text missing here.]]
|
||||
There is also some text missing here. [[There is also some text missing here.]]
|
||||
|
||||
5. 当你熟练掌握追加文本后,请继续学习第 1.6 课。
|
||||
|
||||
@@ -201,8 +201,8 @@ NOTE: 按 `<Esc>`{normal} 键会让你进入普通模式,或者取消一个不
|
||||
|
||||
4. 输入 [d](d)[w](w) 让这个单词消失。
|
||||
|
||||
There are a some words fun that don't belong paper in this sentence.
|
||||
There are some words that don't belong in this sentence.
|
||||
There are a some words fun that don't belong paper in this sentence. [[There are some words that don't belong in this sentence.]]
|
||||
There are some words that don't belong in this sentence. [[There are some words that don't belong in this sentence.]]
|
||||
|
||||
5. 重复第 3 和第 4 步,直到句子正确,然后继续学习第 2.2 课。
|
||||
|
||||
@@ -218,7 +218,7 @@ There are some words that don't belong in this sentence.
|
||||
|
||||
4. 输入 `d$`{normal} 来删除到行尾的所有内容。
|
||||
|
||||
Somebody typed the end of this line twice. end of this line twice.
|
||||
Somebody typed the end of this line twice. end of this line twice. [[Somebody typed the end of this line twice.]]
|
||||
|
||||
5. 继续学习第 2.3 课,来理解这背后的原理。
|
||||
|
||||
@@ -256,7 +256,7 @@ NOTE: 在普通模式下,不带操作符、只按下移动键,将会像预
|
||||
|
||||
5. 用不同的数字重复第 2 和第 3 步。
|
||||
|
||||
This is just a line with words you can move around in.
|
||||
This is just a line with words you can move around in. [[-1]]
|
||||
|
||||
6. 继续学习第 2.5 课。
|
||||
|
||||
@@ -273,7 +273,7 @@ This is just a line with words you can move around in.
|
||||
|
||||
3. 重复第 1 和第 2 步,但使用不同的计数,用一个命令删除剩余连续的全大写单词。
|
||||
|
||||
This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
||||
This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. [[This line of words is cleaned up.]]
|
||||
|
||||
# 第 2.6 课:行操作
|
||||
|
||||
@@ -289,13 +289,13 @@ This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
||||
|
||||
4. 输入 `2dd`{normal} 来删除两行。
|
||||
|
||||
1) Roses are red,
|
||||
2) Mud is fun,
|
||||
3) Violets are blue,
|
||||
4) I have a car,
|
||||
5) Clocks tell time,
|
||||
6) Sugar is sweet
|
||||
7) And so are you.
|
||||
1) Roses are red, [[1) Roses are red,]]
|
||||
2) Mud is fun, [[]]
|
||||
3) Violets are blue, [[3) Violets are blue,]]
|
||||
4) I have a car, [[]]
|
||||
5) Clocks tell time, [[]]
|
||||
6) Sugar is sweet [[6) Sugar is sweet]]
|
||||
7) And so are you. [[7) And so are you.]]
|
||||
|
||||
# 第 2.7 课:撤销命令(Undo)
|
||||
|
||||
@@ -315,8 +315,8 @@ This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
|
||||
|
||||
7. 现在多次输入 `<C-r>`{normal}(Ctrl + R),来重做(redo)那些被撤销的命令。
|
||||
|
||||
Fiix the errors oon thhis line and reeplace them witth undo.
|
||||
Fix the errors on this line and replace them with undo.
|
||||
Fiix the errors oon thhis line and reeplace them witth undo. [[Fix the errors on this line and replace them with undo.]]
|
||||
Fix the errors on this line and replace them with undo. [[Fix the errors on this line and replace them with undo.]]
|
||||
|
||||
8. 这些都是非常有用的命令。现在请继续学习第 2 课的总结。
|
||||
|
||||
@@ -381,8 +381,8 @@ NOTE: 你也可以用 `P`{normal}(大写 P)将文本粘贴到光标之前。
|
||||
|
||||
4. 重复第 2 和第 3 步,直到第一行和第二行完全一样。
|
||||
|
||||
Whan this lime was tuoed in, someone presswd some wrojg keys!
|
||||
When this line was typed in, someone pressed some wrong keys!
|
||||
Whan this lime was tuoed in, someone presswd some wrojg keys! [[When this line was typed in, someone pressed some wrong keys!]]
|
||||
When this line was typed in, someone pressed some wrong keys! [[When this line was typed in, someone pressed some wrong keys!]]
|
||||
|
||||
5. 现在请继续学习第 3.3 课。
|
||||
|
||||
@@ -402,8 +402,8 @@ NOTE: 请记住,你应该通过实践来学习,而不是死记硬背。
|
||||
|
||||
5. 重复第 3 和第 4 步,直到第一句和第二句完全一样。
|
||||
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator.
|
||||
This line has a few words that need changing using the change operator.
|
||||
This lubw has a few wptfd that mrrf changing usf the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
This line has a few words that need changing using the change operator. [[This line has a few words that need changing using the change operator.]]
|
||||
|
||||
请注意,[c](c)e 会删除单词并让你进入插入模式(Insert mode)。
|
||||
|
||||
@@ -423,8 +423,8 @@ This line has a few words that need changing using the change operator.
|
||||
|
||||
5. 输入 `c$`{normal},然后输入该行余下正确的内容(参照第二行),最后按 `<Esc>`{normal}。
|
||||
|
||||
The end of this line needs some help to make it like the second.
|
||||
The end of this line needs to be corrected using the c$ command.
|
||||
The end of this line needs some help to make it like the second. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
The end of this line needs to be corrected using the c$ command. [[The end of this line needs to be corrected using the c$ command.]]
|
||||
|
||||
NOTE: 在输入时,你可以使用退格键(Backspace)来修正错误。
|
||||
|
||||
@@ -481,7 +481,7 @@ NOTE: 你可能会在屏幕右下角看到光标位置。这是因为设置了 [
|
||||
5. 要回到你之前的位置,按 `<C-o>`{normal}。(按住 `<Ctrl>`{normal} 键的同时按字母 `o`{normal})。
|
||||
重复按可以回到更早的位置。`<C-i>`{normal} 则会前进。
|
||||
|
||||
"errroor" is not the way to spell error; errroor is an error.
|
||||
"errroor" is not the way to spell error; errroor is an error. [[-1]]
|
||||
|
||||
NOTE: 当搜索到达文件末尾时,它会从头开始继续搜索,除非 ['wrapscan']('wrapscan') 选项被关闭了。
|
||||
|
||||
@@ -499,7 +499,7 @@ NOTE: 当搜索到达文件末尾时,它会从头开始继续搜索,除非 [
|
||||
|
||||
5. 将光标移动到另一个 (, ), [, ], {, } 上,看看 `%`{normal} 的效果。
|
||||
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. ))
|
||||
This ( is a test line with ('s, ['s, ] and {'s } in it. )) [[-1]]
|
||||
|
||||
NOTE: 这在调试程序中不匹配的括号时非常有用!
|
||||
|
||||
@@ -521,7 +521,7 @@ NOTE: 这在调试程序中不匹配的括号时非常有用!
|
||||
~~~
|
||||
加上 g [标志](:s_flags) 意味着在行内进行全局替换,也就是改变该行中所有出现的 "thee"。
|
||||
|
||||
Usually thee best time to see thee flowers is in thee spring.
|
||||
Usually thee best time to see thee flowers is in thee spring. [[Usually the best time to see the flowers is in the spring.]]
|
||||
|
||||
4. 要在两行之间替换一个字符串的所有出现,输入
|
||||
~~~ cmd
|
||||
@@ -699,12 +699,12 @@ NOTE: 你也可以读取一个外部命令的输出。例如:
|
||||
|
||||
3. 现在输入一些文本,然后按 `<Esc>`{normal} 退出插入模式。完成后请删除你开启的行。
|
||||
|
||||
After typing `o`{normal} the cursor is placed on the open line in Insert mode.
|
||||
After typing `o`{normal} the cursor is placed on the open line in Insert mode. [[-1]]
|
||||
|
||||
4. 要在光标“上方”开启一个新行,只需输入[大写 O](O),而不是小写 `o`{normal}。
|
||||
在下面这行上试试。完成后请删除你开启的行。
|
||||
|
||||
Open up a line above this by typing O while the cursor is on this line.
|
||||
Open up a line above this by typing O while the cursor is on this line. [[-1]]
|
||||
|
||||
# 第 6.2 课:追加命令(Append)
|
||||
|
||||
@@ -720,8 +720,8 @@ Open up a line above this by typing O while the cursor is on this line.
|
||||
|
||||
5. 使用 `e`{normal} 移动到下一个不完整的单词,并重复第 3 和第 4 步。
|
||||
|
||||
This li will allow you to pract appendi text to a line.
|
||||
This line will allow you to practice appending text to a line.
|
||||
This li will allow you to pract appendi text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
This line will allow you to practice appending text to a line. [[This line will allow you to practice appending text to a line.]]
|
||||
|
||||
NOTE: [a](a)、[i](i) 和 [A](A) 都会进入同一个插入模式,唯一的区别是字符被插入的位置不同。
|
||||
|
||||
@@ -737,8 +737,8 @@ NOTE: [a](a)、[i](i) 和 [A](A) 都会进入同一个插入模式,唯一的
|
||||
|
||||
4. 重复以上步骤来替换剩下的 "xxx"。
|
||||
|
||||
Adding 123 to xxx gives you xxx.
|
||||
Adding 123 to 456 gives you 579.
|
||||
Adding 123 to xxx gives you xxx. [[Adding 123 to 456 gives you 579.]]
|
||||
Adding 123 to 456 gives you 579. [[Adding 123 to 456 gives you 579.]]
|
||||
|
||||
NOTE: 替换模式很像插入模式,但你输入的每个字符都会替换掉一个已有的字符。
|
||||
|
||||
@@ -762,8 +762,8 @@ NOTE: 替换模式很像插入模式,但你输入的每个字符都会替换
|
||||
7. 使用可视模式选中 "item.",用 `y`{normal} 复制它,用 `j$`{normal} 移动到
|
||||
下一行的末尾,然后用 `p`{normal} 在那里粘贴文本。
|
||||
|
||||
a) This is the first item.
|
||||
b)
|
||||
a) This is the first item. [[a) This is the first item.]]
|
||||
b) [[b) This is the second item.]]
|
||||
|
||||
NOTE: 你可以把 `y`{normal} 当作一个操作符来使用:`yw`{normal} 会复制一个单词。
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"96": "The cow jumped over the moon.",
|
||||
"97": "The cow jumped over the moon.",
|
||||
"117": "There is some text missing from this line.",
|
||||
"118": "There is some text missing from this line.",
|
||||
"135": "There is some text missing from this line.",
|
||||
"136": "There is some text missing from this line.",
|
||||
"137": "There is also some text missing here.",
|
||||
"138": "There is also some text missing here.",
|
||||
"204": "There are some words that don't belong in this sentence.",
|
||||
"205": "There are some words that don't belong in this sentence.",
|
||||
"221": "Somebody typed the end of this line twice.",
|
||||
"259": -1,
|
||||
"276": "This line of words is cleaned up.",
|
||||
"292": "1) Roses are red,",
|
||||
"293": "",
|
||||
"294": "3) Violets are blue,",
|
||||
"295": "",
|
||||
"296": "",
|
||||
"297": "6) Sugar is sweet",
|
||||
"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.",
|
||||
"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.",
|
||||
"406": "This line has a few words that need changing using the change operator.",
|
||||
"426": "The end of this line needs to be corrected using the c$ command.",
|
||||
"427": "The end of this line needs to be corrected using the c$ command.",
|
||||
"484": -1,
|
||||
"502": -1,
|
||||
"524": "Usually the best time to see the flowers is in the spring.",
|
||||
"702": -1,
|
||||
"707": -1,
|
||||
"723": "This line will allow you to practice appending text to a line.",
|
||||
"724": "This line will allow you to practice appending text to a line.",
|
||||
"740": "Adding 123 to 456 gives you 579.",
|
||||
"741": "Adding 123 to 456 gives you 579.",
|
||||
"765": "a) This is the first item.",
|
||||
"766": "b) This is the second item."
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,8 @@ nner (w)ord(修改内部单词)*
|
||||
|
||||
5. 导航到 'cake' 单词的任意位置,然后输入 `ciw<CTRL-r>b<ESC>`{normal}
|
||||
|
||||
a) Edward will henceforth be in charge of the cookie rations
|
||||
b) In this capacity, Vince will have sole cake discretionary powers
|
||||
a) Edward will henceforth be in charge of the cookie rations [[-1]]
|
||||
b) In this capacity, Vince will have sole cake discretionary powers [[b) In this capacity, Edward will have sole cookie discretionary powers]]
|
||||
|
||||
NOTE: 删除操作同样可以存入寄存器,例如 `"sdiw`{normal} 会将被光标下的单词删除并存入寄存器 s。
|
||||
|
||||
@@ -59,8 +59,8 @@ NOTE: 删除操作同样可以存入寄存器,例如 `"sdiw`{normal} 会将被
|
||||
NOTE: 所有对 `system` 的调用都依赖于操作系统,例如在 Windows 上应使用
|
||||
`system('date /t')`{vim} 或 `:r!date /t`{vim}
|
||||
|
||||
I have forgotten the exact number of seconds in a day, is it 84600?
|
||||
Today's date is:
|
||||
I have forgotten the exact number of seconds in a day, is it 84600? [[I have forgotten the exact number of seconds in a day, is it 86400]]
|
||||
Today's date is: [[-1]]
|
||||
|
||||
NOTE: 同样效果也可以通过 `:pu=`{normal}`system('date')`{vim} 实现,
|
||||
或者用更少的按键 `:r!date`{vim}
|
||||
@@ -86,7 +86,7 @@ NOTE: 你应该会发现,当新的整行删除内容被添加进来时,之
|
||||
|
||||
5. 现在,按顺序 (p)aste(粘贴)以下寄存器中的内容:c, 7, 4, 8, 2。例如,使用 `"7p`{normal}
|
||||
|
||||
0. This
|
||||
0. This [[-1]]
|
||||
9. wobble
|
||||
8. secret
|
||||
7. is
|
||||
@@ -129,7 +129,7 @@ NOTE: 光标在该行的确切位置并不重要!
|
||||
NOTE: 多次练习这个操作以达到熟练:`ma$%"ad'a`{normal}
|
||||
|
||||
~~~ cmd
|
||||
AAA
|
||||
AAA [[-1]]
|
||||
function itGotRealBigRealFast() {
|
||||
if ( somethingIsTrue ) {
|
||||
doIt()
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"expect": {
|
||||
"35": -1,
|
||||
"36": "b) In this capacity, Edward will have sole cookie discretionary powers",
|
||||
"62": "I have forgotten the exact number of seconds in a day, is it 86400",
|
||||
"63": -1,
|
||||
"89": -1,
|
||||
"132": -1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user