Yes. vim is an editor based on the Linux environment; it is an external software that comes with Linux and is responsible for editing code. Vim is a text editor developed from vi. It has rich functions that facilitate programming, such as code completion, compilation and error jumping, and is widely used among programmers.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What is vim
vim is an editor based on the Linux environment; vim is the external software that comes with Linux and is responsible for Edit the code. If we want to program under Linux, we need four things to replace the integrated development environment of vs. The most core carrier is the vim editor. Without it, we can't even write code.
Vim is a text editor developed from vi. It is particularly rich in functions that facilitate programming, such as code completion, compilation, and error jumping, and is widely used among programmers.
To put it simply, vi is an old-fashioned word processor, but its functions are already very complete, but there is still room for improvement. vim can be said to be a very useful tool for program developers.
In addition to the classic editor vim under Linux, there is another editor that is also loved by everyone, which is emacs. There are several main reasons why these two editors are so popular that no editor in the following decades can surpass them.
1. Supports rich shortcut keys and editing methods.
2. Supports very powerful expansion capabilities.
3. All are supported by a powerful programming language.
Speaking of the programming language that supports them, we have to mention the programming language behind emacs lisp. We used to say that everything comes from C language, but this is not the case. In addition to C language, there is another programming language that is the ancestor of lisp. These are two programming languages with very different styles. If you are interested, you can learn about them yourself. I won’t go into details here
Although vim and emacs are two editors that have their own merits and are both the ancestors of editors, I choose emacs as my preferred editor and also as the explanation below. The key point (if any students are interested in emacs, they can naturally choose emacs as their first choice), and the best thing is that every Linux system comes with the vim editor, so we don’t need to install it ourselves.
vim use
Basic introduction to vim
Since our Linux already comes with vim , so we can use it directly. Enter vim
to see its interface.
#You will find that the interface of vim is very ugly. After all, it is under the console, which is helpless. So how to exit the interface? Enter :q
to exit. Note: There must be a colon in front of it! .
Regarding the use of vim, vim actually has an official teaching document. After exiting the vim interface, enter vimtutor
to enter the official teaching document. (Enter vimt
tab
to complete it. tab
is the completion key that can help us quickly enter commands, so it should be used frequently).
In the official teaching document, everyone follows the teaching steps and practices step by step. With a lot of practice, you can master all common operations of vim. Remember one thing: Never memorize instructions or shortcut keys while using them. Memory is the best policy.
There are normal, insert, command, visual, and replace under vim. When we use vim to open a document, we enter the normal mode by default. , it is more convenient for us to browse documents in normal mode. In this mode, we have a wealth of shortcut keys for us to perform conditions and move the cursor between pages. Insert mode is the mode we enter when we want to modify the document. There are some commands in the command mode that facilitate us to modify the configuration of vim, jump to pages, etc., with rich usage. Our most commonly used operation in visual mode is to select document fragments to delete, copy or cut. Replacement mode allows us to replace text content.
vim commands
vim has many shortcut keys and commands. Here we focus on introducing some commonly used commands. At the same time, vim is divided into several modes to facilitate shortcut key operations, and most of our shortcut keys are used in normal mode.
1. In vim, in addition to the up, down, left and right arrow keys to move the cursor, we also provide four new shortcut keys for us to move the cursor. j: Lower
; k: Upper
; h: Left
; l: Right
. Under vim, it is especially recommended that you use these four direction keys to control cursor movement, because they are more convenient to use. The most important thing is that this is a symbol that you have learned vim!
2. There are many ways to enter other modes from normal mode. The most common one is to press i
to enter insert mode, :
to enter command mode, and v
Enter visual mode, R
enter replacement mode. The most commonly used method to return to normal mode in other modes is always to press esc
. Therefore, it often becomes a habit for programmers who use vim to press esc
3. x
to delete a single character.
4. Enter the command vim file name in a directory to open an existing file or create a new file. Enter
: to enter command mode, enter
w to save,
q to exit,
wq to save and exit,
q! Force exit without saving.
w can move the cursor from the current position to the head of the next word,
e can move the cursor from the current position to the end of the next word,
$ can move the cursor to the end of the line,
b means moving to the beginning of the previous word.
d represents a delete command, usually used in conjunction with the cursor jump command.
dw means deleting from the current cursor position to the head position of the next word (excluding the head),
de means deleting from the current cursor position to the tail position of the next word (including the tail) ),
d$ means to delete from the current position of the cursor to the end of the line (delete the entire line).
2w ==
w
w,
d2w==
dw
dw, etc. Wait, you can try it yourself.
u means undoing the operation, and
U means undoing the operation on the entire line.
Ctrl r means redo and undo operations.
ddDelete/cut the entire line, # ##p
Paste the content in the clipboard after the cursor, P
Paste the contents of the clipboard in front of the cursor. 10.
will replace a single character, ## #R will enter the replacement mode and replace the next input content with the input content until it returns to the normal mode.
11. The
c
d command, and still forms a combined command with other commands, such as
cw,
ce, etc. , but the difference is that the
c command will enter insert mode after use.
12. Enter
:
set nu to set the line number.
13.
ctrl g
14.
shift g
gg jumps to the beginning of the text,
'returns to the number of lines before jumping.
15.
/Search content
nfind the next one,
Nfind the previous one .
16. Press
%
17. Enter
:
s/search content/replacement results/gc to replace the content of a line,
%s/search content /Replacement result/gc performs full-text content replacement, where
g means searching the entire line,
c means asking before replacing,
%s means full-text replacement.
18.
o
OCreate a new row above this row and enter insert mode.
19.
v
y to copy. At the same time,
yy can copy a row. Use
p or
P similarly to paste.
20.
a
i. Also use
I or
A to insert at the beginning or end of the line.
This is the introduction to the basic commands of vim. The use of vim is far more than these shortcut keys and commands. If you want to use vim better and more skillfully, you need to practice continuously. Learning in practice is the key. The most efficient.
Linux Video Tutorial
"The above is the detailed content of Is vim based on linux?. For more information, please follow other related articles on the PHP Chinese website!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
