PDA

View Full Version : Vi/Vim colors



Hoffmann
May 30th, 2006, 10:22 PM
How can I set colors on Vi and/or Vim editors?
All I have is just black color letters on those editors.

linuchsan
May 30th, 2006, 10:45 PM
create a file .vimrc in you homedir, and add the line syntax enable

Hoffmann
May 31st, 2006, 05:37 AM
create a file .vimrc in you homedir, and add the line syntax enable
Thanks a lot! ;)

Zdravko
May 31st, 2006, 07:39 AM
Or you can use Cream - it wraps Vim interface adding several coloring themes.

simplyw00x
May 31st, 2006, 12:22 PM
If you put the line:

map <F4> :syntax enable<CR>
in .vimrc instead then you can turn it on manually by hitting F4 - useful to not have it on by default for some files.

kthuno
June 7th, 2006, 05:37 PM
If you put the line:

map <F4> :syntax enable<CR>
in .vimrc instead then you can turn it on manually by hitting F4 - useful to not have it on by default for some files.

Great tip! Thanks

DirtDawg
June 8th, 2006, 02:40 AM
Or you can use Cream - it wraps Vim interface adding several coloring themes.

Cream rulez.

seelk
June 14th, 2006, 01:00 AM
Great tip! Thanks
How can you make it a toggle?

simplyw00x
June 14th, 2006, 04:13 PM
map <F4> :syntax!<CR>
or

map <F4> :invsyntax<CR>

ynef
June 15th, 2006, 07:01 AM
I don't know how often you guys edit source files you don't want syntax highlighting for (so I don't understand the usefulness of a toggle for it) -- if you're more like me, you'll want it for certain files. Here's how to just enable it for C and C++ files:



autocmd Filetype c,cpp,h,hpp call ProgrammingMode()

function! ProgrammingMode()
syntax enable
endfunction


You can add more useful commands in the "ProgrammingMode()" function, for instance related to folding and what ":make" should do, etc.

SuperTeece
September 29th, 2006, 02:57 AM
First off, I appologize if I'm breaking a rule by bringing up an old thread, but I have a question.

I have followed the steps in this thread and have strange results. My .vimrc and .exrc now show colors, a few scripts that were already written show colors, but nothing new I write is showing up in color.

When I first used VIM in an older Redhat distro the syntax would automatically change to the approriate color once the syntax was complete. Are the steps in this thread what I am even looking for to duplicate this feature?

Thanks

TC

boban
October 3rd, 2006, 09:59 AM
I have followed the steps in this thread and have strange results. My .vimrc and .exrc now show colors, a few scripts that were already written show colors, but nothing new I write is showing up in color.

When I first used VIM in an older Redhat distro the syntax would automatically change to the approriate color once the syntax was complete. Are the steps in this thread what I am even looking for to duplicate this feature?
TC

Have you tried saving the file and reloading it (:w :e)?