DEV Community

Vim Command Cheat Sheet: From Beginner to Advanced

Vim is a powerful and highly customizable text editor known for its efficiency and wide array of commands. This cheat sheet covers everything you need to know to get started with Vim, from basic commands to advanced features. To open Vim, simply type "vim" in the command line. To enter insert mode, use the "i" command, and to save and exit, use ":wq" or "ZZ". Navigation in Vim is efficient, with basic movement commands including "h" to move left, "j" to move down, "k" to move up, and "l" to move right. Word navigation commands include "w" to move to the next word, "b" to move to the previous word, and "e" to move to the end of the current or next word. Vim also allows you to edit text in various ways, including deleting text with "x", "dw", and "dd", copying and pasting with "yy" and "p", and undoing and redoing with "u" and "Ctrl + r". Searching and replacing text is also possible in Vim, with commands including "/pattern" to search forward for a pattern and ":s/old/new" to replace the first instance of a pattern. Vim can also manage multiple files in the same session, and advanced commands include macros, registers, and marks. Customization is also possible in Vim, with basic configuration settings including "set number" to show line numbers and "set autoindent" to enable automatic indentation.
favicon
dev.to
dev.to
Create attached notes ...