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 |
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. |
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:Pengy: |
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 |
Try:
export TERM=xterm-color vim or TERM=xterm-color vim Put it in your ~/.bashrc file if it works. |
Thanks, but it didn't work.
-RoNNY |
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 :) |
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 |
Can you exactly point out which two lines are to be commented out and of which file?
thanks |
All times are GMT -5. The time now is 04:04 AM. |