Code Editors: Vim

Useful References

Useful Commands

Start vim

vi my_file.txt

Quit vim

First press the escape key, then press…

:q          # quits
:q!         # quit and discard any edits
:qw         # quits and saves all changes

Edit a file

  • Press the i key to put into edit mode.
  • Edits as you like.
  • Press the Escape key to get out of edit mode.
  • Press :w to save your changes

Delete a line

  • use the cursor to navigate to the line you want to delete
  • press dd (two “ds” in a row)

UNC Asheville Department of Computer Science