Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux editor vim command interpretation

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1.9vim Editor

The underlying text editor of the linux kernel is similar to the text document on the windows system. Most of the text editors use this tool to edit the text. The operation mode of this tool basically does not need a mouse, but mostly operates with commands.

The tool is divided into three modes: command mode, insert mode, and trailing mode.

Command mode: use the command to operate the vim editor, copy, paste, delete, exit, save

Yy: copy the line of the cursor nyy: copy n lines starting from the current line of the cursor

P: paste, pasting the copied data starting from the current line of the cursor

Dd: delete the line of the cursor ndd: delete n lines starting from the current line of the cursor

ZZ: save and exit. If you edit a text with vim without write permission, and then use this command to exit, it will not succeed.

I: for the operation of entering insert mode from command mode, you can start from the current position and press I directly. Similarly, there are I (first line insertion), o (next line insertion), O (new line entry on the previous line), a (next character insertion), A (end of line insertion).

Insert mode: normal text editing mode in which code is written directly.

Exit insert mode and enter command mode: ESC

Show line number: set nu, do not show set nonu

Highlight search results: set hls unhighlight: set nohls

Support mouse operation / copy operation: set mouse=a: support mouse operation

Set mouse=v: support for copy and paste

In the case of a colon: enter wq! You can also exit text editing, w: save, Q: exit,! It is enforced and can be combined freely

Block operation: [m], [n] d: delete data from m to n rows [m], [n] y: copy

For example, if you enter 9d, the data from the first row to the ninth line will be deleted.

Press / can also enter trailing mode: this way to enter, is used to search for a string, the search results, n is the next result, N is the previous result

Visual mode: extended from the command mode, you can copy and paste a small piece of data, directly select more than 2 data with the mouse to enter the visual mode, select a piece of data, press d to delete, y is to copy, this operation must be set up vim editor to support mouse operation, otherwise not

Set nu

Set autoindent

Set smartindent

Set nocompatible

Filetype on

Syntax on

Set ruler

Set nohls

Set incsearch

Set shiftwidth=4

Set softtabstop=4

Set ts=4

Set mouse=v

Set showmatch

Save exit

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report