Vim
Vim is a very good editor, an ancient artifact. When you are familiar with this editor, will your competiveness be much higher in an instant?
First install vim
Of course, learning an editor is to facilitate yourself and improve efficiency, but the learning curve of vim, a text editor, is steep
But hard training will bring you efficiency
And when I use the git command, it is indeed a very powerful development combination to cooperate with vim. Although vim has no code hints, it actually has a lot of plug-ins for use. When we submit the code with git, we use vim to do it. It is very convenient to resolve conflicts and edit the code
VIM download vim
Start vim
i
Insert mode, press ESC to return to Normal mode
Anyway, if you don’t know what mode you are in, just keep pressing ESC to return to Normal mode. The following function keys are all triggered in Normal mode.
At this time, the Insert mode is the same as the Notepad
Operating vim will often switch between these two modes, just like you switch between tabs and edit content window in Notepad
It’s just that most of it has become a keyboard operation
So in Normal mode, all the keys on the keyboard become the corresponding function keys, just like when we press c and ctrl+c, c becomes the corresponding function key in the back
x
In Normal mode, press x to delete a character under the current cursor
In fact, this is equivalent to the backspace key in Insert mode
:wq
Save+exit vim(:w save:q exit) followed by the file name
This is equivalent to the file in Notepad -> (Save) Save As
dd
Delete the current line and save the deleted line to the clipboard, which is also commonly used in IDEs. Quickly delete a line of code without long pressing backspace.
p
Paste the clipboard, this function is quite common, if you copy something outside, you can paste it directly by pressing p on the vim interface
yy
Copy the current line to the clipboard
help
Display help for related commands
:q
quit:q!
Exit without saving
a
Insert after the cursor, if the cursor is not at the end, it will automatically freeze the frame for you to enter the end
o
Insert a new line after the current line, which is equivalent to hitting the Enter key at the end of a line in Notepad
0
Press the number 0 to go to the beginning of the line, which is the opposite of a
^
This is to combine shift+6 to the position of the first non-blank character in the line (the so-called blank character is a space, tab, line feed, carriage return, etc.)
$
The cursor switches to the end of the line
/pattern
Search string for pattern
If multiple matches are found, press n to locate the next one
u
Undo is Undo
Basic IDEs with this function are available, quite commonly used, as convenient as ctrl+z when I use PS
ctrl+r
\
Redo is Redo
:e <file path/file name>
Open a file. In cmd, I often cd to the specified directory, and then dir displays and then uses vim to open the corresponding file for editing
:w
save
A written prompt will appear after saving
: saveas <file path/file name>
Save as
After the save is successful, the written prompt will also appear
One thing to note is that if you just save or save as but never exit vim editing, the file will always be in the folder with the following suffix
But if you save and exit, it will become the file name and suffix defined when saving
:x
ZZ
shift+z:wq
The above three are all to save and exit. Note that ZZ does not need to enter a colon and enter
:q!
Exit without saving:qa
Forcibly exit all files being edited, even if other files have changed
:bn
:bq
Sometimes we need to open multiple files, that is, when one file is already open, we can continue to use :e
to open other files. When opening multiple files, we can use the above two commands to switch to the next or previous document
.
This command can repeat the last command you ran
N<command>
It’s invisible when you hit this, which means blind hitting.
N is to enter a number. For example, if I enter 9p, the following picture will appear
G
Position the cursor at the head of the last line
w
Go to the beginning of the next word.e
To the end of the next word.
- If you think the word is by default, then use lowercase e and w. By default, a word consists of letters, numbers and underscores
- If you think that words are separated by blank characters, then you need to use uppercase E and W.
*and#
When you put the cursor on catwsscat and press * or #, it will move to the previous or next match of the word
- *On the left side of the keyboard is to match the previous word
On the right side of the keyboard is to match the next word
%
Match bracket movement, support (, {, [, you need to move the cursor to the bracket first
v
After entering the visual selection, press the up, down, left, and right arrow keys on the keyboard to automatically select for you
Visual selectionJ →
connects all the rows (turns into one row) <or> → indent left and right
= →
automatically indent (this is really convenient)
finally
I have been busy recently. I have time to continue to organize later. Thank you for taking the time to read. I look forward to finding a good front-end job. Come on! thanks. If this article can bring you a hint of help or inspiration, please don't be stingy with your praise and Star, yours is definitely my biggest motivation to move forward 💞 attach a link to the notes, read more high-quality articles in the past, you can check it out, and if you like, you can give I like to encourage it: https://github.com/Wscats/articles/issues/27
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。