- Mastering Vim
- Ruslan Osipov
- 453字
- 2021-06-10 18:51:28
Moving windows
Windows can also be moved, swapped, and resized. Since there's no drag-and-drop functionality in Vim, there are some commands you will have to remember.
As with the rest of the window commands, these are prefixed by Ctrl + w.
Ctrl + w followed, by an uppercase movement key (H, J, K, or L) will move the current window to the corresponding position:
- Ctrl + w, H moves the current window to the leftmost part of the screen
- Ctrl + w, J moves the current window to the bottom of the screen
- Ctrl + w, K moves the current window to the top of the screen
- Ctrl + w, L moves the current window to the rightmost part of the screen
For example, let's start with the following window layout (which was achieved by opening animal_farm.py and running :sp animals/cat.py, followed by :vs farm.py):
Note the cursor position (in animals/cat.py). Here's what happens when we try to move the window containing the animals/cat.py buffer in each direction:
Ctrl + w, H migrates animals/cat.py all the way to the left:
Ctrl + w, J moves animals/cat.py to the bottom of the screen, turning a vertical split into a horizontal split:
Ctrl + w, K moves animals/cat.py to the top of the screen:
- Ctrl + w, L moves animals/cat.py to the right of the screen:
You can change the contents of each window by simply navigating to it and selecting the desired buffer using the :b command. There are, however, options for swapping window contents:
- Ctrl + w, r moves every window within the row or the column (whichever is available—rows are given preference over columns) to the right or downward. Ctrl + w, R performs the same operation in reverse.
- Ctrl + w, x exchanges the contents of a window with the next one (or a previous one if it's considered a last window).
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- Python程序設計教程(第2版)
- C語言程序設計案例式教程
- The DevOps 2.4 Toolkit
- C語言程序設計同步訓練與上機指導(第三版)
- 深入RabbitMQ
- Mastering Linux Network Administration
- 青少年學Python(第1冊)
- Node.js Design Patterns
- Java系統化項目開發教程
- Hands-On Kubernetes on Windows
- UML2面向對象分析與設計(第2版)
- Implementing Microsoft Dynamics NAV(Third Edition)
- 從零開始學UI設計·基礎篇
- 軟件再工程:優化現有軟件系統的方法與最佳實踐