Why learn vim Linux has a large number of configuration files, so there are also many text processing tools in Linux. Commonly used ones are Intended Readers Operations, development, and people who want to advance their knowledge of Linux. If you want to learn bash, it is more convenient to learn vim. You can't go to Windows to edit every time. Start learning Three modes of vi and switching
graph LR A[Normal Mode] -- I/O/A/R --> B[Edit Mode] A -- Colon/Question mark/Forward slash --> C [Command line mode] C -- ESC --> A B -- ESC --> A The difference between commands for switching from normal mode to edit mode
Common buttons and functions The following instructions are case sensitive Methods for moving the cursor (normal mode)
Delete, copy, paste (normal mode)
Find and replace (normal mode)
Select text (normal mode)
To sum up From the above commands, we can see that in vi, some letters have special meanings, such as $ stands for the end of a line, 0 stands for the beginning of a line, G stands for the last line, y stands for copy, d stands for delete line, x stands for delete character, Numbers usually indicate how many times something is repeated, and uppercase and lowercase letters usually have opposite meanings. The shortcut key for turning pages happens to be the abbreviation of English
Save the file as (command mode)
Practice wget 'http://linux.vbird.org/linux_basic/0310vi/man.config'
7. I want to copy the contents of lines 65 to 73 (including MANPATH_MAP) and paste them after the last line;
The answer is as follows: vi man.config :set nu 58G 40→ /dir/bin/foo gg /bzip2 118 lines 50,100s/man/MAN/gc 25 modifications, 23 lines changed u, or exit without saving: q! Locate line 65G, copy line 9yy, locate the last line G, and paste p :21,42s/^#//g //Regular expressions can be used in it:w man.test.config 27G 15x you Locate the first line gg, i <enter> and then enter the content: wq Multiple file editing vi can be followed by multiple files, like this vi man.config test.txt n Edit the next file N Edit the previous file files Displays all files currently being edited Multi-window editing It is possible to open multiple files in the same window using the :sp [filename] command, like this :sp /etc/hosts Each window has its own separate mode and commands [ctrl]+w+↓ Switch to the next window [ctrl]+w+↑ Switch to the previous window Edit vim's configuration file ~/.vimrc (simple configuration) One configuration per line" is a comment You can use the command: set all to view all configuration items. Commonly used configuration items are as follows: The above command has been set up to show that backspace and tab are used in units of tabs. If you need to use spaces to represent tabs, you need to add the following configurations `` Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of Angular component projection
>>: How to backup MySQL regularly and upload it to Qiniu
Problem Peeping In the server, assuming that the ...
This article describes how to use the local yum s...
Today I will introduce a very simple trick to con...
Table of contents Prerequisites useEffect commitB...
A process is a program code that runs in the CPU ...
Search Mirror docker search rocketmq View image v...
This article shares the specific code of js to re...
html: In fact, it is to arrange several solid cir...
2D transformations in CSS allow us to perform som...
Table of contents 1. What is a subquery? 2. Self-...
Table of contents Basic Types any type Arrays Tup...
1.1 Data Type Overview The data type is a field c...
0. What is a tag? XML/HTML CodeCopy content to cl...
1. Introduction Presto is an open source distribu...
One day I found that the execution speed of a SQL...