|
|
#1 |
|
Triple-A Player
Join Date: Mar 2002
Location: Denver, CO
Posts: 63
|
Hey all,
I'm having trouble getting vim's syntax highlighting to use ANSI colors in Terminal.app. I never had a problem with it before reinstalling my System last week, but now I can't get it to work with 6.0 (standalone install from osxgnu.org and fink version) or 6.1 (via fink). Is there a setting that I'm missing in my .vimrc? I'm just using the standard one (/sw/share/vim/vim61/vimrc_example.vim). I know it's not a problem with my Terminal settings because both lsc and bash have no problem with using colors. Any help would be great. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
In your vimrc file do you have
:syntax enable or for the GUI version, check in the gvimrc file. Cheers... |
|
|
|
|
|
#3 | |||||||||||||||||||
|
Triple-A Player
Join Date: Mar 2002
Location: Denver, CO
Posts: 63
|
Yes. All it uses are bold and underline sequences, not color like it did before my reinstall. Trying colorscheme commands doesn't do anything, either. Is there some kind of ncurses support that I'm missing? I doubt that, since as I said, lsc and bash escape sequences work without a problem. |
|||||||||||||||||||
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
I don't know exactly what's going on with your settings, but you may want to try this suggestions from the manual :
There can be a number of reasons why you don't see colors: - Your terminal does not support colors. Vim will use bold, italic and underlined text, but this doesn't look very nice. You probably will want to try to get a terminal with colors. For Unix, I recommend the xterm from the XFree86 project: |xfree-xterm|. - Your terminal does support colors, but Vim doesn't know this. Make sure your $TERM setting is correct. For example, when using an xterm that supports colors: setenv TERM xterm-color or (depending on your shell): TERM=xterm-color; export TERM The terminal name must match the terminal you are using. or Most color xterms have only eight colors. They should work with these lines in your .vimrc: :if has("terminfo") : set t_Co=8 : set t_Sf=<Esc>[3%p1%dm : set t_Sb=<Esc>[4%p1%dm :else : set t_Co=8 : set t_Sf=<Esc>[3%dm : set t_Sb=<Esc>[4%dm :endif [<Esc> is a real escape, type CTRL-V <Esc>] You might want to put these lines in an ":if" that checks the name of your terminal, for example: :if &term =~ "xterm" put above lines here :endif Note: Do these settings BEFORE doing ":syntax on". Otherwise the colors may be wrong. Hope this helps. Let me know. PS: What happens when you use Vim GUI and from the menu you select file and then color scheme? Cheers... |
|
|
|
|
|
#5 | |||||||||||||||||||
|
Triple-A Player
Join Date: Mar 2002
Location: Denver, CO
Posts: 63
|
Thanks. Adding those lines to my .vimrc took care of the problem without having to muck around with the TERM variable. I did specify initially that I was using Terminal.app. |
|||||||||||||||||||
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
Glad it worked.
Cheers... Last edited by sao; 04-29-2002 at 10:58 PM. |
|
|
|
|
|
#7 |
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
t_Co
I just put the following line in my .vimrc
let &t_Co = 8 Without any tests or anything. Should I ever use a terminal that doesn't support eight colors (like using my Palm device or some such) I only need execute :let &t_Co = 2 from within vim.
__________________
/PEZ |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
osxpez,
Yes, let &t_Co = 8 works very fine. Well, yours is short, mine is long. ![]() Thanks. Cheers... |
|
|
|
|
|
#9 |
|
Triple-A Player
Join Date: Mar 2002
Location: Denver, CO
Posts: 63
|
I just upgraded to a newer iBook, so I had to go through all of this again.
let &t_Co = 8 doesn't work by itself, but sao's solution worked just fine, just as it did before. Just thought I'd report back on the issue. Chad |
|
|
|
![]() |
|
|