Module Review: Workspace Management
[!NOTE] This review chapter consolidates your understanding of Vim’s workspace hierarchy. By mastering Buffers, Windows, and Tabs, you unlock Vim’s true power as a multi-file development environment. Use the tools below to drill the core concepts.
1. Key Takeaways
- The Hierarchy: Vim’s workspace consists of three levels: Buffers (files in memory), Windows (viewports displaying a buffer), and Tabs (collections of windows).
- Buffer Independence: Closing a window (
:q) does not close the file. The buffer remains active in memory. You must explicitly delete it with:bd. - Window Navigation: The
Ctrl-wprefix is the master key for window management. Combine it with movement keys (hjkl) to navigate, or math operators (+-=<>) to resize. - Tab Fallacy: Vim tabs are not like browser tabs. Do not open a new tab for every file. Use tabs to separate distinct tasks or workspace layouts.
- Listing Files: Use
:lsor:buffersto view all files currently loaded in memory, and jump to them instantly with:b <name>.
2. Flashcards
What is the difference between a Buffer and a Window?
A Buffer is the file data loaded into RAM. A Window is simply a viewport on your screen that displays a buffer.
Command to split the current window horizontally?
:split or :sp
Shortcut: Ctrl-w s
Command to close all windows except the currently active one?
:only or Ctrl-w o
How do you jump back to the previously active buffer?
Ctrl-^ (or Ctrl-6). This toggles between the current (%) and alternate (#) buffers.
3. Cheat Sheet
| Action | Command / Shortcut | Description |
|---|---|---|
| Split Horizontal | :sp [file] or Ctrl-w s |
Split screen top/bottom |
| Split Vertical | :vsp [file] or Ctrl-w v |
Split screen left/right |
| Navigate Windows | Ctrl-w [hjkl] |
Move cursor to adjacent window |
| Close Window | :q or Ctrl-w c |
Close viewport (leaves buffer in RAM) |
| Close Other Windows | :only or Ctrl-w o |
Maximize current window |
| Resize Equal | Ctrl-w = |
Make all split windows the same size |
| List Buffers | :ls or :buffers |
Show all files in memory |
| Switch Buffer | :b <name> or :b <num> |
Jump to buffer by name or ID |
| Next/Prev Buffer | :bn / :bp |
Cycle through loaded buffers |
| Delete Buffer | :bd or :bd! |
Remove file from memory |
| New Tab | :tabnew [file] |
Create a new workspace tab |
| Next/Prev Tab | gt / gT |
Navigate between tab pages |
4. Quick Revision
- To view two files side-by-side:
:vsp path/to/file2.txt - To quickly flip between a
.cand.hfile you just edited: PressCtrl-^. - To clean up your screen and focus on one thing: Press
Ctrl-w o. - To fix a layout where one window got too small: Press
Ctrl-w =to equalize them.
5. Next Steps
Now that you can navigate files and manage your workspace, you are ready to learn how to heavily customize Vim to fit your personal workflow.
- Continue to Module 05: Modern Vim to learn about the
.vimrcfile, package managers, and transforming Vim into a modern IDE with LSP and plugins. - Vim Glossary