VI commands for opening and editing multiple files

Source: Internet
Author: User
VI commands to open and edit multiple files can be divided into two situations: 1. open multiple files in the same window: vifile1file2file3: n switch to the next file (nnext ): N switch to the previous file 2. open multiple files in different windows: if a file has been opened... VI commands for opening and editing multiple files can be divided into two situations: 1. open multiple files in the same window: vi file1 file2 file3: n switch to the next file (n = next ): N switch to the previous file 2. open multiple files in different windows: If you have already opened one file, enter the following command in the vi command input state: sp path and file name of another file, so that you can open multiple files in a window. Or use vi-o file1 file2 file3. .. to open multiple files at the same time in a split screen window. You can press ctrl + twice to press w or ctrl + w and then press the up or down key to switch between the upper and lower windows. 2. split the window to edit multiple files * use vi to open a file first, for example, in vi actinia_proenrule.sh * split window, open another file in command line mode, enter sp, and another file to split horizontally to continue opening the second file. to split vertically, you can use the vsp file name. note: sp = split, vsp = vsplit. the preceding statement is a simple statement supported by vi, and v is actually vertical. we can see the meaning of the command change. In addition, vi not only supports two files, more files can be displayed and edited in a large window at the same time, and the two files simultaneously opened are the same file. * You can use ctrl + to press w twice for window switching, so that you can find that the multi-document editing of vi is inconvenient before switching between different files, and now you have access to several, I used MiniBufExplorer and found that it was not very comfortable. It is better to use ls.: Ls to show all open documents: switch xn to The x down Document n ctrl + 6: switch to the n buffer ctrl + 6 OR: e # return to the previous editing file split screen: new xxx ctrl + w s display ctrl + w q on the current document content split screen ctrl + w q close the split screen ctrl + w o only display the current split screen content ctrl + w j k up and down select split screen personally think the most worthwhile the command ctrl + w is used to quickly switch between the two screens on the split screen ~ After reading this article, I think it is good: n1, n2 co n3: copy the content from line n1 to line n2 to line n3: n1, n2 m n3: move the content from line n1 to line n2 to line n3: n1, line n2 d: delete the content from line n1 to line n2: n1, line n2 w! Command: The content from line n1 to line n2 in the file is used as the command input and executed. if n1, n2, the advantage of using the entire file content as command input method 2 is that you can directly use the nyy and pp commands to copy and paste files in various windows, which is more convenient.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.