Shihui Guo

Add Syntax Hightlighting & Set Indent Size in Vim (Mac)

Just tell Vim to first recognize the filetype which its opening and perform the syntax highlighting.

Open the vim configuration file

vi ~/.vimrc

Create a new file ".vimrc" if this doesn't exist. And add the following lines to the file:

filetype on
syntax on
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

Then save and quit, restart your vim, it should be working now.

The same should be working in linux as well.

点击查看评论