Search code examples
macosvimmacos-sierramacos-high-sierra

How do I edit Vim's color scheme for better Syntax highlighting in Mac OS X Sierra/High Sierra?


I realize syntax highlighting is not enabled when editing files in vim by default. How do I activate it?


Solution

  • Here's how to install syntax coloring in vim for Mac OS X Sierra/High Sierra:

    1. Download a vim color scheme:

    You can download one here: https://github.com/flazz/vim-colorschemes

    2. Move color scheme into the colors directory inside your local .vim directory. (Create one if one does not exist.)

    (Assuming scheme is in local Downloads folder) mv ~/Downloads/molokai.vim ~/.vim/colors/

    Create the colors and ~/.vim directories if they do not exist: mkdir -p ~/.vim/colors/

    3. Set syntax coloring in Mac OS X Sierra/High Sierra:

    Run the following command in Terminal: set term=builtin_ansi

    4. Update/Create local .vimrc file:

    vim ~/.vimrc

    Your .vimrc file should look similar to the following:

    syntax on
    colo molokai
    

    5. Restart terminal