mac terminal 里的颜色要使用 ctermfg 和 ctermbg ,(guifg guibg 都是无效的)
颜色值 只有部分 颜色名称 和 0-255 数字有效
颜色从这里选
https://jonasjacek.github.io/colors/
256 种颜色部分截图
.vimrc 配置代码
" vim comments start with " " Turn on syntax highlighting. syntax on " Show line numbers. set numnr " Show status bar set laststatus=2 set statusline= set statusline+=%0*\[%n] "buffernr set statusline+=%1*\ %<%F\ "File+path set statusline+=%2*\ %y\ "FileType set statusline+=%3*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding set statusline+=%3*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2 set statusline+=%4*\ %{&ff}\ "FileFormat (dos/unix..) set statusline+=%5*\ %{&spelllang}\%{HighlightSearch()}\ "Spellanguage & Highlight on? set statusline+=%6*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%) set statusline+=%7*\ col:%03c\ "Colnr set statusline+=%8*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot. function! HighlightSearch() if &hls return 'H' else return '' endif endfunction hi User0 ctermfg=white ctermbg=160 " Red3 hi User1 ctermfg=white ctermbg=160 " Red3 hi User2 ctermfg=white ctermbg=161 hi User3 ctermfg=white ctermbg=162 hi User4 ctermfg=white ctermbg=163 hi User5 ctermfg=white ctermbg=164 hi User6 ctermfg=white ctermbg=168
效果: