LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-29-2005, 12:07 PM   #1
darknails
Member
 
Registered: Jul 2004
Location: Germany
Distribution: Debian
Posts: 46

Rep: Reputation: 15
vim syntax highlight fails after debian upgrade


Hi,
there is no syntax highlight after I upgraded my debian, and I'm not
sure what the problem is. This is my .vimrc file

Code:
"Tabspacing
set tabstop=4
set shiftwidth=4

"Syntax highling
syntax on
can anyone tell me what's wrong?

thanks
 
Old 10-29-2005, 12:28 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Try manually, just for testing. Fire up vim and type:

ESC : syntax on

if that works, then most likely vim is reading the wrong file.
 
Old 10-29-2005, 12:34 PM   #3
darknails
Member
 
Registered: Jul 2004
Location: Germany
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
Hi,

thanks for your help. I did as you said and got the following message:

Error detected while processing /usr/share/vim/vim64/syntax/syntax.vim:
line 42:
E216: No such group or event: filetypedetect BufRead


any ideas?
 
Old 10-29-2005, 12:49 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Hmmm, that's a complicated thing. I think that vim was upgraded when you upgraded Debian, but that file was not created or something odd happened. As root, do:

mv /usr/share/vim/vim64/syntax/syntax.vim /usr/share/vim/vim64/syntax/syntax.vim_old

then, change into that directory:

cd /usr/share/vim/vim64/syntax/

Start a new file with vim (or maybe another text editor for now) called syntax.vim and paste the following:

Code:
if !has("syntax")
  finish
endif

" If Syntax highlighting appears to be on already, turn it off first, so that
" any leftovers are cleared.
if exists("syntax_on") || exists("syntax_manual")
  so <sfile>:p:h/nosyntax.vim
endif

" Load the Syntax autocommands and set the default methods for highlighting.
runtime syntax/synload.vim

" Load the FileType autocommands if not done yet.
if exists("did_load_filetypes")
  let s:did_ft = 1
else
  filetype on
  let s:did_ft = 0
endif

" Set up the connection between FileType and Syntax autocommands.
" This makes the syntax automatically set when the file type is detected.
augroup syntaxset
  au! FileType *	exe "set syntax=" . expand("<amatch>")
augroup END


" Execute the syntax autocommands for the each buffer.
" If the filetype wasn't detected yet, do that now.
" Always do the syntaxset autocommands, for buffers where the 'filetype'
" already was set manually (e.g., help buffers).
doautoall syntaxset FileType
if !s:did_ft
  doautoall filetypedetect BufRead
endif
Save the file, restart/start vim. I'm using vim 6.3, but it should work for you. If you don't have that folder, create it with mkdir ;)

Let me know if it works.

Regards!

Last edited by Mega Man X; 10-29-2005 at 12:51 PM.
 
Old 11-03-2005, 12:19 PM   #5
knowshun
LQ Newbie
 
Registered: Nov 2005
Distribution: Debian
Posts: 1

Rep: Reputation: 0
There is likely a problem with your /etc/vim/vimrc

check to make sure that your set runtimepath looks something like this:

set runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim64,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after

Notice how it is vim64, not vim63 anymore? It is looking for files in the wrong directory. Just change the 3 to a 4 and you are set.

I had exactly the same problem and that is how I solved it.

have a good day,
 
Old 11-16-2005, 05:45 PM   #6
Tiago Cruz
Member
 
Registered: Jan 2003
Location: Brasil - São Paulo
Distribution: RHEL, SuSE, *BSD, Debian
Posts: 36

Rep: Reputation: 15
Very thanks knowshun, this resolve my problem!
 
Old 12-09-2005, 05:31 AM   #7
darknails
Member
 
Registered: Jul 2004
Location: Germany
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
Thanks so much! It works now!
 
Old 05-19-2009, 04:11 AM   #8
rossey
LQ Newbie
 
Registered: Oct 2007
Posts: 1

Rep: Reputation: Disabled
This was the problem with vim on recently upgraded etch boxes (from sarge)

The only difference being, vim is now at 70:

Quote:
Originally Posted by knowshun View Post
set runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim64,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after
becomes:
Code:
set runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim70,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after
I found the vim version:
Code:
09:04 rossey@somebox ~ $ ls -l /usr/share/vim/
total 12
drwxr-xr-x  4 root root 4096 Sep  4  2008 addons
drwxr-xr-x  2 root root 4096 Apr 27 10:26 registry
drwxr-xr-x 17 root root 4096 Apr 27 10:26 vim70
lrwxrwxrwx  1 root root    5 Sep  4  2008 vimcurrent -> vim70
lrwxrwxrwx  1 root root    8 Sep  4  2008 vimfiles -> /etc/vim
lrwxrwxrwx  1 root root   14 Apr 27 10:26 vimrc -> /etc/vim/vimrc
lrwxrwxrwx  1 root root   19 Apr 27 10:26 vimrc.tiny -> /etc/vim/vimrc.tiny
You could of course point runtimepath to vimcurrent to prevent any future problems, that relying on the symlink changing with the version!
 
  


Reply



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
Emacs Syntax highlight UltraSoul Linux - Software 1 07-11-2005 09:19 AM
vim syntax highlighting MiniMe001 Linux - General 2 06-19-2005 11:08 AM
xterm under GNOME not syntax-highlight. yangsongx Slackware 3 03-24-2005 07:49 AM
Java syntax highlighting in vim Phantomas Linux - Software 0 08-16-2003 04:34 AM
Vim syntax highlighting NSKL Linux - Software 2 11-09-2002 02:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:09 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration