Vim Tips #
Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. Here are some general tips and commands organized by mode.
Normal Mode #
Normal mode is the default mode where you navigate and manipulate text.
dd: Quick delete line. Deletes the current line and copies it to the clipboard.gg=G: Quick format document.gggoes to the top of the file,=formats the code, andGtells it to format until the end of the file.u: Undo. Undoes the last change.Ctrl + r: Redo. Redoes the last undone change.yy: Yank (copy) line. Copies the current line.p: Paste. Pastes the copied or deleted text after the cursor./pattern: Search. Searches forward for the given pattern. Pressnfor next match,Nfor previous.0or^: Start of line. Moves the cursor to the beginning of the current line.$: End of line. Moves the cursor to the end of the current line.
Insert Mode #
Insert mode is where you actually type text into the file.
i: Insert. Enters insert mode before the cursor.I: Insert at start. Enters insert mode at the beginning of the line.a: Append. Enters insert mode after the cursor.A: Append at end. Enters insert mode at the end of the line.o: Open new line below. Opens a new line below the current one and enters insert mode.O: Open new line above. Opens a new line above the current one and enters insert mode.EscorCtrl + c: Exit insert mode. Returns to Normal mode.
Terminal Mode #
Terminal mode allows you to interact with a shell session from within Vim.
:term: Open terminal. Opens a terminal buffer in a new window split.Ctrl + w,N: Exit terminal mode. Switches the terminal buffer back to Normal mode (useful for copying text from terminal output).iora: Re-enter terminal mode. If you are in Normal mode within a terminal buffer, pressiorato start typing in the shell again.Ctrl + w,w: Switch windows. Moves the cursor to the next window (e.g., to go back to your code from the terminal).
Help improve my blog
Was this page helpful to you?
This page was last modified at 2026-05-23