tutor: readjust tutor for 80 char wide terminals

This commit is contained in:
Felipe Morales
2018-01-01 14:26:45 +01:00
parent 907b2f18f7
commit f4e372c8ab
2 changed files with 359 additions and 340 deletions

View File

@@ -1,26 +1,26 @@
# Welcome to the VIM Tutor # Welcome to the VIM Tutor
Vim is a very powerful editor that has many commands, too many to explain in a Vim is a very powerful editor that has many commands, too many to explain in
tutor such as this. This tutor is designed to describe enough of the commands a tutor such as this. This tutor is designed to describe enough of the
that you will be able to easily use Vim as an all-purpose editor. It is commands that you will be able to easily use Vim as an all-purpose editor.
IMPORTANT to remember that this tutor is set up to teach by use. That means It is IMPORTANT to remember that this tutor is set up to teach by use. That
that you need to do the exercises to learn them properly. If you only read means that you need to do the exercises to learn them properly. If you only
the text, you will soon forget what is most important! read the text, you will soon forget what is most important!
For now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal} For now, make sure that your Shift-Lock key is NOT depressed and press the
key enough times to move the cursor so that Lesson 0 completely fills the `j`{normal} key enough times to move the cursor so that Lesson 0 completely
screen. fills the screen.
# Lesson 0 # Lesson 0
NOTE: The commands in the lessons will modify the text, but those changes won't NOTE: The commands in the lessons will modify the text, but those changes
be saved. Don't worry about messing things up; just remember that pressing won't be saved. Don't worry about messing things up; just remember that
[<Esc>](<Esc>) and then [u](u) will undo the latest change. pressing [<Esc>](<Esc>) and then [u](u) will undo the latest change.
This tutorial is interactive, and there are a few things you should know. This tutorial is interactive, and there are a few things you should know.
Pressing [<Enter>](<Enter>) over text highlighted [like this](holy-grail) will take you to some Pressing [<Enter>](<Enter>) over text highlighted [like this](holy-grail )
relevant help (hopefully), and pressing K over any word will try to do so too. will take you to some relevant help (hopefully), and pressing K over any
Sometimes you will be required to modify text like word will try to do so too. Sometimes you will be required to modify text like
this here this here
Once you have done the changes correctly, the ✗ sign at the left will change Once you have done the changes correctly, the ✗ sign at the left will change
to ✓. I imagine you can already see how neat Vim can be. ;) to ✓. I imagine you can already see how neat Vim can be. ;)
@@ -33,10 +33,10 @@ or press a sequence of keys
<Esc>0f<Space>d3wP$P <Esc>0f<Space>d3wP$P
~~~ ~~~
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press
to type. instead of text to type.
Now, move to the next lesson (remember, use the `j`{normal} key to scroll down). Now, move to the next lesson (use the `j`{normal} key to scroll down).
## Lesson 1.1: MOVING THE CURSOR ## Lesson 1.1: MOVING THE CURSOR
@@ -63,9 +63,10 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
# Lesson 1.2: EXITING VIM # Lesson 1.2: EXITING VIM
!! NOTE: Before executing any of the steps below, read this entire lesson !! !! NOTE: Before executing any of the steps below,
read this entire lesson !!
1. Press the <Esc> key (to make sure you are in [Normal mode](Normal-mode). 1. Press the <Esc> key (to make sure you are in Normal mode).
2. Type: 2. Type:
@@ -73,8 +74,8 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
This exits the editor, DISCARDING any changes you have made. This exits the editor, DISCARDING any changes you have made.
3. Open vim and get back here by executing the command that got you into this 3. Open vim and get back here by executing the command that got you into
tutor. That might be: this tutor. That might be:
:Tutor <Enter> :Tutor <Enter>
@@ -103,7 +104,8 @@ The ccow jumpedd ovverr thhe mooon.
5. Now that the line is correct, go on to Lesson 1.4. 5. Now that the line is correct, go on to Lesson 1.4.
NOTE: As you go through this tutor, do not try to memorize, learn by usage. NOTE: As you go through this tutor, do not try to memorize, learn by
usage.
# Lesson 1.4: TEXT EDITING: INSERTION # Lesson 1.4: TEXT EDITING: INSERTION
@@ -133,7 +135,8 @@ There is some text missing from this line.
2. Press [A](A) and type in the necessary additions. 2. Press [A](A) and type in the necessary additions.
3. As the text has been appended press `<Esc>`{normal} to return to Normal mode. 3. As the text has been appended press `<Esc>`{normal} to return to Normal
mode.
4. Move the cursor to the second line marked ---> and repeat 4. Move the cursor to the second line marked ---> and repeat
steps 2 and 3 to correct this sentence. steps 2 and 3 to correct this sentence.
@@ -158,8 +161,8 @@ There is also some text missing here.
~~~ sh ~~~ sh
$ vim tutor $ vim tutor
~~~ ~~~
'vim' is the command to start the Vim editor, 'tutor' is the name of the 'vim' is the command to start the Vim editor, 'tutor' is the name of
file you wish to edit. Use a file that may be changed. the file you wish to edit. Use a file that may be changed.
3. Insert and delete text as you learned in the previous lessons. 3. Insert and delete text as you learned in the previous lessons.
@@ -170,8 +173,8 @@ There is also some text missing here.
Note you'll need to press `<Enter>` to execute the command. Note you'll need to press `<Enter>` to execute the command.
5. If you have quit vimtutor in step 1 restart the vimtutor and move down to 5. If you have quit vimtutor in step 1 restart the vimtutor and move down
the following summary. to the following summary.
6. After reading the above steps and understanding them: do it. 6. After reading the above steps and understanding them: do it.
@@ -186,8 +189,10 @@ There is also some text missing here.
$ vim FILENAME $ vim FILENAME
~~~ ~~~
3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes. 3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash
OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes. all changes.
OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save
the changes.
4. To delete the character at the cursor type: `x`{normal} 4. To delete the character at the cursor type: `x`{normal}
@@ -234,8 +239,8 @@ Somebody typed the end of this line twice. end of this line twice.
# Lesson 2.3: ON OPERATORS AND MOTIONS # Lesson 2.3: ON OPERATORS AND MOTIONS
Many commands that change text are made from an [operator](operator) and
Many commands that change text are made from an [operator](operator) and a [motion](navigation). a [motion](navigation).
The format for a delete command with the [d](d) delete operator is as follows: The format for a delete command with the [d](d) delete operator is as follows:
d motion d motion
@@ -251,8 +256,8 @@ The format for a delete command with the [d](d) delete operator is as follows:
Thus typing `de`{normal} will delete from the cursor to the end of the word. Thus typing `de`{normal} will delete from the cursor to the end of the word.
NOTE: Pressing just the motion while in Normal mode without an operator will NOTE: Pressing just the motion while in Normal mode without an operator
move the cursor as specified. will move the cursor as specified.
# Lesson 2.4: USING A COUNT FOR A MOTION # Lesson 2.4: USING A COUNT FOR A MOTION
@@ -293,8 +298,8 @@ This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
** Type `dd`{normal} to delete a whole line. ** ** Type `dd`{normal} to delete a whole line. **
Due to the frequency of whole line deletion, the designers of Vi decided Due to the frequency of whole line deletion, the designers of Vi decided
it would be easier to simply type two d's to delete a line. it would be easier to simply type two d's to delete a line.
1. Move the cursor to the second line in the phrase below. 1. Move the cursor to the second line in the phrase below.
2. Type [dd](dd) to delete the line. 2. Type [dd](dd) to delete the line.
@@ -319,8 +324,10 @@ This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.
3. Now type `u`{normal} to undo the last command executed. 3. Now type `u`{normal} to undo the last command executed.
4. This time fix all the errors on the line using the `x`{normal} command. 4. This time fix all the errors on the line using the `x`{normal} command.
5. Now type a capital `U`{normal} to return the line to its original state. 5. Now type a capital `U`{normal} to return the line to its original state.
6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding commands. 6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding
7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's). commands.
7. Now type `<C-r>`{normal} (Control + R) a few times to redo the commands
(undo the undos).
Fiix the errors oon thhis line and reeplace them witth undo. Fiix the errors oon thhis line and reeplace them witth undo.
@@ -346,7 +353,7 @@ Fiix the errors oon thhis line and reeplace them witth undo.
7. To undo previous actions, type: `u`{normal} (lowercase u) 7. To undo previous actions, type: `u`{normal} (lowercase u)
To undo all the changes on a line, type: `U`{normal} (capital U) To undo all the changes on a line, type: `U`{normal} (capital U)
To undo the undo's, type: `<Ctrl-r>`{normal} To undo the undo's, type: `<C-r>`{normal}
# Lesson 3.1: THE PUT COMMAND # Lesson 3.1: THE PUT COMMAND
@@ -396,7 +403,8 @@ NOTE: Remember that you should be learning by doing, not memorization.
3. Type `ce`{normal} and the correct word (in this case, type "ine" ). 3. Type `ce`{normal} and the correct word (in this case, type "ine" ).
4. Press `<Esc>`{normal} and move to the next character that needs to be changed. 4. Press `<Esc>`{normal} and move to the next character that needs to be
changed.
5. Repeat steps 3 and 4 until the first sentence is the same as the second. 5. Repeat steps 3 and 4 until the first sentence is the same as the second.
@@ -435,9 +443,9 @@ NOTE: You can use the Backspace key to correct mistakes while typing.
2. To replace the character under the cursor, type [r](r) and then the 2. To replace the character under the cursor, type [r](r) and then the
character you want to have there. character you want to have there.
3. The [change operator](c) allows you to change from the cursor to where the 3. The [change operator](c) allows you to change from the cursor to where
motion takes you. Type `ce`{normal} to change from the cursor to the end of the motion takes you. Type `ce`{normal} to change from the cursor to the
the word, `c$`{normal} to change to the end of a line. end of the word, `c$`{normal} to change to the end of a line.
4. The format for change is: 4. The format for change is:
@@ -447,23 +455,23 @@ Now go on to the next lesson.
# Lesson 4.1: CURSOR LOCATION AND FILE STATUS # Lesson 4.1: CURSOR LOCATION AND FILE STATUS
** Type `<Ctrl-g>`{normal} to show your location in the file and the file status. ** Type `<C-g>`{normal} to show your location in a file and the file status.
Type `G`{normal} to move to a line in the file. ** Type `G`{normal} to move to a line in the file. **
NOTE: Read this entire lesson before executing any of the steps!! NOTE: Read this entire lesson before executing any of the steps!!
1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<Ctrl-g>`{normal}. 1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this
A message will appear at the bottom of the page with the filename and the `<C-g>`{normal}. A message will appear at the bottom of the page with the
position in the file. Remember the line number for Step 3. filename and the position in the file. Remember the line number for
Step 3.
NOTE: You may see the cursor position in the lower right corner of the screen
This happens when the ['ruler']('ruler') option is set (see `:help 'ruler'`{vim} ).
NOTE: You may see the cursor position in the lower right corner of the
screen. This happens when the ['ruler']('ruler') option is set.
2. Press [G](G) to move you to the bottom of the file. 2. Press [G](G) to move you to the bottom of the file.
Type [gg](gg) to move you to the start of the file. Type [gg](gg) to move you to the start of the file.
3. Type the number of the line you were on and then `G`{normal}. This will 3. Type the number of the line you were on and then `G`{normal}. This will
return you to the line you were on when you first pressed `<Ctrl-g>`{normal}. return you to the line you were on when you first pressed `<C-g>`{normal}.
4. If you feel confident to do this, execute steps 1 through 3. 4. If you feel confident to do this, execute steps 1 through 3.
@@ -471,18 +479,20 @@ NOTE: You may see the cursor position in the lower right corner of the screen
** Type `/`{normal} followed by a phrase to search for the phrase. ** ** Type `/`{normal} followed by a phrase to search for the phrase. **
1. In Normal mode type the `/`{normal} character. Notice that it and the cursor 1. In Normal mode type the `/`{normal} character. Notice that it and the
appear at the bottom of the screen as with the `:`{normal} command. cursor appear at the bottom of the screen as with the `:`{normal} command.
2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search for. 2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search
for.
3. To search for the same phrase again, simply type [n](n). 3. To search for the same phrase again, simply type [n](n).
To search for the same phrase in the opposite direction, type [N](N). To search for the same phrase in the opposite direction, type [N](N).
4. To search for a phrase in the backward direction, use [?](?) instead of `/`{normal}. 4. To search for a phrase in the backward direction, use [?](?) instead
of `/`{normal}.
5. To go back to where you came from press `<Ctrl-o>`{normal} (keep `<Ctrl>`{normal} pressed down while 5. To go back to where you came from press `<C-o>`{normal} (keep `<Ctrl>`{normal} pressed down while pressing the letter `o`{normal}). Repeat to go back
pressing the letter `o`{normal}). Repeat to go back further. `<Ctrl-i>`{normal} goes forward. 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.
@@ -525,8 +535,8 @@ NOTE: This is very useful in debugging a program with unmatched parentheses!
:s/thee/the/g :s/thee/the/g
~~~ ~~~
Adding the g [flag](:s_flags) means to substitute globally in the line, change Adding the g [flag](:s_flags) means to substitute globally in the line,
all occurrences of "thee" 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.
@@ -534,7 +544,8 @@ Usually thee best time to see thee flowers is in thee spring.
~~~ cmd ~~~ cmd
:#,#s/old/new/g :#,#s/old/new/g
~~~ ~~~
where #,# are the line numbers of the range of lines where the substitution is to be done. where #,# are the line numbers of the range of lines where the
substitution is to be done.
Type Type
~~~ cmd ~~~ cmd
@@ -546,22 +557,25 @@ Usually thee best time to see thee flowers is in thee spring.
~~~ cmd ~~~ cmd
:%s/old/new/gc :%s/old/new/gc
~~~ ~~~
to find every occurrence in the whole file, with a prompt whether to substitute or not. to find every occurrence in the whole file, with a prompt whether to
substitute or not.
# Lesson 4 SUMMARY # Lesson 4 SUMMARY
1. `<Ctrl-g>`{normal} displays your location in the file and the file status. 1. `<C-g>`{normal} displays your location and the file status.
`G`{normal} moves to the end of the file. `G`{normal} moves to the end of the file.
number `G`{normal} moves to that line number. number `G`{normal} moves to that line number.
`gg`{normal} moves to the first line. `gg`{normal} moves to the first line.
2. Typing `/`{normal} followed by a phrase searches FORWARD for the phrase. 2. Typing `/`{normal} followed by a phrase searches FORWARD for the phrase.
Typing `?`{normal} followed by a phrase searches BACKWARD for the phrase. Typing `?`{normal} followed by a phrase searches BACKWARD for the phrase.
After a search type `n`{normal} to find the next occurrence in the same direction After a search type `n`{normal} to find the next occurrence in the same
or `N`{normal} to search in the opposite direction. direction or `N`{normal} to search in the opposite direction.
`<Ctrl-o>`{normal} takes you back to older positions, `<Ctrl-i>`{normal} to newer positions. `<C-o>`{normal} takes you back to older positions, `<C-i>`{normal} to
newer positions.
3. Typing `%`{normal} while the cursor is on a (,),[,],{, or } goes to its match. 3. Typing `%`{normal} while the cursor is on a (,),[,],{, or } goes to its
match.
4. To substitute new for the first old in a line type 4. To substitute new for the first old in a line type
~~~ cmd ~~~ cmd
@@ -588,15 +602,15 @@ Usually thee best time to see thee flowers is in thee spring.
** Type `:!`{vim} followed by an external command to execute that command. ** ** Type `:!`{vim} followed by an external command to execute that command. **
1. Type the familiar command `:`{normal} to set the cursor at the bottom of the 1. Type the familiar command `:`{normal} to set the cursor at the bottom of
screen. This allows you to enter a command-line command. the screen. This allows you to enter a command-line command.
2. Now type the [!](!cmd) (exclamation point) character. This allows you to 2. Now type the [!](!cmd) (exclamation point) character. This allows you to
execute any external shell command. execute any external shell command.
3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This 3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}.
will show you a listing of your directory, just as if you were at the This will show you a listing of your directory, just as if you were
shell prompt. at the shell prompt.
NOTE: It is possible to execute any external command this way, also with NOTE: It is possible to execute any external command this way, also with
arguments. arguments.
@@ -655,13 +669,12 @@ NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file
before you press `<Enter>`{normal}. before you press `<Enter>`{normal}.
5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it. 5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it. Do not remove it yet! We will use it in the next lesson.
Do not remove it yet! We will use it in the next lesson.
NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move
the cursor around to make the selection bigger or smaller. Then you can the cursor around to make the selection bigger or smaller. Then you can
use an operator to do something with the text. For example, `d`{normal} deletes use an operator to do something with the text. For example, `d`{normal}
the text. deletes the text.
# Lesson 5.4: RETRIEVING AND MERGING FILES # Lesson 5.4: RETRIEVING AND MERGING FILES
@@ -714,8 +727,8 @@ NOTE: You can also read the output of an external command. For example,
1. Move the cursor to the line below marked --->. 1. Move the cursor to the line below marked --->.
2. Type the lowercase letter `o`{normal} to [open](o) up a line BELOW the cursor and place 2. Type the lowercase letter `o`{normal} to [open](o) up a line BELOW the
you in Insert mode. cursor and place you in Insert mode.
3. Now type some text and press `<Esc>`{normal} to exit Insert mode. 3. Now type some text and press `<Esc>`{normal} to exit Insert mode.
@@ -734,18 +747,20 @@ Open up a line above this by typing O while the cursor is on this line.
2. Press `e`{normal} until the cursor is on the end of "li". 2. Press `e`{normal} until the cursor is on the end of "li".
3. Type the lowercase letter `a`{normal} to [append](a) text AFTER the cursor. 3. Type the lowercase letter `a`{normal} to [append](a) text AFTER the
cursor.
4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert 4. Complete the word like the line below it. Press `<Esc>`{normal} to exit
mode. Insert mode.
5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4. 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 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.
NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only difference is where NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only
the characters are inserted. difference is where the characters are inserted.
# Lesson 6.3: ANOTHER WAY TO REPLACE # Lesson 6.3: ANOTHER WAY TO REPLACE
@@ -754,11 +769,11 @@ NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only differe
1. Move the cursor to the first line below marked --->. Move the cursor to 1. Move the cursor to the first line below marked --->. Move the cursor to
the beginning of the first "xxx". the beginning of the first "xxx".
2. Now press `R`{normal} ([capital R](R)) and type the number below it in the second line, so that it 2. Now press `R`{normal} ([capital R](R)) and type the number below it in the
replaces the "xxx". second line, so that it replaces the "xxx".
3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line 3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that
remains unmodified. the rest of the line remains unmodified.
4. Repeat the steps to replace the remaining "xxx". 4. Repeat the steps to replace the remaining "xxx".
@@ -774,7 +789,8 @@ NOTE: Replace mode is like Insert mode, but every typed character deletes an
1. Go to the line marked with ---> below and place the cursor after "a)". 1. Go to the line marked with ---> below and place the cursor after "a)".
2. Start Visual mode with `v`{normal} and move the cursor to just before "first". 2. Start Visual mode with `v`{normal} and move the cursor to just before
"first".
3. Type `y`{normal} to [yank](yank) (copy) the highlighted text. 3. Type `y`{normal} to [yank](yank) (copy) the highlighted text.
@@ -782,15 +798,16 @@ NOTE: Replace mode is like Insert mode, but every typed character deletes an
5. Type `p`{normal} to [put](put) (paste) the text. 5. Type `p`{normal} to [put](put) (paste) the text.
6. Press `a`{normal} and then type "second". Press `<Esc>`{normal} to leave Insert mode. 6. Press `a`{normal} and then type "second". Press `<Esc>`{normal} to leave
Insert mode.
7. Use Visual mode to select " item.", yank it with `y`{normal}, move to the end of 7. Use Visual mode to select "item.", yank it with `y`{normal}, move to the
the next line with `j$`{normal} and put the text there with `p`{normal}. end of the next line with `j$`{normal} and put the text there with `p`{normal}
a) This is the first item. a) This is the first item.
b) b)
NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word. NOTE: you can use `y`{normal} as an operator: `yw`{normal} yanks one word.
# Lesson 6.5: SET OPTION # Lesson 6.5: SET OPTION
@@ -837,9 +854,10 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
3. The `e`{normal} command moves to the end of a word. 3. The `e`{normal} command moves to the end of a word.
4. The `y`{normal} operator yanks (copies) text, `p`{normal} puts (pastes) it. 4. The `y`{normal} operator copies text, `p`{normal} pastes it.
5. Typing a capital `R`{normal} enters Replace mode until `<Esc>`{normal} is pressed. 5. Typing a capital `R`{normal} enters Replace mode until `<Esc>`{normal} is
pressed.
6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are: 6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are:
@@ -870,7 +888,7 @@ these three:
`:help`{vim} `:help`{vim}
Read the text in the help window to find out how the help works. Read the text in the help window to find out how the help works.
Type `<Ctrl-w><Ctrl-w>`{normal} to jump from one window to another. Type `<C-w><C-w>`{normal} to jump from one window to another.
Type `:q`{vim} to close the help window. Type `:q`{vim} to close the help window.
You can find help on just about any subject, by giving an argument to the You can find help on just about any subject, by giving an argument to the
@@ -903,13 +921,14 @@ default. To start using more features you have to create a "vimrc" file.
# Lesson 7.3: COMPLETION # Lesson 7.3: COMPLETION
** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal}. ** ** Command line completion with `<C-d>`{normal} and `<Tab>`{normal}. **
1. Look what files exist in the directory: `:!ls`{vim} 1. Look what files exist in the directory: `:!ls`{vim}
2. Type the start of a command: `:e`{vim} 2. Type the start of a command: `:e`{vim}
3. Press `<Ctrl-d>`{normal} and Vim will show a list of commands that start with "e". 3. Press `<C-d>`{normal} and Vim will show a list of commands that start
with "e".
4. Press `<Tab>`{normal} and Vim will complete the command name to ":edit". 4. Press `<Tab>`{normal} and Vim will complete the command name to ":edit".
@@ -917,7 +936,8 @@ default. To start using more features you have to create a "vimrc" file.
6. Press `<Tab>`{normal}. Vim will complete the name (if it is unique). 6. Press `<Tab>`{normal}. Vim will complete the name (if it is unique).
NOTE: Completion works for many commands. It is especially useful for `:help`{vim}. NOTE: Completion works for many commands. It is especially useful for
`:help`{vim}.
# Lesson 7 SUMMARY # Lesson 7 SUMMARY
@@ -926,13 +946,13 @@ NOTE: Completion works for many commands. It is especially useful for `:help`{vi
2. Type `:help TOPIC`{vim} to find help on TOPIC. 2. Type `:help TOPIC`{vim} to find help on TOPIC.
3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window 3. Type `<C-w><C-w>`{normal} to jump to another window
4. Type `:q`{vim} to close the help window 4. Type `:q`{vim} to close the help window
5. Create a vimrc startup script to keep your preferred settings. 5. Create a vimrc startup script to keep your preferred settings.
6. While in command mode, press `<Ctrl-d>`{normal} to see possible completions. 6. While in command mode, press `<C-d>`{normal} to see possible completions.
Press `<Tab>`{normal} to use one completion. Press `<Tab>`{normal} to use one completion.
# CONCLUSION # CONCLUSION
@@ -941,7 +961,8 @@ This was intended to give a brief overview of the Vim editor, just enough to
allow you to use the editor fairly easily. It is far from complete as Vim has allow you to use the editor fairly easily. It is far from complete as Vim has
many many more commands. Consult the help often. many many more commands. Consult the help often.
There are many resources online to learn more about vim. Here's a bunch of them: There are many resources online to learn more about vim. Here's a bunch of
them:
- *Learn Vim Progressively*: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ - *Learn Vim Progressively*: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
- *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/ - *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/
@@ -951,8 +972,8 @@ There are many resources online to learn more about vim. Here's a bunch of them:
- *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html - *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html
- *vim-galore*: https://github.com/mhinz/vim-galore - *vim-galore*: https://github.com/mhinz/vim-galore
If you prefer a book, *Practical Vim* by Drew Neil is recommended often (the sequel, *Modern If you prefer a book, *Practical Vim* by Drew Neil is recommended often
Vim*, includes material specific to nvim). (the sequel, *Modern Vim*, includes material specific to nvim).
This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
School of Mines using ideas supplied by Charles Smith, Colorado State School of Mines using ideas supplied by Charles Smith, Colorado State

View File

@@ -1,45 +1,43 @@
{ {
"expect": { "expect": {
"24": -1, "24": -1,
"102": "The cow jumped over the moon.", "103": "The cow jumped over the moon.",
"122": "There is some text missing from this line.", "124": "There is some text missing from this line.",
"123": "There is some text missing from this line.", "125": "There is some text missing from this line.",
"141": "There is some text missing from this line.", "144": "There is some text missing from this line.",
"142": "There is some text missing from this line.", "145": "There is some text missing from this line.",
"143": "There is also some text missing here.", "146": "There is also some text missing here.",
"144": "There is also some text missing here.", "147": "There is also some text missing here.",
"215": "There are some words that don't belong in this sentence.", "220": "There are some words that don't belong in this sentence.",
"231": "Somebody typed the end of this line twice.", "236": "Somebody typed the end of this line twice.",
"271": -1, "276": -1,
"290": "This line of words is cleaned up.", "295": "This line of words is cleaned up.",
"304": -1,
"305": -1,
"306": -1,
"307": -1,
"308": -1,
"309": -1, "309": -1,
"310": -1, "310": -1,
"325": "Fix the errors on this line and replace them with undo.", "311": -1,
"365": -1, "312": -1,
"366": -1, "313": -1,
"367": -1, "314": -1,
"368": -1, "315": -1,
"382": "When this line was typed in, someone pressed some wrong keys!", "332": "Fix the errors on this line and replace them with undo.",
"383": "When this line was typed in, someone pressed some wrong keys!", "372": -1,
"403": "This line has a few words that need changing using the change operator.", "373": -1,
"404": "This line has a few words that need changing using the change operator.", "374": -1,
"424": "The end of this line needs to be corrected using the c$ command.", "375": -1,
"425": "The end of this line needs to be corrected using the c$ command.", "389": "When this line was typed in, someone pressed some wrong keys!",
"487": -1, "390": "When this line was typed in, someone pressed some wrong keys!",
"506": -1, "411": "This line has a few words that need changing using the change operator.",
"531": "Usually the best time to see the flowers is in the spring.", "412": "This line has a few words that need changing using the change operator.",
"722": -1, "432": "The end of this line needs to be corrected using the c$ command.",
"727": -1, "433": "The end of this line needs to be corrected using the c$ command.",
"744": "This line will allow you to practice appending text to a line.", "497": -1,
"745": "This line will allow you to practice appending text to a line.", "516": -1,
"765": "Adding 123 to 456 gives you 579.", "541": "Usually the best time to see the flowers is in the spring.",
"766": "Adding 123 to 456 gives you 579.", "759": "This line will allow you to practice appending text to a line.",
"790": "a) This is the first item.", "760": "This line will allow you to practice appending text to a line.",
"791": " b) This is the second item." "780": "Adding 123 to 456 gives you 579.",
"781": "Adding 123 to 456 gives you 579.",
"807": "a) This is the first item.",
"808": " b) This is the second item."
} }
} }