In depth help
Recall the last lesson
- It was made last time
oeasy.txt
- use
vim oeasy.txt
File opened :f[ile]
Queried the information of the current file- from
Normal mode or command mode
Switch toCommand line mode
To use: - from
Command line mode
PressenterExecute the order and come back after execution
- We can already work in two modes(
Command mode
、last line node
Switch between modes - We want to know more help information this time
Run help
stayvim
Medium operation:help
- We can useh、j、k、lMove
- The direction is shown in the figure above
- At this time
hjkl
Instead of entering characters, it is a command to move the direction - Not just these four characters
- All keyboard characters correspond to commands
- This is why the default normal mode
(Normal mode)
Also known as command mode
Command mode
- In command mode, you can press the key directly to execute the command
- Such as mobile
- There are many orders
-
Command mode
(Normal mode)
And command line mode(Command-Line mode)
Different- Command mode
(Normal mode)
Direct key execution - Command line mode
(Command-Line mode)
Enter the command at the bottom line and pressenterimplement
- Command mode
- Different modes correspond to different operations
- This too
vim
The most difficult reason to get started
learning curve
- VIM is recognized as a very steep learning curve
- However, after the breakthrough, the efficiency is quite high
- No matter how easy it is, no matter how difficult it is
- Things that seem easy at first, such as ides
- Everything is ready for you, but you completely lose understanding and control over the bottom. In the end, it is the most difficult
- We climbed the steep mountain little by little and conquered vim
But whyh、j、k、lWhat about the corresponding direction?
origin
vim
come ofvi
vi
It was Bill joy in the early daysadm3A
Made and used onadm3A
It’s a terminaladm3A
Your keyboard has no direction keys- So this habit continues to this day ⚠ ️
- We can see on the keyboard aboveh、j、k、lThe corresponding direction above the key
I still need it nowh、j、k、lPress the key to control the cursor?
Keyboard core area
yes! It can still be used nowh、j、k、lPress the key to control the cursor.
-
When using VIM, we can put our hands on the core area of the keyboard, which helps to improve efficiency
- Place the index finger of your left hand on thefupper
- Place the index finger of your right hand on thejupper
The modern 101 keyboard shown in the above picture has added direction keys:
- The non core area below the right hand
- Notebook keyboard direction keys also need to physically move the position of the hand
- So this movement will reduce efficiency. Can we use the mouse to locate it?
Using the mouse
To use mouse control in VIM, we need to make basic configuration first:
- First, we search for help in vim and enter
:h mouse
, you can see the interface shown in the following figure:
- Now let’s set the theme
-
As we can see from the above figure, VIM prompts us to execute
:set mouse=a
, you can use the mouse!!!- We can use the mouse to move the cursor
- Use the scroll wheel to turn pages
- You can also click the relevant topic links with the mouse
These modern technologies are really good. The operation is more convenient after using the mouse, but the mouse will actually be more convenientAffect efficiency, because the mouse will take our hands off the keyboard.
howevervi
The purpose is to enable users to complete all editing work without leaving the core area of the keyboard:
- Directional movement is the most common operation
- He wants your relatively flexible right hand position to be completely stationary in the core area of the keyboard
- Just press the finger to complete the corresponding movement operation
- And faster than the mouse
Positional memory
- It’s hard to remember the right side with L
- What shall I do? Some users thought of this
- East Los Angeles
- South Java
- West Yellow River
- North Gongqing City
- It’s actually very simple when you’re familiar with it
- Gradually turn operation into muscle memory instead of brain
Now we have a new question. How did bill joy jump to the hyperlink theme when there was no mouse?
Keyboard jump
- function
:help
Back to the beginning of the topic - We can see
bars
Such links - useh、j、k、lMove Cursor
- Move the cursor over the link
- yesctrl+]CanJump in link
- ctrl+osureJump out link, return to the original position
older position
- We can try jumping repeatedly ♀️
Two sets of manuals
- When reading VIM’s Manual
- We found that VIM has two sets of manual
user ‘s manual
-
One set is the user manual
- Like a Book
- Read from beginning to end
- From simple to complex
- Suitable for beginners
Reference manual
-
Another set of manuals is cited
- Describe each topic accurately
- And how the subject matter works
- Suitable for query
summary
-
We saw it this time
- Normal mode
- Command line mode
- And how they switch
- Learned the correct way to open the help file
- h、j、k、lHistorical sources of commands
- Use the mouse in the document (not recommended)
- Use full keyboard to jump in and out hyperlinks
- Two manuals for help files
- But at this point, we still haven’t changed the document!
- A good meal is not afraid of late?
- We’ll talk about it next time!