LinuxQuestions.org
Visit the LQ Articles and Editorials 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 06-15-2005, 08:17 PM   #1
RonnyNussbaum
LQ Newbie
 
Registered: Jun 2005
Posts: 17

Rep: Reputation: 0
Question VI not showing files with color


Hey everyone.
I just loaded FC4, and I noticed that when I open a file, such as /etc/inittab, it doesn't show it in color. It's just plain old gray on black.

I have some Linux experience, but never had to deal with configuring vi.

My FC3 machine has vi with colors, and it was like that ever since it was installed.

Any ideas?

Thanks

-RoNNY
 
Old 06-15-2005, 08:29 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,739

Rep: Reputation: 298Reputation: 298Reputation: 298
Edit /etc/vimrc.

Near the top of the file, look for this:

"enable syntax highlighting
syntax on
:colorscheme peachpuff (on my system)

Make certain that the syntax line is not commented out, and syntax highlighting is turned on.
For colorschemes, on SuSE, they're in two locations:
/opt/kde/share/vim/vim61/colors/peachpuff.vim and
/usr/share/vim/vim61/colors/peachpuff.vim

There should be something similar on your system.
 
Old 06-15-2005, 08:40 PM   #3
RonnyNussbaum
LQ Newbie
 
Registered: Jun 2005
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks.
This is what I have:

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

Now, I am in runlevel 3, so I *think* the above disables it...
I tried adding a " before the "if" and "endif", and it changed nothing.
Do I need to do anything to make changes in the vimrc active?

Thanks for your reply.

-RoNNY
 
Old 06-15-2005, 08:42 PM   #4
RonnyNussbaum
LQ Newbie
 
Registered: Jun 2005
Posts: 17

Original Poster
Rep: Reputation: 0
While I'm at it, here's the entire file:

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif

set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif

if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
 
Old 06-15-2005, 09:10 PM   #5
ozar
Member
 
Registered: May 2004
Location: USA
Distribution: Arch Linux
Posts: 370

Rep: Reputation: 72
Try:

export TERM=xterm-color vim

or

TERM=xterm-color vim

Put it in your ~/.bashrc file if it works.
 
Old 06-15-2005, 09:25 PM   #6
RonnyNussbaum
LQ Newbie
 
Registered: Jun 2005
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks, but it didn't work.

-RoNNY
 
Old 06-16-2005, 02:35 AM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
You may not have vi aliased to vim.
The original vi does not have colours, it's a straight monochrome editor.
however a lot of systems alias vi => vim, which is vi_improved, which does colours and a lot more.
I have this cmd at the bottom of my .bash_profile file:

# Aliases
alias vi="vim"

export vi

Try that
 
Old 06-16-2005, 08:28 PM   #8
RonnyNussbaum
LQ Newbie
 
Registered: Jun 2005
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you all.
The developers of FC4 changed the script for vi, under /etc/profile.d/ named vimrc.sh.

There are two lines that were added (lines 3 and 4). If you comment these out, you get vi aliased to vim. Go figure. Actually, I think that commenting only #4 will do the trick as well.

I personally think that there's an error in the script.
It runs the id command with the -u option, which generates a zero as a reply if you're root (root's uid is 0). It compares that number to 100, and if it's equal or less, it runs the "return" command, i.e. gets out of the script.


Very weird.


-RoNNY
 
Old 06-26-2006, 03:17 AM   #9
debulu
Member
 
Registered: May 2006
Location: India
Distribution: Redhat
Posts: 49

Rep: Reputation: 15
Can you exactly point out which two lines are to be commented out and of which file?
thanks
 
  


Reply


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
Files not showing up on desktop z9_87 Mandriva 5 05-31-2005 08:37 PM
Laptop only showing 16-bit color neatflux Linux - Newbie 1 11-01-2004 12:51 PM
PHP: changing row color showing mysql results emilioestevezz Programming 15 09-13-2004 06:27 PM
Files not showing up in vsftpd cjlee Linux - Networking 0 08-26-2003 05:15 PM
Files not showing up in mounted drive JCDenton Linux - Newbie 9 08-01-2003 11:17 PM


All times are GMT -5. The time now is 10:42 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