LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-17-2006, 09:18 AM   #1
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 168

Rep: Reputation: 30
vim colors


In the past when I use vi to edit a file, I get a nice colored view. That was on Redhat install.

But with my new FC4 install, vi just gives me a plain white text on a black background.

Also, I used to get line numbers (e.g. 72/438) to show me where I am in the file. But I don't get that anymore.

How do I get vim to show colors?

BTW, I connect to my remote machine via ssh using putty on my Windoze machine.

Here is what I mean:

http://www.oasisoflove.com/images/viB.gif
http://www.oasisoflove.com/images/viA.gif

Thanks.
 
Old 06-17-2006, 10:50 AM   #2
mcmillan
Member
 
Registered: Jul 2005
Distribution: Arch
Posts: 489

Rep: Reputation: 30
For showing the colors, that's an entry in /etc/vimrc. The relevant lines on my arch system are:

Code:
" 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
You can probably remove the line about the highlighting if you don't want that.

Don't know about the line numbers, I have that but I didn't see anything in my file that looked like it was telling it to display.
 
Old 06-17-2006, 10:50 AM   #3
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
this may be the same or may not be I am not sure cause I never did this on a Fedora box before, but long and short of it, on my slackbox what I did is copied the file /usr/share/vim/vim63/vimrc_example.vim into my home directory as the file .vimrc, so the full path being, /home/myuser/.vimrc , in turn meaning the command I used would have been :
Code:
cp /usr/share/vim/vim63/vimrc_example.vim /home/myuser/.vimrc
Now, I don't know if the vim folder is going to be in /usr/share on a Fedora machine, but at least this will point you in the right direction.

Also I am an only user on my system, so that's why its in my home folder, this can also be set globally.
 
Old 06-17-2006, 12:06 PM   #4
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 168

Original Poster
Rep: Reputation: 30
Thanks for your responses.

Here is the sytax highlighting part of /etc/vimrc

" 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

I tried
cp /usr/share/vim/vim63/vimrc_example.vim /home/myuser/.vimrc
That worked when I'm logged in as myuser.

However it doesn't work when I'm working as root.

Where do I need to copy it to for root? I copied to /root, no luck.

Thanks.
 
Old 06-17-2006, 02:33 PM   #5
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
It works fine for me after copying it to /root.
 
Old 07-02-2006, 11:49 PM   #6
Jastiv
LQ Newbie
 
Registered: Apr 2006
Posts: 1

Rep: Reputation: 0
Emacs won't show me colors in Fedora Core 5

I have the same problem, except this time it is fedora core 5 and the text editor is emacs.
I do not know what I am supposed to change around.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
having colors in C programming with vim Samoth Suse/Novell 3 04-27-2006 09:59 AM
what controls colors in vi/vim? pfaendtner Linux - Software 3 03-24-2005 05:51 PM
how to get colors in emacs and vim pranith Linux - Newbie 1 02-11-2005 12:35 AM
regarding colors in vim and emacs pranith Linux - Newbie 0 02-10-2005 03:10 AM
vim colors Erik Thorsson Debian 1 02-09-2005 09:38 AM


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