[Vim] vim learning notes-open, switch, and close multiple files

Source: Internet
Author: User

[Vim] vim learning notes-open, switch, and close multiple files
One case is to use vim in shell to open multiple files, and the other case is to open multiple files in the vim editor.
Open multiple files at the same timeVim file1 file2
Open the file and display vim-o file1 file2 in the horizontal window.

Open the file and display vim-O p1.sh p2.sh vertically


Open a new file in vimOpen a new file in the original window: open file

Multi-Window Opening: vs file path/file name open file in the new Vertical Split screen: sv file path/file name open file in the new horizontal split screen
Switch between files (one window, but multiple files are opened) Ctrl + 6-Next file: bn-Next file: bp-previous file
Multiple windows are opened at the same time. For files opened in multiple panes using (v) split, this method only switches different files in the current pane. Ctrl + w + direction key -- switch to the front/bottom/top/back pane Ctrl + w + h/j/k/l -- same as Ctrl + ww -- switch to the next pane in turn
Copy multiple objects: 1. use the VISUAL mode in the first file, that is, VISUAL. Then select the text to be copied and run the command "+ y, or" * y "to copy the content to the clipboard. It can contain three characters and must be in visual mode. After selecting the code you want to copy, enter the preceding command, the command you entered is not displayed below VIM. 2. In another file, execute the command "+ p, or" * p. + Refers to the register, which seems to be the operating system clipboard. After copying, you can use ctrl + v in other places, such as text files. In visual mode, you do not need to enter the colon:. The command entered here is invisible.
Close file: A single file: q. You can close all: qa.

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.