Setting Up Your Vimrc on macOS

Introduction to Vimrc

Your .vimrc file is where you configure Vim settings to match your preferences. Here’s how to create and edit this file on macOS.

Using help in Vim to learn about Vimrc

  1. Open Vim: Launch Vim from your terminal or command prompt.
  2. Access Help: Type :help vimrc and press Enter. This will take you to the help section on the .vimrc file.
  3. Read and Learn: Explore the information provided to understand the purpose and usage of the .vimrc file.

Creating and Editing Your Vimrc File

  1. Open Terminal on your Mac.
  2. Create the .vimrc file if it doesn’t already exist:
    • Run touch ~/.vimrc
  3. Open the .vimrc file in Vim:
    • Run vim ~/.vimrc
  4. Insert the following basic settings to customize Vim:
set relativenumber number      " Displays line numbers
  1. Save and exit the file:
    • Press Esc, then type :wq and press Enter.