LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   vim syntax highlight fails after debian upgrade (https://www.linuxquestions.org/questions/linux-software-2/vim-syntax-highlight-fails-after-debian-upgrade-378073/)

darknails 10-29-2005 12:07 PM

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

Mega Man X 10-29-2005 12:28 PM

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.

darknails 10-29-2005 12:34 PM

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?

Mega Man X 10-29-2005 12:49 PM

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!

knowshun 11-03-2005 12:19 PM

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,

Tiago Cruz 11-16-2005 05:45 PM

Very thanks knowshun, this resolve my problem! :cool:

darknails 12-09-2005 05:31 AM

Thanks so much! It works now!:cool:

rossey 05-19-2009 04:11 AM

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 (Post 1934474)
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!


All times are GMT -5. The time now is 11:25 AM.