Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-09-2004, 05:21 PM   #1
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Rep: Reputation: 30
Question vim php color coding?


im wondering how i can get vim to color code php files

any suggestions?

Old 04-09-2004, 07:05 PM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
My version of vim already does this... perhaps all you need to do is tell it to apply color-coding? Check out the help system in vim (type ":help syntax" once you're in vim)
Old 04-09-2004, 08:58 PM   #3
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Original Poster
Rep: Reputation: 30

thanks i just typed in :syntax on

one more question:

how can i change the default color scheme?

Old 04-09-2004, 11:13 PM   #4
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
I think you'd need to edit /usr/share/vim/<vim_version>/syntax/php.vim (or similar path)
The colors are listed at the end of the file.

Also you can permanently set syntax on in /etc/vimrc or ~/.vimrc
Old 04-11-2004, 06:56 AM   #5
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
In addition to what mik suggested, you can also create a directory called ~/.vim and under that directory create directories for colors, syntax and plugins. Copy the files you want to change to the hierarchy you created under your home directory as these will be used instead of the global ones in /usr/share/vim, if they are present.

Also, settings are stored in ~/.vimrc and ~/.gvimrc (for the GUI version). I usually have all my general settings in ~/.vimrc and call it from my ~/.gvimrc so the settings are the same for both versions of vim. The things I define in my .gvimrc are only GUI-related. For reference, here is my ~/.gvimrc:
" Get the .vimrc settings
so ~/.vimrc
" Set color scheme
colo buttercream
"This is the XFT version of font names, if you have an old GTK 1.x version you
"+ need to use regular XFree86 font  names
set guifont=ProFontWindows\ 9
...and here is my .vimrc:
" Map Ctrl+N to (temporarily)  disable search highlighting
nmap <silent> <C-N> :silent noh<CR>
" Get rid of annoying errors when you do simple typos
map :W :w
map :Q :q

" Settings...
set softtabstop=4
set shiftwidth=4
set cindent
set ignorecase
set showmatch
set title
set showmode
set ttyfast
set wildchar=<TAB>

" Set the make program to the java compiler so you can compile
" and jump between errors inside vim
set makeprg=javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#

" Gentoo-portage specific stuff
if (getcwd() =~ 'gentoo-x86\|gentoo-src\|portage')
  set tabstop=4 shiftwidth=4 noexpandtab



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
VIM Color Syntax Highliting bsg Linux - Newbie 5 10-07-2005 09:31 PM
Yast/You Color coding linda SUSE / openSUSE 1 08-22-2005 07:07 PM
vim color highlighting new_user10 Programming 9 11-02-2003 01:40 PM
Color Coded Vim podollb Linux - Software 5 10-16-2003 05:52 PM
Shell and file/directory color coding? l0f33t Linux - General 9 08-07-2003 11:19 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration