https://vimtricks.com/p/50-useful-vim-commands/ VimTricks [ ] * Vim Newsletter * Archive * Vim Books * About * Vim Newsletter * Archive * Vim Books * About * Posted on October 23, 2022 * By Colin Bartlett * In Tips and Tricks 50 Useful Vim Commands 4.7 (110) Here are 50 useful Vim commands that work in normal mode. Many of these can be combined and modified to produce dozens more. Use these as inspiration for your own repeatable workflows. In no particular order: 1. gg Move to the first line of the file 2. G Move to the last line 3. gg=G Reindent the whole file 4. gv Reselect the last visual selection 5. `< Jump to beginning of last visual selection 6. `> Jump to end of last visual selection 7. ^ Move to first non-blank character of the line 8. g_ Move the last non-blank character of the line (but you remove trailing whitespace, right) 9. g_lD Delete all the trailing whitespace on the line 10. ea Append to the end of the current word 11. gf Jump to the file name under the cursor 12. xp Swap character forward 13. Xp Swap character backward 14. yyp Duplicate the current line 15. yapP Duplicate the current paragraph 16. dat Delete around an HTML tag, including the tag 17. dit Delete inside an HTML tag, excluding the tag 18. w Move one word to the right 19. b Move one word to the left 20. dd Delete the current line 21. zc Close current fold 22. zo Open current fold 23. za Toggle current fold 24. zi Toggle folding entirely 25. << Outdent current line 26. >> Indent current line 27. z= Show spelling corrections 28. zg Add to spelling dictionary 29. zw Remove from spelling dictionary 30. ~ Toggle case of current character 31. gUw Uppercase until end of word (u for lower, ~ to toggle) 32. gUiw Uppercase entire word (u for lower, ~ to toggle) 33. gUU Uppercase entire line 34. gu$ Lowercase until the end of the line 35. da" Delete the next double-quoted string 36. + Move to the first non-whitespace character of the next line 37. S Delete current line and go into insert mode 38. I insert at the beginning of the line 39. ci" Change what's inside the next double-quoted string 40. ca{ Change inside the curly braces (try [, (, etc.) 41. vaw Visually select word 42. dap Delete the whole paragraph 43. r Replace a character 44. `[ Jump to beginning of last yanked text 45. `] Jump to end of last yanked text 46. g; Jump to the last change you made 47. g, Jump back forward through the change list 48. & Repeat last substitution on current line 49. g& Repeat last substitution on all lines 50. ZZ Save the current file and close it How useful was this tip? * * * * * Submit Rating Average rating 4.7 / 5. Vote count: 110 No votes so far! Be the first to rate this tip. We are sorry that this post was not useful for you! Let us improve this post! Tell us how we can improve this post? [ ] [ ] [ ] [ ] [ ] Submit Feedback Tags:native Post navigation Previous postOpen URL in Vim Written by Colin Bartlett Colin Bartlett 104 Posts Vim enthusiast and software developer for more than 20 years. View all posts You may also like September 5, 2022 Vim Move Split Move a Vim split with these built-in shortcuts. Your current split can be moved in Vim with ctrl-w and a letter movement: H J K L. Andy Libby Andy Libby March 11, 2021 Vim Copy Line Copy a line in Vim without moving your cursor. Use these ex commands in Vim to efficiently copy lines. Colin Bartlett Colin Bartlett Get the Newsletter Enter your email for weekly Vim tips: [ ] [Subscribe] Search the Archives [ ] Our Books * Git Better with Vim Git Better with Vim Recent Vim Tips * 50 Useful Vim Commands * Open URL in Vim * Vim Jump List * Vim Code Folding Widgets Top Rated Vim Tips 4.9 (53) Interactive replace across files 4.8 (95) Vim Find Next 4.8 (32) Toggle Vim boolean options 4.8 (60) Insert mode edit mappings 4.8 (64) Open splits more naturally Vim Tips by Tag alignment args autocommands autocomplete books buffers case checkbox checkboxes commands courses csv ebooks filter folding fugitive git html indenting insert interface mappings markdown motions native navigation netrw notes patterns plugin plugins quickfix regex registers replace search shell splits substitution text-objects unimpaired vim vimrc visual whitespace About VimTricks Colin and AndyVimTricks is published by Colin Bartlett and Andy Libby, two Vim enthusiasts and software developers with more than 40 years combined experience with Vim. Have a Vim tip? Email us! [email protected] Links * * * Copyright (c) 2022 Nimble Industries, Inc. Click to Copy