Background about ~/vimrc file
In order to apply color schemes to VIM you would need to update the .vimrc file which is a configuration file that is read when Vim starts up. Using this file you can customize Vim's behavior and settings to suit your preferences. The file is a plain text file that you will find under the home directory.
Steps: Setting Custom Color Schema (Syntax Highlighting)
- Open Terminal/Bash Console.
- Type the below command to open the .vimrc file.
vim ~/.vimrc
- Now add the following line at the end of the file (if the file is blank at the beginning)
syntax on
colorscheme <color-scheme-name>Some of the colorschemes available by default to choose from:
- Make sure to save and quit the file using :wq
- Now when you will open VIM again you will see the color scheme has been applied.

As you would see in the below example, we created a file Hello.java and as we type the code and syntax get highlighted in colors based on the keyword and string.

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to vi,
- Guide: Install Vim on Mac
- How to Uninstall Vim on Mac?
- How to update VIM version on a Mac
- How to Copy all text to Clipboard in Vim
- How to Select All Text in Vim/Vi editor
- How to perform Find and Replace using vim Editor
- Fix :wq! Vi Error - E32: No file name (when write and quit)
- How to add Colors to VIM (syntax highlighting)
More Posts:
- How to install Python 3.9 using brew on Mac - Python
- Fix: Windows 10/11 Update Install Error - 0x80070103 - Windows
- How to create Jira API Token for Atlassian Account to connect Jira Cloud REST API - Jira
- Java SE JDBC Select Statement Example - Java
- Where is .zshrc file located in macOS - MacOS
- Align html element at the center of page vertically and horizontally - Html
- How to detect Browser and Operating System Name and Version using JavaScript - JavaScript
- How to Concatenate Strings in Bash Scripting - Bash