Is vim based on linux?

Mar 20, 2023 am 10:06 AM
linux vim

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.

Is vim based on linux?

#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.

Is vim based on linux?

#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! .

Is vim based on linux?

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.

5.

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.

6.

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).

7. At the same time, we can use numbers plus instructions to repeatedly execute many instructions. For example

2w == w w, d2w==dw dw, etc. Wait, you can try it yourself.

8. In normal mode,

u means undoing the operation, and U means undoing the operation on the entire line. Ctrl r means redo and undo operations.

9.

ddDelete/cut the entire line, #  ##pPaste the content in the clipboard after the cursor, PPaste the contents of the clipboard in front of the cursor. 10.

r

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

command is similar to the

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 :

to enter the command mode, and enter

set nu to set the line number. 13. ctrl g

Displays the current line number and displays cursor position information.

14. shift g

jumps to the end of the text,

gg jumps to the beginning of the text, 'returns to the number of lines before jumping. 15. /Search content

Enter the command mode, enter the search content to search, and

nfind the next one, Nfind the previous one . 16. Press %

on the bracket to quickly move the cursor to match the bracket and automatically jump to the matching bracket.

17. Enter :

to enter the command mode and then 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

Create a new row below this row and enter insert mode,

OCreate a new row above this row and enter insert mode. 19. v

Enter visual mode, move the cursor to select the statement and press

y to copy. At the same time, yy can copy a row. Use p or P similarly to paste. 20. a

Entering insert mode means inserting after the cursor, similar to

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.

Related recommendations: "

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

See all articles