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

Basic use of vim in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the relevant knowledge of "the basic use of vim in Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Simple execution example 1.1 uses vim to enter general instruction mode

The following page appears when you use vim filename, and you enter edit mode when you click iMagne.

Leave edit mode

Press the button esc

Enter the command line, store files, and leave the vim environment

Switch to English input, press and hold shift +: enter wq

two。 Button description

Here only write commonly used, not commonly used I will not write, if there is a need, you can see the document

2.1 the first part of the method of moving the cursor key meaning [ctrl] + [f] next page, equivalent to [page down] key [ctrl] + [b] previous page Equivalent to [page up] press 0 or [home] move to the top of the column $or [end] to the last side of the column H move to the top of the screen the first character L of the column at the bottom of the screen move to the first character G of the bottom column of the file move to the last column of the file gg move to the first column of the file nGn as a number, move to the nth column of the file nn as a number After entering the number, click enter Jian to move down how many columns 2.2 part II search and replace instruction meaning / word and? Word searches up or down for the characters word n and N above we search for word, if we enter n, we will continue to look down, if it is N, we will continue to look up: N1 Magi n2sqqword1max gn1 and N2 are the numbers. Find the string word1 between columns N1 and N2, and replace the string with word2:1,$s/word1/word2/g find the word1 string from the first column to the last column, and replace the string with word2! 2.3 the third part deletes, copies, pastes the key meaning dd, ndddd deletes an entire column, ndd deletes a down n column, n is a digital yy,nyyyy copy an entire column, nyy copies a down n column, n is a numeric pmenopp will be copied in the next column of the cursor, P will copy J in the previous column of the cursor to merge the column into the same column u undo [ctrl] + r if you cancel the error You can use this fallback 2.4 part 4 general instruction to switch to edit mode key meaning: Q: Q!: wq: do not save exit, force exit, save exit: W filename stores the edited data into another file: r filename reads the data from another file Insert after this column: N1 filename N2 w filename stores N1 to N2 content in another file, "basic use of vim in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report