LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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, 03: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, 03:33 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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, 04: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, 04:18 PM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 64
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, 04:22 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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, 02: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, 01: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


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


All times are GMT -5. The time now is 11:05 PM.

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