Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
I've been broken down, after hearing what must be hundreds of people constantly recommend learning Vi I decided to give it a shot. But I can't work out how to enable syntax highlighting, I have the relevant syntax file for C and have put it in ~/.vim/syntax/c.vim but nothing works.

Any advice? Also if anyone has any cool tips for setting Vi up on Mac OS X to work well as a programming tool (configuration options etc) they would be appreciated :).
 

ChOas

macrumors regular
Nov 24, 2006
139
0
The Netherlands
Any advice? Also if anyone has any cool tips for setting Vi up on Mac OS X to work well as a programming tool (configuration options etc) they would be appreciated :).

For me it's just syn on in vim.

(so ESC,colon,'syn on' :) )

another option is putting syntax on in ~/.vimrc

my ~/.vimrc:

Code:
xxx $ cat ~/.vimrc
syntax on
colorscheme evening
xxx $
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
Why don't you try using MacVim? Vi with an OS X native GUI, and it enables syntax highlighting by default.

Because I need to work with an OpenBSD system as well. So I need to learn how to use the basic version of Vi included with all Unix like operating systems.

Edit: Huzzah, got it working. I had to download the source distribution and copy all the relevant files into the syntax directory. Now I have highlighting for any number of languages that I will never know :).
 

mslide

macrumors 6502a
Sep 17, 2007
707
2
Because I need to work with an OpenBSD system as well. So I need to learn how to use the basic version of Vi included with all Unix like operating systems.

If you really want to use the traditional vi, instead of something like vim, then you won't have multiple undoes or syntax highlighting. I could be wrong, but I'm pretty sure the traditional vi doesn't support that stuff. In fact, I think the traditional vi doesn't support split windows either.

The point is that most unix systems, including osx, actually ship with vim and not the traditional vi. So you might not want to bother worrying about things that are only supported in one vs the other. Many websites that teach you how to use "vi" actually mean "vim".

I second John Jacob's MacVim comment, if you also want the option of vim with a gui. It's nice to have so you can setup file associations so that it will fire up macvim, instead of xcode, when you double-click on a file... if you prefer that anyway.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.