Master Vim Quickly: Essential Cheat Sheet for Programmers
This article presents a comprehensive Vim cheat sheet covering basic startup, configuration, cursor movement, screen scrolling, text insertion, deletion, copy‑paste, undo, search‑replace, bookmarks, visual mode, linewise commands, macros, window management, and file operations, illustrated with clear screenshots for Linux developers.
Getting Started with Vim
Open Vim by typing vim in the terminal. The first screenshot shows the initial screen.
Vim Configuration
Customize Vim using the ~/.vimrc file. The following image displays a sample configuration with common settings.
Cursor Movement
Key commands for moving the cursor efficiently (h, j, k, l, w, b, 0, $) are illustrated.
Screen Scrolling
Use Ctrl‑d, Ctrl‑u, Ctrl‑f, Ctrl‑b to scroll half‑pages or full pages.
Inserting Text
Enter insert mode with i, a, o, etc., and exit with Esc. The screenshot shows the mode transition.
Deletion Commands
Delete characters, words, lines using x, dw, dd, etc.
Copy & Paste
Yank (copy) with y, paste with p or P. The image demonstrates the process.
Undo and Redo
Undo changes with u and redo with Ctrl‑r. Screenshot shows the undo command.
Search & Replace
Search with /pattern, replace with :%s/old/new/g. The picture illustrates the command line.
Bookmarks
Set marks with m{a‑z} and jump with `{a‑z}. The screenshot shows mark usage.
Visual Mode
Enter visual mode with v (character), V (line), or Ctrl‑v (block) to select text for operations.
Linewise Commands
Commands that act on whole lines, such as dd, yy, >>, <<, are displayed.
Macros
Record a macro with q{a‑z}, execute with @{a‑z}. The image shows the recording process.
Window Operations
Split windows with :split, :vsplit, navigate with Ctrl‑w commands. Screenshot illustrates split view.
File and Miscellaneous Commands
Open, save, and quit files using :e, :w, :q, and combine them ( :wq, :qa). The final image shows the command line for file operations.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
