Vim Tips Wiki
Koanium (talk | contribs)
m (Changed category Mac OS X → macOS)
Tag: Source edit
 
(14 intermediate revisions by 11 users not shown)
Line 8: Line 8:
 
|version=6.0
 
|version=6.0
 
|rating=153/70
 
|rating=153/70
|category1=Mac OS X
+
|category1=macOS
 
|category2=Syntax
 
|category2=Syntax
 
}}
 
}}
Line 27: Line 27:
 
</pre>
 
</pre>
   
Others (on "Mountain Lion") reported success with this instead:
+
Others (on "Mountain Lion" and "Sierra") reported success with this instead:
   
 
<pre>
 
<pre>
 
set term=builtin_ansi
 
set term=builtin_ansi
  +
</pre>When using iTerm 2, you can simply do:
</pre>
 
  +
set term=xterm-256color
   
 
==Comments==
 
==Comments==
set term=builtin_ansi Worked like a charm on OS X 10.9 Mavericks, Thanks.
+
The following worked great on OSX 10.10.3 Yosemite, and OSX 10.12.4 Sierra. I tested it with .py, .html and .php. Thanks!<blockquote>filetype plugin indent on</blockquote><blockquote>syntax on</blockquote>set term=builtin_ansi Worked like a charm on OS X 10.9 Mavericks, Thanks.
  +
  +
set term=xterm also works on OS X 10.9 Mavericks
  +
  +
<span>set term=builtin_beos-ansi worked like a charm in OS X 1</span>0.10.3 Yosemite. Thanks!
  +
  +
Disclaimer: Under 10.9 Mavericks with an external keyboard, term=builtin_ansi may make the delete key next to the end key change the character under the cursor rather than delete as expected. term=xterm has this key behave as expected.
  +
  +
[http://dinvim.com DinVim is a vim for Mac OS] that supports syntax coloring out of the box.

Latest revision as of 14:46, 20 July 2022

Tip 283 Printable Monobook Previous Next

created July 11, 2002 · complexity basic · author Mario Martinez · version 6.0


Some versions of Mac OS X don't have syntax highlighting support in terminal Vim with default settings.

If you don't have syntax highlighting in any Vim, first make sure something like this is in your .vimrc:

filetype plugin indent on
syntax on

If you have that, and still don't get syntax highlighting in Vim running in a terminal (i.e. not a GUI like MacVim), you may need to inform Vim how to handle the terminal.

Something like this is needed, prior to the syntax on command in your .vimrc:

set term=builtin_beos-ansi

Others (on "Mountain Lion" and "Sierra") reported success with this instead:

set term=builtin_ansi

When using iTerm 2, you can simply do:

set term=xterm-256color

Comments[]

The following worked great on OSX 10.10.3 Yosemite, and OSX 10.12.4 Sierra. I tested it with .py, .html and .php. Thanks!

filetype plugin indent on

syntax on

set term=builtin_ansi Worked like a charm on OS X 10.9 Mavericks, Thanks.

set term=xterm also works on OS X 10.9 Mavericks

set term=builtin_beos-ansi worked like a charm in OS X 10.10.3 Yosemite. Thanks!

Disclaimer: Under 10.9 Mavericks with an external keyboard, term=builtin_ansi may make the delete key next to the end key change the character under the cursor rather than delete as expected. term=xterm has this key behave as expected.

DinVim is a vim for Mac OS that supports syntax coloring out of the box.