Vim multi-file and multi-screen operations

Source: Internet
Author: User

Vim multi-file and multi-screen operations

1Open multiple files in the same windowVI file1 file2 file3: n switch to the next file (n = NEXT): n switch to the previous file
2Open multiple files in different windowsIf you have already opened a file, enter the path and file name of another file in the command input state of VI, so that you can open multiple files in one 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.
3. Split windows to edit multiple files* Use VI to open a file, for example, VI actinia_proenrule.sh *. Open another file in command line mode and Enter SP to split the file horizontally to continue opening the second file, to vertically split a file, 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 bufferctrl + 6 or: E # back to the previous editing File
4. Split screen: New xxxctrl + w s display Ctrl + w Q on the current document content split screen Ctrl + w o display only the current split screen content Ctrl + w j k select up and down split screen Ctrl + w fast switch between two screens
5. Others: 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.