[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.