LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-13-2004, 02:15 PM   #1
prkn8tr
LQ Newbie
 
Registered: Mar 2004
Location: Phoenix, AZ
Distribution: Mandrake 9.2
Posts: 14

Rep: Reputation: 0
vi colors


how do i get vi to show colors if i'm writting in java, c++, etc???


mandrake 9.2 kde 3.1
 
Old 03-13-2004, 02:33 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
If you are running vi: you cannot use colors. I guess your vi is linked to vim. If you are not sure, start vi without any files ($ vi <enter>), it should give you info about vim.

If you have vim, check the following dir:
/usr/share/vim/vim61/colors (the 61 could be different)
Especially the README.txt file.

You can also start vi and in command mode type:

:help color

Hope this helps.
 
Old 03-13-2004, 03:09 PM   #3
prkn8tr
LQ Newbie
 
Registered: Mar 2004
Location: Phoenix, AZ
Distribution: Mandrake 9.2
Posts: 14

Original Poster
Rep: Reputation: 0
how do i get vim to do that then...maybe i was confused about the difference between them
 
Old 03-13-2004, 03:18 PM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally posted by prkn8tr
how do i get vim to do that then...maybe i was confused about the difference between them

Edit /etc/vim/vimrc and uncomment the syntax on for system wide or for your own use create a ~/.vimrc and put syntax on in the file.
 
Old 03-13-2004, 03:22 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
These two files areread when vi starts:

/etc/vimrc
and
~/.vimrc

The first one can be used for global settings, the second is user specific.

Something like this could do what you want (colorized highlighting based on file you are editing):

" Vim syntax support file
so /usr/share/vim/vim61/syntax/syntax.vim

" Is gui running
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

" Determine terminal type
let term=$TERM

if term != "linux"
" Set colors for none linux (console) term
hi Comment ctermfg=DarkBlue guifg=Blue
hi Statement ctermfg=DarkRed guifg=Brown
hi Identifier ctermfg=Blue guifg=DarkCyan
hi PreProc ctermfg=Magenta guifg=Purple
hi Constant ctermfg=Black guifg=Magenta
hi Special ctermfg=DarkMagenta guifg=SlateBlue
hi Type ctermfg=DarkCyan guifg=SeaGreen
hi Ignore ctermfg=Gray guifg=bg
endif


This will set highlighting and syntax support, which will probably enough in your case.

I did not like the default colors in my (x)term, which has a light background, so I set some of them according to my likings. Again, you might not need this, it's there to give you an idea and to 'play with'.

Check to see if the syntax support file points to the correct directory.

With : help <command> you can get some more info about the above commands.
 
Old 05-13-2004, 01:38 PM   #6
nixel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Slackware 9.1
Posts: 71

Rep: Reputation: 15
Quote:
Originally posted by druuna
These two files areread when vi starts:

/etc/vimrc
and
~/.vimrc

The first one can be used for global settings, the second is user specific.

Something like this could do what you want (colorized highlighting based on file you are editing):

" Vim syntax support file
so /usr/share/vim/vim61/syntax/syntax.vim

" Is gui running
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

" Determine terminal type
let term=$TERM

if term != "linux"
" Set colors for none linux (console) term
hi Comment ctermfg=DarkBlue guifg=Blue
hi Statement ctermfg=DarkRed guifg=Brown
hi Identifier ctermfg=Blue guifg=DarkCyan
hi PreProc ctermfg=Magenta guifg=Purple
hi Constant ctermfg=Black guifg=Magenta
hi Special ctermfg=DarkMagenta guifg=SlateBlue
hi Type ctermfg=DarkCyan guifg=SeaGreen
hi Ignore ctermfg=Gray guifg=bg
endif


This will set highlighting and syntax support, which will probably enough in your case.

I did not like the default colors in my (x)term, which has a light background, so I set some of them according to my likings. Again, you might not need this, it's there to give you an idea and to 'play with'.

Check to see if the syntax support file points to the correct directory.

With : help <command> you can get some more info about the above commands.
good info..thanks..ive been searching on how to customize syntax highlighting.
 
Old 06-03-2004, 12:43 AM   #7
Dave Worth
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Rep: Reputation: 0
Worked for me as well. Thanks, druuna.
 
  


Reply

Tags
color, syntax, vi, vim



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
colors? kaens DamnSmallLinux 5 02-10-2005 02:34 AM
colors devit Slackware 1 03-12-2004 07:44 AM
colors? there is no god Linux - Newbie 3 08-18-2003 08:04 PM
Colors jeremy LQ Suggestions & Feedback 4 06-26-2003 04:27 AM
colors Vlackmar Linux - General 0 01-07-2002 11:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration