Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
I'm looking to enable color syntax highlighting in vi. I just enabled colors in Terminal via here. Any ideas on how to enable this?
NOTE: Usually on Linux when I open vi with
vi file.txt and it opens in black and white on default, I can open the same file with
vim file.txt and it will show the colors, but this does not work here.
asked Mar 29, 2012 at 15:28
25311 gold badge22 silver badges55 bronze badges
It’s a matter of having the right settings in your
~/.vimrc file. Here’s mine: https://github.com/mathiasbynens/dotfiles/blob/master/.vimrc.
The key is to add this:
" Enable syntax highlighting
You can install color schemes in your
~/.vim/colors directory. To enable a colorscheme, use:
" Select a colorscheme
answered Mar 29, 2012 at 16:14
Mathias BynensMathias Bynens
11.3k1212 gold badges6464 silver badges110110 bronze badges
I'll also say that MacVim is a nice upgrade from the standard Vim that ships with OS X, but it isn't necessary. What you need is Vim configuration that adds syntax highlighting to VIM.
The fastest way to get that is with Janus -- it's a set of VIM plugins and configuration files pre-configured and ready to go. It works with Vim and MacVim.
To install it:
curl -Lo- http://bit.ly/janus-bootstrap | bash
And then follow the instructions. That calls their automatic installer. It requires Vim 7.3 or greater. You'll get an easy path to colours and plugins in Vim.
answered Mar 29, 2012 at 15:41
Ian C.Ian C.
45.3k3434 gold badges166166 silver badges236236 bronze badges
You need to customize your ~/.vimrc to enable syntax highlighting, among other things. Very simplistically, you'll want to add:
Google "vimrc" for sample vim configuration files.
answered Mar 29, 2012 at 15:39
1,13155 silver badges66 bronze badges
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged
grep, see ansi-color-codes-in-vim on SO.