LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   vim colors (https://www.linuxquestions.org/questions/linux-general-1/vim-colors-455658/)

fw12 06-17-2006 09:18 AM

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.

mcmillan 06-17-2006 10:50 AM

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.

DrOzz 06-17-2006 10:50 AM

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.

fw12 06-17-2006 12:06 PM

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.

reddazz 06-17-2006 02:33 PM

It works fine for me after copying it to /root.

Jastiv 07-02-2006 11:49 PM

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.


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