2020.03.31 – Using vim command in Terminal in MacBook Pro

How edit files into vim:

  • -> ls and press Enter to list the contents of a particular directory
  • -> cd .. or cd filename(s) and press Enter to change to another directory (as in DOS)
  • -> sudo – to authenticate yourself a superuser to gain extra security privileges
  • -> vim filename to open a file in vim
  • -> i key to start editing the file
  • -> press Esc key then type :w and hit Enter key to save a file in Vim
  • -> press Esc key then type 😡 and hit Enter key to save a file and quit Vim
  • -> pressing the Esc key (pressing the Esc key again does nothing if you’re already in command mode)
  • -> :wq and press Enter to write the file to disk and quit vim
  • -> :w and press Enter to write the file to disk without quitting
  • -> :q and press Enter to quit vim without saving the file
  • -> :q! and presa Enter to exit a file opened with read-only

Example:

sudo vim /Library/Preferences/VMware\ Fusion/networking

I will update when I need and lear different things about vim.