


Learn all aspects of Vim split-screen operation in 5 minutes
#The Vim split-screen function is implemented by splitting windows, which is a great tool for improving work efficiency. Whether we want to display two files at the same time, or display two different locations of a file at the same time, or compare two files side by side, etc., these can be achieved through split screen, which is very convenient for code comparison and copy and paste.
Split the screen horizontally to open a new file
:sp linuxmi.py
or
:split linuxmi.py
This command splits the window horizontally for two windows, and place the cursor in the upper window.

Open a new file in vertical split screen
:vsp linux.py:vsplit linux.py

:sview linux.py ->只读分屏打开文件
In addition, when you want to open a window to edit a new file, you can use the following command: :new
从命令行直接打开多个文件且是分屏
vim -On file1, file2 ... ->垂直分屏vim -on file1, file2 ... ->水平分屏linuxmi@linuxmi:~/www.linuxmi.com$ vim -O3 linux.py linuxmi.py linuxmi.cpp


注:-O垂直分屏,-o水平分屏,n表示分几个屏。扩展:这些书,真tm肝……
另外搜索公众号Linux就该这样学后台回复“git书籍”,获取一份惊喜礼包。
实时调整当前窗口的宽度
ctrl-w > //向右加宽,默认值为1
ctrl-w N > //向右加宽宽度N
ctrl-w < // 同理
横屏/竖屏分屏打开当前文件
ctrl w s
ctrl w v
Switch split screen
##ctrl w h,j,k,l
- ##ctrl w Up, down, left and right keys
- crtl w Switch between split-screen windows. After pressing, press another w
- crtl wTo switch between split-screen windows, press r again to swap windows
- crtl wTo switch between split-screen windows, press After finishing, press c again to close the window
There are several commands to close the window:
- ctrl W c Close the current window
-
调整分屏的大小(宽度与高度)
ctrl+w = 所有分屏都统一高度
ctrl+w + 增加高度,默认值为1
ctrl+w - 减少高度
10 ctrl+w + 增加10行高度
ctrl-w N + //当前屏高度加N
使用指定当前屏的调整高度
: res[ize] N
示例:
:resize 30
移动分屏:ctrl+W H,J,K,L
将屏幕移动到最顶端:ctrl-w + K
将屏幕移动到最低端:ctrl-w + J
将屏幕移动到最左边:ctrl-w + H
Move the screen to the far right: ctrl-w L
The above is the detailed content of Learn all aspects of Vim split-screen operation in 5 minutes. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to Remap CapsLock to ESC on iPad Keyboard Are you ready to make CapsLock the ESC key on your iPad? Here's all you need to do: Open the Settings app on your iPad Go to "General" then go to "Keyboard" Go to "Hardware Keyboard" Select "Modifier Keys" Select "CapsLockKey" and select "Escape" as Modifier Keys Now you're ready to try out the new hardware ESC key on your iPad by pressing CapsLock. Go to any application that uses the Escape key and you can test it immediately, such as vi/vim. Now you can use a physical keyboard from

The method of deleting even-numbered lines is as follows: :g/^/+1d The :gbobal command is used above. The gbobal command format is as follows: :[range]global/{pattern}/{command}global command is actually divided into two steps: first Scan all the lines within the range specified by [range] and mark the lines matching {pattern}; then execute the {command} command on the marked lines in sequence. If the marked lines are marked during the command operation on the previous matching lines, If you delete, move or merge, the mark will automatically disappear without executing the {command} command on the line. {command} can be an ex command or separated by |

In PHP development, using Vim is very common. However, you may encounter some problems installing Vim in Alpine Linux. This article will share how to install Vim on Alpine Linux.

Preface: vim is a powerful text editing tool, which is very popular on Linux. Recently, I encountered a strange problem when using vim on another server: when I copied and pasted a locally written script into a blank file on the server, automatic indentation occurred. To use a simple example, the script I wrote locally is as follows: aaabbbcccddd. When I copy the above content and paste it into a blank file on the server, what I get is: aabbbcccddd. Obviously, this is what vim does automatically for us. Format indentation. However, this automatic is a bit unintelligent. Record the solution here. Solution: Set the .vimrc configuration file in our home directory, new

How to save and exit vim: 1. Use shortcut keys to save and exit; 2. Use a separate command to save and exit; 3. Use automatic commands to save and exit; 4. Use shortcut keys to save the file.

Vim's split-screen function is implemented by splitting windows, which is a great tool for improving work efficiency. Whether we want to display two files at the same time, or display two different locations of a file at the same time, or compare two files side by side, etc., these can be achieved through split screen, which is very convenient for code comparison and copy and paste.

Manually modify the syntax file for downloading the nginx configuration file: nginx.vimwgethttp://www.vim.org/scripts/download_script.php?src_id=14376-onginx.vimCopy the file to the /usr/share/vim/vim74/syntax directory (It can also be a single-user directory ~/.vim/syntax/). Modify vim/usr/share/vim/vim74/filetype.vim to add aubufread,bufnewfile/etc/nginx/*,/usr/local/n

CentOS uses vim/vi to encrypt and decrypt files 1. Use vim/vi to encrypt: Advantages: After encryption, if you don’t know the password, you cannot see the plain text, including root users; Disadvantages: It is obvious that others know the encryption , it is easy for others to destroy encrypted files, including content destruction and deletion; I believe everyone is familiar with the vi editor. There is a command in vi to encrypt files. For example: 1) First, in the root master Create an experimental file text.txt under the directory /root/: [root@www~]#vim/vitext.txt2) Enter the editing mode, press ESC after entering the content, and then enter: X (note the capital X), Enter; 3)
