Skip to content

Instantly share code, notes, and snippets.

@farid-mkh
Last active December 23, 2022 19:55
Show Gist options
  • Select an option

  • Save farid-mkh/e5a5fa9bfb17a56a2d5e2068f0600b8c to your computer and use it in GitHub Desktop.

Select an option

Save farid-mkh/e5a5fa9bfb17a56a2d5e2068f0600b8c to your computer and use it in GitHub Desktop.
vim cheat sheet

vim commands

  1. Open a new or existing file with vim FILE_NAME.
  2. Type i to switch into insert mode so that you can start editing the file. press Esc To get out of insert mode and back to command mode.
  3. :wq - To save and exit your file.
  4. :q! - Quit without first saving the file you were working on
  5. :w - To save file
  6. :e FILE_NAME - open and edit FILE_NAME
  7. /[keyword] - Searches for text in the document where keyword is whatever keyword, phrase or string of characters you're looking for
  8. ?[keyword] - Searches previous text for your keyword, phrase or character string
  9. :%s/[pattern]/[replacement]/g - This replaces all occurrences of a pattern without confirming each one
  10. :%s/[pattern]/[replacement]/gc - Replaces all occurrences of a pattern and confirms each one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment