mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
docs(tutor): modify for Neovim rather than Vim (#17092)
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
# Welcome to the VIM Tutor
|
# Welcome to the Neovim Tutorial
|
||||||
|
|
||||||
Vim is a very powerful editor that has many commands, too many to explain in
|
Neovim 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
|
a tutorial such as this. This tutorial is designed to describe enough of the
|
||||||
commands that you will be able to easily use Vim as an all-purpose editor.
|
commands that you will be able to easily use Neovim as an all-purpose editor.
|
||||||
It is IMPORTANT to remember that this tutor is set up to teach by use. That
|
It is IMPORTANT to remember that this tutorial is set up to teach by use. That
|
||||||
means that you need to do the exercises to learn them properly. If you only
|
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!
|
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
|
For now, make sure that your Caps-Lock is off and press the `j`{normal} key enough
|
||||||
`j`{normal} key enough times to move the cursor so that Lesson 0 completely
|
times to move the cursor so that Lesson 0 completely fills the screen.
|
||||||
fills the screen.
|
|
||||||
|
|
||||||
# Lesson 0
|
# Lesson 0
|
||||||
|
|
||||||
@@ -20,12 +19,13 @@ 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.
|
||||||
- Type [<Enter>](<Enter>) on links [like this](holy-grail ) to open the linked help section.
|
- Type [<Enter>](<Enter>) on links [like this](holy-grail ) to open the linked help section.
|
||||||
- Or simply type [K](K) on any word to find its documentation!
|
- Or simply type [K](K) on any word to find its documentation!
|
||||||
|
- You can close this help window with `:q`{vim}
|
||||||
- Sometimes you will be required to modify text like
|
- 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 Neovim can be.
|
||||||
Other times, you'll be prompted to run a command (I'll explain this later):
|
Other times, you'll be prompted to run a command (I'll explain this later):
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:help <Enter>
|
:help <Enter>
|
||||||
@@ -43,9 +43,9 @@ Now, move to the next lesson (use the `j`{normal} key to scroll down).
|
|||||||
|
|
||||||
** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. **
|
** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. **
|
||||||
|
|
||||||
↑
|
↑
|
||||||
k Hint: The `h`{normal} key is at the left and moves left.
|
k Hint: The `h`{normal} key is at the left and moves left.
|
||||||
← h l → The `l`{normal} key is at the right and moves right.
|
← h l → The `l`{normal} key is at the right and moves right.
|
||||||
j The `j`{normal} key looks like a down arrow.
|
j The `j`{normal} key looks like a down arrow.
|
||||||
↓
|
↓
|
||||||
|
|
||||||
@@ -60,11 +60,11 @@ NOTE: If you are ever unsure about something you typed, press <Esc> to place
|
|||||||
you in Normal mode. Then retype the command you wanted.
|
you in Normal mode. Then retype the command you wanted.
|
||||||
|
|
||||||
NOTE: The cursor keys should also work. But using hjkl you will be able to
|
NOTE: The cursor keys should also work. But using hjkl you will be able to
|
||||||
move around much faster, once you get used to it. Really!
|
move around much faster, once you get used to it.
|
||||||
|
|
||||||
# Lesson 1.2: EXITING VIM
|
# Lesson 1.2: EXITING NEOVIM
|
||||||
|
|
||||||
!! NOTE: Before executing any of the steps below, read this entire lesson !!
|
!! NOTE: Before executing any of the steps below, read the entire lesson !!
|
||||||
|
|
||||||
1. Press the <Esc> key (to make sure you are in Normal mode).
|
1. Press the <Esc> key (to make sure you are in Normal mode).
|
||||||
|
|
||||||
@@ -72,10 +72,10 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to
|
|||||||
|
|
||||||
`:q!`{vim} `<Enter>`{normal}.
|
`:q!`{vim} `<Enter>`{normal}.
|
||||||
|
|
||||||
This exits the editor, DISCARDING any changes you have made.
|
This quits the editor, DISCARDING any changes you have made.
|
||||||
|
|
||||||
3. Open vim and get back here by executing the command that got you into
|
3. Open Neovim and get back here by executing the command that got you into
|
||||||
this tutor. That might be:
|
this tutorial. That might be:
|
||||||
|
|
||||||
:Tutor <Enter>
|
:Tutor <Enter>
|
||||||
|
|
||||||
@@ -104,9 +104,9 @@ 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 everything,
|
NOTE: As you go through this tutorial, do not try to memorize everything,
|
||||||
your Vim vocabulary will expand with usage. Consider returning to
|
your Neovim vocabulary will expand with usage. Consider returning to
|
||||||
this tutor periodically for a refresher.
|
this tutorial periodically for a refresher.
|
||||||
|
|
||||||
# Lesson 1.4: TEXT EDITING: INSERTION
|
# Lesson 1.4: TEXT EDITING: INSERTION
|
||||||
|
|
||||||
@@ -151,11 +151,11 @@ There is also some text missing here.
|
|||||||
|
|
||||||
# Lesson 1.6: EDITING A FILE
|
# Lesson 1.6: EDITING A FILE
|
||||||
|
|
||||||
** Use `:wq`{vim} to save a file and exit. **
|
** Use `:wq`{vim} to write a file and quit. **
|
||||||
|
|
||||||
!! NOTE: Before executing any of the steps below, read this entire lesson !!
|
!! NOTE: Before executing any of the steps below, read the entire lesson !!
|
||||||
|
|
||||||
1. Exit this tutor as you did in Lesson 1.2: `:q!`{vim}
|
1. Exit this tutorial as you did in Lesson 1.2: `:q!`{vim}
|
||||||
Or, if you have access to another terminal, do the following there.
|
Or, if you have access to another terminal, do the following there.
|
||||||
|
|
||||||
2. At the shell prompt type this command:
|
2. At the shell prompt type this command:
|
||||||
@@ -167,28 +167,28 @@ There is also some text missing here.
|
|||||||
|
|
||||||
3. Insert and delete text as you learned in the previous lessons.
|
3. Insert and delete text as you learned in the previous lessons.
|
||||||
|
|
||||||
4. Save the file with changes and exit Vim with:
|
4. Save the file with changes and exit Neovim with:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:wq
|
:wq
|
||||||
~~~
|
~~~
|
||||||
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
|
5. If you have quit this tutorial in step 1, restart and move down
|
||||||
to the following summary.
|
to the following summary.
|
||||||
|
|
||||||
6. After reading the above steps and understanding them: do it.
|
6. After reading and understanding the above steps: do them.
|
||||||
|
|
||||||
# Lesson 1 SUMMARY
|
# Lesson 1 SUMMARY
|
||||||
|
|
||||||
1. The cursor is moved using either the arrow keys or the hjkl keys.
|
1. The cursor is moved using either the arrow keys or the hjkl keys.
|
||||||
h (left) j (down) k (up) l (right)
|
h (left) j (down) k (up) l (right)
|
||||||
|
|
||||||
2. To start Vim from the shell prompt type:
|
2. To start Neovim from the shell prompt type:
|
||||||
~~~ sh
|
~~~ sh
|
||||||
$ nvim FILENAME
|
$ nvim FILENAME
|
||||||
~~~
|
~~~
|
||||||
3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
|
3. To exit Neovim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes.
|
||||||
OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the 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}
|
||||||
|
|
||||||
@@ -297,8 +297,11 @@ 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.
|
||||||
|
|
||||||
3. Now move to the fourth line.
|
3. Now move to the fourth line.
|
||||||
|
|
||||||
4. Type `2dd`{normal} to delete two lines.
|
4. Type `2dd`{normal} to delete two lines.
|
||||||
|
|
||||||
1) Roses are red,
|
1) Roses are red,
|
||||||
@@ -314,11 +317,17 @@ it would be easier to simply type two d's to delete a line.
|
|||||||
** Press `u`{normal} to undo the last commands, `U`{normal} to fix a whole line. **
|
** Press `u`{normal} to undo the last commands, `U`{normal} to fix a whole line. **
|
||||||
|
|
||||||
1. Move the cursor to the line below marked ✗ and place it on the first error.
|
1. Move the cursor to the line below marked ✗ and place it on the first error.
|
||||||
|
|
||||||
2. Type `x`{normal} to delete the first unwanted character.
|
2. Type `x`{normal} to delete the first unwanted character.
|
||||||
|
|
||||||
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 commands.
|
||||||
|
|
||||||
7. Now type `<C-r>`{normal} (Control + R) a few times to redo the commands.
|
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.
|
||||||
@@ -328,8 +337,11 @@ Fiix the errors oon thhis line and reeplace them witth undo.
|
|||||||
# Lesson 2 SUMMARY
|
# Lesson 2 SUMMARY
|
||||||
|
|
||||||
1. To delete from the cursor up to the next word type: `dw`{normal}
|
1. To delete from the cursor up to the next word type: `dw`{normal}
|
||||||
|
|
||||||
2. To delete from the cursor to the end of a line type: `d$`{normal}
|
2. To delete from the cursor to the end of a line type: `d$`{normal}
|
||||||
|
|
||||||
3. To delete a whole line type: `dd`{normal}
|
3. To delete a whole line type: `dd`{normal}
|
||||||
|
|
||||||
4. To repeat a motion prepend it with a number: `2w`{normal}
|
4. To repeat a motion prepend it with a number: `2w`{normal}
|
||||||
|
|
||||||
5. The format for a change command is:
|
5. The format for a change command is:
|
||||||
@@ -356,7 +368,7 @@ Fiix the errors oon thhis line and reeplace them witth undo.
|
|||||||
|
|
||||||
1. Move the cursor to the first ✓ line below.
|
1. Move the cursor to the first ✓ line below.
|
||||||
|
|
||||||
2. Type `dd`{normal} to delete the line and store it in a Vim register.
|
2. Type `dd`{normal} to delete the line and store it in a Neovim register.
|
||||||
|
|
||||||
3. Move the cursor to the c) line, ABOVE where the deleted line should go.
|
3. Move the cursor to the c) line, ABOVE where the deleted line should go.
|
||||||
|
|
||||||
@@ -369,6 +381,8 @@ b) Violets are blue,
|
|||||||
c) Intelligence is learned,
|
c) Intelligence is learned,
|
||||||
a) Roses are red,
|
a) Roses are red,
|
||||||
|
|
||||||
|
NOTE: You can also put the text before the cursor with `P`{normal} (capital P)
|
||||||
|
|
||||||
# Lesson 3.2: THE REPLACE COMMAND
|
# Lesson 3.2: THE REPLACE COMMAND
|
||||||
|
|
||||||
** Type `rx`{normal} to replace the character at the cursor with x. **
|
** Type `rx`{normal} to replace the character at the cursor with x. **
|
||||||
@@ -386,7 +400,7 @@ When this line was typed in, someone pressed some wrong keys!
|
|||||||
|
|
||||||
5. Now move on to Lesson 3.3.
|
5. Now move on to Lesson 3.3.
|
||||||
|
|
||||||
NOTE: Remember that you should be learning by doing, not memorization.
|
NOTE: Remember that you should be learning by doing, not memorizing.
|
||||||
|
|
||||||
# Lesson 3.3: THE CHANGE OPERATOR
|
# Lesson 3.3: THE CHANGE OPERATOR
|
||||||
|
|
||||||
@@ -439,7 +453,7 @@ NOTE: You can use the Backspace key to correct mistakes while typing.
|
|||||||
|
|
||||||
3. The [change operator](c) allows you to change from the cursor to where
|
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
|
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.
|
end of the word, `c$`{normal} to change to the end of a line, etc.
|
||||||
|
|
||||||
4. The format for change is:
|
4. The format for change is:
|
||||||
|
|
||||||
@@ -452,7 +466,7 @@ Now go on to the next lesson.
|
|||||||
** Type `<C-g>`{normal} to show your location in a 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 the entire lesson before executing any of these steps!!
|
||||||
|
|
||||||
1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<C-g>`{normal}.
|
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
|
A message will appear at the bottom of the page with the filename and
|
||||||
@@ -535,8 +549,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
|
where # are the line numbers of the range of lines where the
|
||||||
substitution is to be done.
|
substitution is to be done (i.e., `1,3` means from line 1 to line 3, inclusive).
|
||||||
|
|
||||||
Type
|
Type
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
@@ -551,6 +565,9 @@ Usually thee best time to see thee flowers is in thee spring.
|
|||||||
to find every occurrence in the whole file, with a prompt whether to
|
to find every occurrence in the whole file, with a prompt whether to
|
||||||
substitute or not.
|
substitute or not.
|
||||||
|
|
||||||
|
NOTE: You can also select the lines you want to substitute first using visual-mode.
|
||||||
|
This will be explained more in a future lesson.
|
||||||
|
|
||||||
# Lesson 4 SUMMARY
|
# Lesson 4 SUMMARY
|
||||||
|
|
||||||
1. `<C-g>`{normal} displays your location and the file status.
|
1. `<C-g>`{normal} displays your location and the file status.
|
||||||
@@ -603,11 +620,10 @@ Usually thee best time to see thee flowers is in thee spring.
|
|||||||
This will show you a listing of your directory, just as if you were
|
This will show you a listing of your directory, just as if you were
|
||||||
at the 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, and you
|
||||||
arguments.
|
can include arguments.
|
||||||
|
|
||||||
NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}.
|
NOTE: All `:`{vim} commands are executed when you press `<Enter>`{normal}.
|
||||||
From here on we will not always mention it.
|
|
||||||
|
|
||||||
# Lesson 5.2: MORE ON WRITING FILES
|
# Lesson 5.2: MORE ON WRITING FILES
|
||||||
|
|
||||||
@@ -624,11 +640,11 @@ NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}.
|
|||||||
~~~
|
~~~
|
||||||
(where TEST is the filename you chose.)
|
(where TEST is the filename you chose.)
|
||||||
|
|
||||||
4. This saves the whole file (the Vim Tutor) under the name TEST.
|
4. This saves the current file under the name TEST.
|
||||||
To verify this, type `:!ls`{vim} again to see your directory.
|
To verify this, type `:!ls`{vim} again to see your directory.
|
||||||
|
|
||||||
NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file
|
NOTE: If you were to exit Neovim and start it again with `nvim TEST`, the file
|
||||||
would be an exact copy of the tutor when you saved it.
|
would be an exact copy of the tutorial when you saved it.
|
||||||
|
|
||||||
5. Now remove the file by typing:
|
5. Now remove the file by typing:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
@@ -659,7 +675,7 @@ 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. Neovim 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 the cursor around to
|
NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move the cursor around to
|
||||||
@@ -668,7 +684,7 @@ NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move the c
|
|||||||
|
|
||||||
# Lesson 5.4: RETRIEVING AND MERGING FILES
|
# Lesson 5.4: RETRIEVING AND MERGING FILES
|
||||||
|
|
||||||
** To insert the contents of a file, type `:r FILENAME`{vim}. **
|
** To retrieve the contents of a file, type `:r FILENAME`{vim}. **
|
||||||
|
|
||||||
1. Place the cursor just above this line.
|
1. Place the cursor just above this line.
|
||||||
|
|
||||||
@@ -683,7 +699,7 @@ NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move
|
|||||||
The file you retrieve is placed below the cursor line.
|
The file you retrieve is placed below the cursor line.
|
||||||
|
|
||||||
3. To verify that a file was retrieved, cursor back and notice that there
|
3. To verify that a file was retrieved, cursor back and notice that there
|
||||||
are now two copies of Lesson 5.3, the original and the file version.
|
are now two copies of Lesson 5.3, the original and the retrieved version.
|
||||||
|
|
||||||
NOTE: You can also read the output of an external command. For example,
|
NOTE: You can also read the output of an external command. For example,
|
||||||
|
|
||||||
@@ -699,7 +715,7 @@ NOTE: You can also read the output of an external command. For example,
|
|||||||
`:!ls`{vim} - shows a directory listing
|
`:!ls`{vim} - shows a directory listing
|
||||||
`:!rm FILENAME`{vim} - removes file FILENAME
|
`:!rm FILENAME`{vim} - removes file FILENAME
|
||||||
|
|
||||||
2. [:w](:w) FILENAME writes the current Vim file to disk with
|
2. [:w](:w) FILENAME writes the current Neovim file to disk with
|
||||||
name FILENAME.
|
name FILENAME.
|
||||||
|
|
||||||
3. [v](v) motion :w FILENAME saves the Visually selected lines in file
|
3. [v](v) motion :w FILENAME saves the Visually selected lines in file
|
||||||
@@ -768,11 +784,11 @@ Adding 123 to xxx gives you xxx.
|
|||||||
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
|
NOTE: Replace mode is like Insert mode, but every typed character
|
||||||
deletes an existing character.
|
replaces an existing character.
|
||||||
|
|
||||||
# Lesson 6.4: COPY AND PASTE TEXT
|
# Lesson 6.4: COPY AND PASTE TEXT
|
||||||
|
|
||||||
** Use the `y`{normal} operator to copy text and `p`{normal} to paste it. **
|
** Use the `y`{normal} operator to copy text and `p`{normal} to put it. **
|
||||||
|
|
||||||
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)".
|
||||||
|
|
||||||
@@ -796,9 +812,13 @@ b)
|
|||||||
|
|
||||||
NOTE: you can 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.
|
||||||
|
|
||||||
|
NOTE: you can use `P`{normal} to put before the cursor, rather than after.
|
||||||
|
|
||||||
# Lesson 6.5: SET OPTION
|
# Lesson 6.5: SET OPTION
|
||||||
|
|
||||||
** Set an option so a search or substitute ignores case. **
|
** Set an option so search and substitute commands ignore case. **
|
||||||
|
|
||||||
|
There are many settings in Neovim that you can configure to suit your needs.
|
||||||
|
|
||||||
1. Search for 'ignore' by entering: `/ignore`
|
1. Search for 'ignore' by entering: `/ignore`
|
||||||
Repeat several times by pressing `n`{normal}.
|
Repeat several times by pressing `n`{normal}.
|
||||||
@@ -820,7 +840,7 @@ NOTE: you can use `y`{normal} as an operator: `yw`{normal} yanks one word.
|
|||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set noic
|
:set noic
|
||||||
~~~
|
~~~
|
||||||
7. To toggle the value of a setting, prepend it with "inv":
|
7. To invert the value of a setting, prepend it with "inv":
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set invic
|
:set invic
|
||||||
~~~
|
~~~
|
||||||
@@ -858,19 +878,18 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
|
|||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set noic
|
:set noic
|
||||||
~~~
|
~~~
|
||||||
8. Prepend "inv" to toggle an option:
|
8. Prepend "inv" to invert an option:
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:set invic
|
:set invic
|
||||||
~~~
|
~~~
|
||||||
# Lesson 7.1: GETTING HELP
|
# Lesson 7.1: GETTING HELP
|
||||||
|
|
||||||
** Use the on-line help system. **
|
** Use the online help system. **
|
||||||
|
|
||||||
Vim has a comprehensive on-line help system.
|
Neovim has a comprehensive online help system.
|
||||||
|
|
||||||
To get started, try one of these three:
|
To get started, try one of these three:
|
||||||
|
|
||||||
- press the `<HELP>`{normal} key (if you have one)
|
|
||||||
- press the `<F1>`{normal} key (if you have one)
|
- press the `<F1>`{normal} key (if you have one)
|
||||||
- type `:help`{vim}
|
- type `:help`{vim}
|
||||||
|
|
||||||
@@ -879,7 +898,7 @@ 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
|
||||||
":help" command. Try these (don't forget pressing <Enter>):
|
":help" command. Try these (don't forget to press <Enter>):
|
||||||
~~~ cmd
|
~~~ cmd
|
||||||
:help w
|
:help w
|
||||||
:help c_CTRL-D
|
:help c_CTRL-D
|
||||||
@@ -888,12 +907,12 @@ You can find help on just about any subject, by giving an argument to the
|
|||||||
~~~
|
~~~
|
||||||
# Lesson 7.2: CREATE A STARTUP SCRIPT
|
# Lesson 7.2: CREATE A STARTUP SCRIPT
|
||||||
|
|
||||||
** Enable Vim features. **
|
** Enable Neovim features. **
|
||||||
|
|
||||||
Vim has many more features than Vi, but most of them are disabled by
|
Neovim is a very configurable editor. You can customise it any way you like.
|
||||||
default. To start using more features you have to create a "vimrc" file.
|
To start using more features create an "init.vim" file.
|
||||||
|
|
||||||
1. Start editing the "vimrc" file.
|
1. Start editing the "init.vim" file.
|
||||||
|
|
||||||
`:call mkdir(stdpath('config'),'p')`{vim}
|
`:call mkdir(stdpath('config'),'p')`{vim}
|
||||||
`:exe 'edit' stdpath('config').'/init.vim'`{vim}
|
`:exe 'edit' stdpath('config').'/init.vim'`{vim}
|
||||||
@@ -902,24 +921,24 @@ default. To start using more features you have to create a "vimrc" file.
|
|||||||
|
|
||||||
`:w`{vim}
|
`:w`{vim}
|
||||||
|
|
||||||
You can add all your preferred settings to this "vimrc" file.
|
You can add all your preferred settings to this "init.vim" file.
|
||||||
For more information type `:help vimrc-intro`{vim}.
|
For more information type `:help init.vim`{vim}.
|
||||||
|
|
||||||
# Lesson 7.3: COMPLETION
|
# Lesson 7.3: COMPLETION
|
||||||
|
|
||||||
** Command line completion with `<C-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. List the contents of the current directory: `:!ls`{vim}
|
||||||
|
|
||||||
2. Type the start of a command: `:e`{vim}
|
2. Type the start of a command: `:e`{vim}
|
||||||
|
|
||||||
3. Press `<C-d>`{normal} and Vim will show a list of commands beginning with "e".
|
3. Press `<C-d>`{normal} and Neovim will show a list of commands beginning with "e".
|
||||||
|
|
||||||
4. Press `<Tab>`{normal} and Vim will complete the command name to ":edit".
|
4. Press `<Tab>`{normal} and Neovim will complete the command name to ":edit".
|
||||||
|
|
||||||
5. Now add a space and the start of an existing file name: `:edit FIL`{vim}
|
5. Now add a space and the start of an existing file name: `:edit FIL`{vim}
|
||||||
|
|
||||||
6. Press `<Tab>`{normal}. Vim will complete the name ("FIL" -> "FILE", if it is unique).
|
6. Press `<Tab>`{normal}. Neovim will complete the name ("FIL" -> "FILE", 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}.
|
||||||
|
|
||||||
@@ -934,19 +953,18 @@ NOTE: Completion works for many commands. It is especially useful for `:help`{vi
|
|||||||
|
|
||||||
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 an init.vim startup script to keep your preferred settings.
|
||||||
|
|
||||||
6. While in command mode, press `<C-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
|
||||||
|
|
||||||
This was intended to give a brief overview of the Vim editor, just enough to
|
This was intended to give a brief overview of the Neovim editor, just enough to
|
||||||
allow you to use the editor fairly easily. It is far from complete as Vim has
|
allow you to use it fairly easily. It is far from complete as Neovim has
|
||||||
many many more commands. Consult the help often.
|
many many more commands. Consult the help often.
|
||||||
|
There are also countless great tutorials and videos to be found online.
|
||||||
There are many resources online to learn more about vim. Here's a bunch of
|
Here's a bunch of them:
|
||||||
them:
|
|
||||||
|
|
||||||
- *Learn Vim Progressively*:
|
- *Learn Vim Progressively*:
|
||||||
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
|
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
|
||||||
@@ -964,7 +982,7 @@ them:
|
|||||||
https://github.com/mhinz/vim-galore
|
https://github.com/mhinz/vim-galore
|
||||||
|
|
||||||
If you prefer a book, *Practical Vim* by Drew Neil is recommended often
|
If you prefer a book, *Practical Vim* by Drew Neil is recommended often
|
||||||
(the sequel, *Modern Vim*, includes material specific to nvim).
|
(the sequel, *Modern Vim*, includes material specific to Neovim).
|
||||||
|
|
||||||
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
|
||||||
@@ -972,5 +990,6 @@ University. E-mail: bware@mines.colorado.edu.
|
|||||||
|
|
||||||
Modified for Vim by Bram Moolenaar.
|
Modified for Vim by Bram Moolenaar.
|
||||||
Modified for vim-tutor-mode by Felipe Morales.
|
Modified for vim-tutor-mode by Felipe Morales.
|
||||||
|
Modified for Neovim by Rory Nesbitt.
|
||||||
|
|
||||||
// vim: nowrap
|
// vim: nowrap
|
||||||
|
@@ -12,34 +12,34 @@
|
|||||||
"232": "Somebody typed the end of this line twice.",
|
"232": "Somebody typed the end of this line twice.",
|
||||||
"271": -1,
|
"271": -1,
|
||||||
"290": "This line of words is cleaned up.",
|
"290": "This line of words is cleaned up.",
|
||||||
"304": -1,
|
|
||||||
"305": -1,
|
|
||||||
"306": -1,
|
|
||||||
"307": -1,
|
"307": -1,
|
||||||
"308": -1,
|
"308": -1,
|
||||||
"309": -1,
|
"309": -1,
|
||||||
"310": -1,
|
"310": -1,
|
||||||
"324": "Fix the errors on this line and replace them with undo.",
|
"311": -1,
|
||||||
"367": -1,
|
"312": -1,
|
||||||
"368": -1,
|
"313": -1,
|
||||||
"369": -1,
|
"333": "Fix the errors on this line and replace them with undo.",
|
||||||
"370": -1,
|
"379": -1,
|
||||||
"384": "When this line was typed in, someone pressed some wrong keys!",
|
"380": -1,
|
||||||
"385": "When this line was typed in, someone pressed some wrong keys!",
|
"381": -1,
|
||||||
"405": "This line has a few words that need changing using the change operator.",
|
"382": -1,
|
||||||
"406": "This line has a few words that need changing using the change operator.",
|
"398": "When this line was typed in, someone pressed some wrong keys!",
|
||||||
"426": "The end of this line needs to be corrected using the `c$` command.",
|
"399": "When this line was typed in, someone pressed some wrong keys!",
|
||||||
"427": "The end of this line needs to be corrected using the `c$` command.",
|
"419": "This line has a few words that need changing using the change operator.",
|
||||||
"490": -1,
|
"420": "This line has a few words that need changing using the change operator.",
|
||||||
"509": -1,
|
"440": "The end of this line needs to be corrected using the `c$` command.",
|
||||||
"532": "Usually the best time to see the flowers is in the spring.",
|
"441": "The end of this line needs to be corrected using the `c$` command.",
|
||||||
"725": -1,
|
"504": -1,
|
||||||
"730": -1,
|
"523": -1,
|
||||||
"746": "This line will allow you to practice appending text to a line.",
|
"546": "Usually the best time to see the flowers is in the spring.",
|
||||||
"747": "This line will allow you to practice appending text to a line.",
|
"741": -1,
|
||||||
"767": "Adding 123 to 456 gives you 579.",
|
"746": -1,
|
||||||
"768": "Adding 123 to 456 gives you 579.",
|
"762": "This line will allow you to practice appending text to a line.",
|
||||||
"794": "a) This is the first item.",
|
"763": "This line will allow you to practice appending text to a line.",
|
||||||
"795": "b) This is the second item."
|
"783": "Adding 123 to 456 gives you 579.",
|
||||||
|
"784": "Adding 123 to 456 gives you 579.",
|
||||||
|
"810": "a) This is the first item.",
|
||||||
|
"811": "b) This is the second item."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user