mirror of
https://github.com/neovim/neovim.git
synced 2025-11-03 17:24:29 +00:00
tutor: readjust tutor for 80 char wide terminals
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
# Welcome to the VIM Tutor
|
||||
|
||||
Vim is a very powerful editor that has many commands, too many to explain in a
|
||||
tutor such as this. This tutor is designed to describe enough of the commands
|
||||
that you will be able to easily use Vim as an all-purpose editor. It is
|
||||
IMPORTANT to remember that this tutor is set up to teach by use. That means
|
||||
that you need to do the exercises to learn them properly. If you only read
|
||||
the text, you will soon forget what is most important!
|
||||
Vim is a very powerful editor that has many commands, too many to explain in
|
||||
a tutor such as this. This tutor is designed to describe enough of the
|
||||
commands that you will be able to easily use Vim as an all-purpose editor.
|
||||
It is IMPORTANT to remember that this tutor is set up to teach by use. That
|
||||
means that you need to do the exercises to learn them properly. If you only
|
||||
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}
|
||||
key enough times to move the cursor so that Lesson 0 completely fills the
|
||||
screen.
|
||||
For now, make sure that your Shift-Lock key is NOT depressed and press the
|
||||
`j`{normal} key enough times to move the cursor so that Lesson 0 completely
|
||||
fills the screen.
|
||||
|
||||
# Lesson 0
|
||||
|
||||
NOTE: The commands in the lessons will modify the text, but those changes won't
|
||||
be saved. Don't worry about messing things up; just remember that pressing
|
||||
[<Esc>](<Esc>) and then [u](u) will undo the latest change.
|
||||
NOTE: The commands in the lessons will modify the text, but those changes
|
||||
won't be saved. Don't worry about messing things up; just remember that
|
||||
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.
|
||||
Pressing [<Enter>](<Enter>) over text highlighted [like this](holy-grail) will take you to some
|
||||
relevant help (hopefully), and pressing K over any word will try to do so too.
|
||||
Sometimes you will be required to modify text like
|
||||
Pressing [<Enter>](<Enter>) over text highlighted [like this](holy-grail )
|
||||
will take you to some relevant help (hopefully), and pressing K over any
|
||||
word will try to do so too. Sometimes you will be required to modify text like
|
||||
this here
|
||||
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. ;)
|
||||
@@ -33,10 +33,10 @@ or press a sequence of keys
|
||||
<Esc>0f<Space>d3wP$P
|
||||
~~~
|
||||
|
||||
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text
|
||||
to type.
|
||||
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press
|
||||
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
|
||||
|
||||
@@ -63,9 +63,10 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
|
||||
|
||||
# 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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
3. Open vim and get back here by executing the command that got you into this
|
||||
tutor. That might be:
|
||||
3. Open vim and get back here by executing the command that got you into
|
||||
this tutor. That might be:
|
||||
|
||||
: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.
|
||||
|
||||
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
|
||||
|
||||
@@ -133,7 +135,8 @@ There is some text missing from this line.
|
||||
|
||||
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
|
||||
steps 2 and 3 to correct this sentence.
|
||||
@@ -158,8 +161,8 @@ There is also some text missing here.
|
||||
~~~ sh
|
||||
$ vim tutor
|
||||
~~~
|
||||
'vim' is the command to start the Vim editor, 'tutor' is the name of the
|
||||
file you wish to edit. Use a file that may be changed.
|
||||
'vim' is the command to start the Vim editor, 'tutor' is the name of
|
||||
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.
|
||||
|
||||
@@ -170,8 +173,8 @@ There is also some text missing here.
|
||||
|
||||
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
|
||||
the following summary.
|
||||
5. If you have quit vimtutor in step 1 restart the vimtutor and move down
|
||||
to the following summary.
|
||||
|
||||
6. After reading the above steps and understanding them: do it.
|
||||
|
||||
@@ -186,8 +189,10 @@ There is also some text missing here.
|
||||
$ vim FILENAME
|
||||
~~~
|
||||
|
||||
3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
|
||||
OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes.
|
||||
3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash
|
||||
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}
|
||||
|
||||
@@ -234,8 +239,8 @@ Somebody typed the end of this line twice. end of this line twice.
|
||||
|
||||
# Lesson 2.3: ON OPERATORS AND MOTIONS
|
||||
|
||||
|
||||
Many commands that change text are made from an [operator](operator) and a [motion](navigation).
|
||||
Many commands that change text are made from an [operator](operator) and
|
||||
a [motion](navigation).
|
||||
The format for a delete command with the [d](d) delete operator is as follows:
|
||||
|
||||
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.
|
||||
|
||||
NOTE: Pressing just the motion while in Normal mode without an operator will
|
||||
move the cursor as specified.
|
||||
NOTE: Pressing just the motion while in Normal mode without an operator
|
||||
will move the cursor as specified.
|
||||
|
||||
# Lesson 2.4: USING A COUNT FOR A MOTION
|
||||
|
||||
@@ -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.
|
||||
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.
|
||||
6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding commands.
|
||||
7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's).
|
||||
6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding
|
||||
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.
|
||||
|
||||
@@ -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)
|
||||
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
|
||||
|
||||
@@ -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" ).
|
||||
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
character you want to have there.
|
||||
|
||||
3. The [change operator](c) allows you to change from the cursor to where the
|
||||
motion takes you. Type `ce`{normal} to change from the cursor to the end of
|
||||
the word, `c$`{normal} to change to the end of a line.
|
||||
3. The [change operator](c) allows you to change from the cursor to where
|
||||
the motion takes you. Type `ce`{normal} to change from the cursor to the
|
||||
end of the word, `c$`{normal} to change to the end of a line.
|
||||
|
||||
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
|
||||
|
||||
** 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. **
|
||||
|
||||
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}.
|
||||
A message will appear at the bottom of the page with the 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} ).
|
||||
1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this
|
||||
`<C-g>`{normal}. A message will appear at the bottom of the page with the
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
@@ -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. **
|
||||
|
||||
1. In Normal mode type the `/`{normal} character. Notice that it and the cursor
|
||||
appear at the bottom of the screen as with the `:`{normal} command.
|
||||
1. In Normal mode type the `/`{normal} character. Notice that it and the
|
||||
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).
|
||||
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
|
||||
pressing the letter `o`{normal}). Repeat to go back further. `<Ctrl-i>`{normal} goes forward.
|
||||
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
|
||||
further. `<C-i>`{normal} goes forward.
|
||||
|
||||
"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
|
||||
~~~
|
||||
|
||||
Adding the g [flag](:s_flags) means to substitute globally in the line, change
|
||||
all occurrences of "thee" in the line.
|
||||
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.
|
||||
|
||||
@@ -534,7 +544,8 @@ Usually thee best time to see thee flowers is in thee spring.
|
||||
~~~ cmd
|
||||
:#,#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
|
||||
~~~ cmd
|
||||
@@ -546,22 +557,25 @@ Usually thee best time to see thee flowers is in thee spring.
|
||||
~~~ cmd
|
||||
:%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
|
||||
|
||||
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.
|
||||
number `G`{normal} moves to that line number.
|
||||
`gg`{normal} moves to the first line.
|
||||
|
||||
2. Typing `/`{normal} followed by a phrase searches FORWARD 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
|
||||
or `N`{normal} to search in the opposite direction.
|
||||
`<Ctrl-o>`{normal} takes you back to older positions, `<Ctrl-i>`{normal} to newer positions.
|
||||
After a search type `n`{normal} to find the next occurrence in the same
|
||||
direction or `N`{normal} to search in the opposite direction.
|
||||
`<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
|
||||
~~~ 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. **
|
||||
|
||||
1. Type the familiar command `:`{normal} to set the cursor at the bottom of the
|
||||
screen. This allows you to enter a command-line command.
|
||||
1. Type the familiar command `:`{normal} to set the cursor at the bottom of
|
||||
the screen. This allows you to enter a command-line command.
|
||||
|
||||
2. Now type the [!](!cmd) (exclamation point) character. This allows you to
|
||||
execute any external shell command.
|
||||
|
||||
3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This
|
||||
will show you a listing of your directory, just as if you were at the
|
||||
shell prompt.
|
||||
3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}.
|
||||
This will show you a listing of your directory, just as if you were
|
||||
at the shell prompt.
|
||||
|
||||
NOTE: It is possible to execute any external command this way, also with
|
||||
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}.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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
|
||||
use an operator to do something with the text. For example, `d`{normal} deletes
|
||||
the text.
|
||||
use an operator to do something with the text. For example, `d`{normal}
|
||||
deletes the text.
|
||||
|
||||
# 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 --->.
|
||||
|
||||
2. Type the lowercase letter `o`{normal} to [open](o) up a line BELOW the cursor and place
|
||||
you in Insert mode.
|
||||
2. Type the lowercase letter `o`{normal} to [open](o) up a line BELOW the
|
||||
cursor and place you in 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".
|
||||
|
||||
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
|
||||
mode.
|
||||
4. Complete the word like the line below it. Press `<Esc>`{normal} to exit
|
||||
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 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.
|
||||
NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only
|
||||
difference is where the characters are inserted.
|
||||
|
||||
# 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
|
||||
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
|
||||
replaces the "xxx".
|
||||
2. Now press `R`{normal} ([capital R](R)) and type the number below it in the
|
||||
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
|
||||
remains unmodified.
|
||||
3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that
|
||||
the rest of the line remains unmodified.
|
||||
|
||||
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)".
|
||||
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
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
|
||||
the next line with `j$`{normal} and put the text there with `p`{normal}.
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
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:
|
||||
|
||||
@@ -870,7 +888,7 @@ these three:
|
||||
`:help`{vim}
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
** 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}
|
||||
|
||||
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".
|
||||
|
||||
@@ -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).
|
||||
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
# 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
|
||||
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/
|
||||
- *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
|
||||
- *vim-galore*: https://github.com/mhinz/vim-galore
|
||||
|
||||
If you prefer a book, *Practical Vim* by Drew Neil is recommended often (the sequel, *Modern
|
||||
Vim*, includes material specific to nvim).
|
||||
If you prefer a book, *Practical Vim* by Drew Neil is recommended often
|
||||
(the sequel, *Modern Vim*, includes material specific to nvim).
|
||||
|
||||
This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado
|
||||
School of Mines using ideas supplied by Charles Smith, Colorado State
|
||||
|
||||
@@ -1,45 +1,43 @@
|
||||
{
|
||||
"expect": {
|
||||
"24": -1,
|
||||
"102": "The cow jumped over the moon.",
|
||||
"122": "There is some text missing from this line.",
|
||||
"123": "There is some text missing from this line.",
|
||||
"141": "There is some text missing from this line.",
|
||||
"142": "There is some text missing from this line.",
|
||||
"143": "There is also some text missing here.",
|
||||
"144": "There is also some text missing here.",
|
||||
"215": "There are some words that don't belong in this sentence.",
|
||||
"231": "Somebody typed the end of this line twice.",
|
||||
"271": -1,
|
||||
"290": "This line of words is cleaned up.",
|
||||
"304": -1,
|
||||
"305": -1,
|
||||
"306": -1,
|
||||
"307": -1,
|
||||
"308": -1,
|
||||
"103": "The cow jumped over the moon.",
|
||||
"124": "There is some text missing from this line.",
|
||||
"125": "There is some text missing from this line.",
|
||||
"144": "There is some text missing from this line.",
|
||||
"145": "There is some text missing from this line.",
|
||||
"146": "There is also some text missing here.",
|
||||
"147": "There is also some text missing here.",
|
||||
"220": "There are some words that don't belong in this sentence.",
|
||||
"236": "Somebody typed the end of this line twice.",
|
||||
"276": -1,
|
||||
"295": "This line of words is cleaned up.",
|
||||
"309": -1,
|
||||
"310": -1,
|
||||
"325": "Fix the errors on this line and replace them with undo.",
|
||||
"365": -1,
|
||||
"366": -1,
|
||||
"367": -1,
|
||||
"368": -1,
|
||||
"382": "When this line was typed in, someone pressed some wrong keys!",
|
||||
"383": "When this line was typed in, someone pressed some wrong keys!",
|
||||
"403": "This line has a few words that need changing using the change operator.",
|
||||
"404": "This line has a few words that need changing using the change operator.",
|
||||
"424": "The end of this line needs to be corrected using the c$ command.",
|
||||
"425": "The end of this line needs to be corrected using the c$ command.",
|
||||
"487": -1,
|
||||
"506": -1,
|
||||
"531": "Usually the best time to see the flowers is in the spring.",
|
||||
"722": -1,
|
||||
"727": -1,
|
||||
"744": "This line will allow you to practice appending text to a line.",
|
||||
"745": "This line will allow you to practice appending text to a line.",
|
||||
"765": "Adding 123 to 456 gives you 579.",
|
||||
"766": "Adding 123 to 456 gives you 579.",
|
||||
"790": "a) This is the first item.",
|
||||
"791": " b) This is the second item."
|
||||
"311": -1,
|
||||
"312": -1,
|
||||
"313": -1,
|
||||
"314": -1,
|
||||
"315": -1,
|
||||
"332": "Fix the errors on this line and replace them with undo.",
|
||||
"372": -1,
|
||||
"373": -1,
|
||||
"374": -1,
|
||||
"375": -1,
|
||||
"389": "When this line was typed in, someone pressed some wrong keys!",
|
||||
"390": "When this line was typed in, someone pressed some wrong keys!",
|
||||
"411": "This line has a few words that need changing using the change operator.",
|
||||
"412": "This line has a few words that need changing using the change operator.",
|
||||
"432": "The end of this line needs to be corrected using the c$ command.",
|
||||
"433": "The end of this line needs to be corrected using the c$ command.",
|
||||
"497": -1,
|
||||
"516": -1,
|
||||
"541": "Usually the best time to see the flowers is in the spring.",
|
||||
"759": "This line will allow you to practice appending text to a line.",
|
||||
"760": "This line will allow you to practice appending text to a line.",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user