LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-29-2007, 09:19 AM   #1
chewmanfoo
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Rep: Reputation: 0
color highlight in VIM - howyoudothat?


Guys,

I recently installed vim on a server at work. When I edit a source code file with vim, I see various fonts (plain and bold) in various shades of grey. However, on my A2 Web Hosting shell account, when I vim a file, I see pretty colors.

What do I have to do to see pretty colors on a vim screen on my server at work? I have my bash shell showing pretty colors, so I know the problem is not with my terminal window (WRQ Reflections for Unix/Digital).

TIA,
chewy
 
Old 06-29-2007, 10:47 AM   #2
hacker supreme
Member
 
Registered: Oct 2006
Location: As far away from my username as possible
Distribution: Gentoo
Posts: 259
Blog Entries: 1

Rep: Reputation: 30
IIRC, you go into vim and type :syntax=on to enable syntax highlighting by file.

(I think... Mine just keeps telling me that "E319: Sorry, the command is not available in this version" so I can't check.)

Oh, and there should be a file in your $HOME called .vimrc (IIRC) that you can add this to, so that it's always on. /* Prays that he's got this right... */
 
Old 06-29-2007, 10:48 AM   #3
sleepyEDB
Member
 
Registered: Dec 2005
Location: /USA/MI/Detroit/home
Distribution: MEPIS, antiX, RHEL
Posts: 105

Rep: Reputation: 15
Lightbulb

When in vim, try this:

Type : to get a command line,

Type 'runtime syntax/colortest.vim' to make sure you do in fact have the ability to display color from the server. (I know you said it did, but just to be sure! )



If the above worked, try editing the .vimrc file in your home directory to include the following lines:
Code:
" Set syntax highlighting to always on
syntax enable

" Set the background to dark and the colorscheme to murphy
set background=dark
colorscheme murphy

" Set automatic filetype detection to on
filetype on
That should at least get you some color. You certainly don't have to keep the murphy colorscheme...I just included that bit so you'd have a color scheme to start with.

To see all available colorschemes, see this page:
http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-pl.html

I will warn you that the page may take a long time to load on a slow connection since there are almost 300 pictures showing the various colorscheme/background combos!


sleepy

Last edited by sleepyEDB; 06-29-2007 at 11:51 AM.
 
Old 06-29-2007, 11:29 AM   #4
slackhack
Senior Member
 
Registered: Jun 2004
Distribution: Arch, Debian, Slack
Posts: 1,016

Rep: Reputation: 46
i'm okay with my colorscheme, but i was just trying this out of curiosity, and i get this error message:

Code:
jeff@bart:~ $ vim .vimrc
Error detected while processing /home/jeff/.vimrc:
line    6:
E518: Unknown option: colorscheme 
Press ENTER or type command to continue
it works when i issue the command from within vim, though. any idea what might be wrong?
 
Old 06-29-2007, 11:48 AM   #5
sleepyEDB
Member
 
Registered: Dec 2005
Location: /USA/MI/Detroit/home
Distribution: MEPIS, antiX, RHEL
Posts: 105

Rep: Reputation: 15
Red face

slackhack -

Thanks for catching that. I mistakenly put the 'set' in front of 'colorscheme' in my code above. I have since removed the 'set'...the correct option in your .vimrc should be:

Code:
colorscheme murphy
Sorry for the mistake!



sleepy
 
Old 06-29-2007, 05:53 PM   #6
chewmanfoo
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
doesn't work for me

After I corrected that "set colorscheme" defect, I start vi on an html file, and I see a lot of formatting, but no color. It's underlining angle brackets and changing the weight of the font for paragraph, title etc. elements in the html, but its not showing it in color.

What gives?
chewy
 
Old 06-29-2007, 05:59 PM   #7
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
Quote:
Originally Posted by chewmanfoo
What do I have to do to see pretty colors on a vim screen on my server at work? I have my bash shell showing pretty colors, so I know the problem is not with my terminal window (WRQ Reflections for Unix/Digital).
Although your terminal window might be capable of displaying text in colors, it still has to tell vim that it can. For example, different term windows (xterm vs rxvt) may have slightly different color capabilities. Within vim, do ":h color-xterm" and see if one of the settings in there will work.
 
Old 07-02-2007, 09:23 AM   #8
chewmanfoo
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
That worked!

I had my TERM set to linux or vt220, both of which did not work for color syntax in vim. But xterm did. Thanks for the help!
 
  


Reply

Tags
colors, customization, terminal, vim


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
text highlight color in openoffice mcd Linux - Software 4 07-28-2010 07:50 PM
highlight matching brackets in vim muddywaters Programming 5 06-26-2006 09:43 AM
vim region highlight problem? Chowroc Linux - Software 2 02-17-2006 07:57 AM
How to make own highlight scheme in vim? kornerr Linux - General 2 01-04-2006 09:39 PM
Turning off terminal color highlight penguinco Fedora 1 12-08-2004 12:25 PM


All times are GMT -5. The time now is 12:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration