Can't define my own syntax for *.pts files anymore

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't define my own syntax for *.pts files anymore

Ravier, Pierre-Philippe
Hi,
 
I have a bunch of Solaris machine at work on which vim 5.3 was installed.
I used that install happily for a while, then decided to have vim 6.3
installed.
 
Now that it is done I can use vim 6.3 happily, but the syntax file I had
done for a specific file-extension of files we use here (.pts) doesn't work
anymore.
 
My .vimrc is :
==================
let mysyntaxfile = "/vimfiles/mysyntax.vim"
syntax on
set tabstop=4
set shiftwidth=4
set ic
 
set cindent shiftwidth=4
set smartindent
===================
 
 
 
/vimfiles/mysyntax.vim contains :
===================
augroup syntax
        au  BufNewFile,BufReadPost *.pts  so /vimfiles/pts.vim
augroup END
===================
 
 
 
 
/vimfiles/pts.vim contains :
===================
" Vim Syntax file for the pts files
" Language:             pts
" Maintainer:           Pierre-Philippe Ravoer
" Last Change:  Nov 03, 2003
" Version: 1
 
" Elementary keywords of the pts language
syntax keyword xKeyword PROCESS_NAME PROCESS_DIR NO_CMD_LINE_TAG
FOREGROUND_ONLY SINGLE_INSTANCE PROCESS_PARAMS ENV
highlight link xKeyword Keyword
 
" A comment
syntax match xComment /#.*/
highlight link xComment Comment
 
" A reference to a shell variable (like in shell).
syn match  xDerefSimple         "\$\w\+"
highlight link xDerefSimple Identifier
 
" An isolated number
syn match   xNumber             "-\=\<\d\+\>"
highlight link xNumber Number
 
" A pts variable declaration
syn match xVarDecl  /^\w\+\./ nextgroup=xVarProcessName
syn match xVarProcessName /\w\+\./ contained
highlight link xVarDecl Tag
highlight link xVarProcessName Structure
 
" Delimiter character
syn match ptsDelim /:/
highlight link ptsDelim Delimiter
===================
 
 
 
Under v5.3 I get all the colours when editing a pts file.
With v6.3 only the colours of the comments (things beginning with a # sign)
are coloured.
 
v6.3 otherwise works perfectly, I get all the colours with java files and
other filetypes I use with it.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Pierre-Philippe Ravier
Capital Markets IT
Dresdner Kleinwort Wasserstein
PO Box 560
20 Fenchurch Street
London EC3P 3DB
Tel : (0)-20-747-55437
Mob : (0)-797-005-3103
London UK
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender. 3167
--------------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Can't define my own syntax for *.pts files anymore

A.J.Mechelynck
----- Original Message -----
From: "Ravier, Pierre-Philippe" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, July 26, 2005 3:28 PM
Subject: Can't define my own syntax for *.pts files anymore


> Hi,
>
> I have a bunch of Solaris machine at work on which vim 5.3 was installed.
> I used that install happily for a while, then decided to have vim 6.3
> installed.
>
> Now that it is done I can use vim 6.3 happily, but the syntax file I had
> done for a specific file-extension of files we use here (.pts) doesn't
> work
> anymore.
>
> My .vimrc is :
> ==================
> let mysyntaxfile = "/vimfiles/mysyntax.vim"
> syntax on
> set tabstop=4
> set shiftwidth=4
> set ic
>
> set cindent shiftwidth=4
> set smartindent
> ===================
>
>
>
> /vimfiles/mysyntax.vim contains :
> ===================
> augroup syntax
>        au  BufNewFile,BufReadPost *.pts  so /vimfiles/pts.vim
> augroup END
> ===================
>
>
>
>
> /vimfiles/pts.vim contains :
> ===================
> " Vim Syntax file for the pts files
> " Language:             pts
> " Maintainer:           Pierre-Philippe Ravoer
> " Last Change:  Nov 03, 2003
> " Version: 1
>
> " Elementary keywords of the pts language
> syntax keyword xKeyword PROCESS_NAME PROCESS_DIR NO_CMD_LINE_TAG
> FOREGROUND_ONLY SINGLE_INSTANCE PROCESS_PARAMS ENV
> highlight link xKeyword Keyword
>
> " A comment
> syntax match xComment /#.*/
> highlight link xComment Comment
>
> " A reference to a shell variable (like in shell).
> syn match  xDerefSimple         "\$\w\+"
> highlight link xDerefSimple Identifier
>
> " An isolated number
> syn match   xNumber             "-\=\<\d\+\>"
> highlight link xNumber Number
>
> " A pts variable declaration
> syn match xVarDecl  /^\w\+\./ nextgroup=xVarProcessName
> syn match xVarProcessName /\w\+\./ contained
> highlight link xVarDecl Tag
> highlight link xVarProcessName Structure
>
> " Delimiter character
> syn match ptsDelim /:/
> highlight link ptsDelim Delimiter
> ===================
>
>
>
> Under v5.3 I get all the colours when editing a pts file.
> With v6.3 only the colours of the comments (things beginning with a #
> sign)
> are coloured.
>
> v6.3 otherwise works perfectly, I get all the colours with java files and
> other filetypes I use with it.

1. Move /vimfiles/pts.vim to $HOME/.vim/syntax/pts.vim (on Unix) or
$HOME/vimfiles/syntax/pts.vim (on Windows, using Vim terminology).
2. Create a file named $HOME/.vim/filetype.vim (or
$HOME/vimfiles/filetype.vim depending on platform) with the following
contents:

    augroup filetypedetect
    au BufRead,BufNewFile *.pts setf pts
    augroup END

If the file already exists, it should already have the "augroup" commands at
top and bottom, just add the autocommand between them.

3. You can remove /vimfiles/mysyntax.vim.


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: Can't define my own syntax for *.pts files anymore

A.J.Mechelynck
In reply to this post by Ravier, Pierre-Philippe
----- Original Message -----
From: "Ravier, Pierre-Philippe" <[hidden email]>
To: "'Tony Mechelynck'" <[hidden email]>
Sent: Tuesday, July 26, 2005 4:21 PM
Subject: RE: Can't define my own syntax for *.pts files anymore


> Thanks,
>
> I need however to have these settings under a central directory so that
> everyone can benefit from them.
> However it must not be buried in the vim install itself.
>
> This is why I put thus syntax file under this special /vimfiles directory.
>
> How do I make my vim session use this directory ?
>
> I tried
>
> let mysyntaxfile = "/vimfiles/filetype.vim"
> In the .vimrc
>
> But it does not work.
[...]

Then you should use $VIM/vimfiles wherever I wrote $HOME/.vim. At that
place, the files will be accessible by all users and won't be clobbered by a
Vim upgrade. IIUC, "mysyntaxfile" is no more used in version 6.

$VIM/vimfiles is the "normal" place for system-wide customizations of Vim.
It lies "just outside" the Vim install proper. What an upgrade or a
reinstall will modify is the contents of the $VIMRUNTIME directory, whose
name is version-dependent, for instance $VIM/vim63 or $VIM/vim70aa.

See also
    :help 'runtimepath'
    :help new-filetype (and scroll down to section C.)

Whenever a file type is determined, Vim will set the corresponding syntax --  
assuming that you have ":filetype on" and ":syntax on" set. One way to set
them is to have the line

    source $VIMRUNTIME/vimrc_example.vim

somewhere in your vimrc.


Best regards,
Tony.

P.S. I'm not a Vim employee or other official, but just a plain Vim user,
more knowledgeable than some, less than many. Next time, please use "Reply
to All" so everyone (not just me) sees your reply.


Reply | Threaded
Open this post in threaded view
|

RE: Can't define my own syntax for *.pts files anymore

Ravier, Pierre-Philippe
In reply to this post by Ravier, Pierre-Philippe
This is great, thanks for your help.

By adding the following statement to my .vimrc I solved the remainind issue
:
set runtimepath=/vimfiles,$VIMRUNTIME

-----Original Message-----
From: Tony Mechelynck [mailto:[hidden email]]
Sent: 26 July 2005 16:02
To: Ravier, Pierre-Philippe
Cc: [hidden email]
Subject: Re: Can't define my own syntax for *.pts files anymore


----- Original Message -----
From: "Ravier, Pierre-Philippe" <[hidden email]>
To: "'Tony Mechelynck'" <[hidden email]>
Sent: Tuesday, July 26, 2005 4:21 PM
Subject: RE: Can't define my own syntax for *.pts files anymore


> Thanks,
>
> I need however to have these settings under a central directory so
> that everyone can benefit from them. However it must not be buried in
> the vim install itself.
>
> This is why I put thus syntax file under this special /vimfiles
> directory.
>
> How do I make my vim session use this directory ?
>
> I tried
>
> let mysyntaxfile = "/vimfiles/filetype.vim"
> In the .vimrc
>
> But it does not work.
[...]

Then you should use $VIM/vimfiles wherever I wrote $HOME/.vim. At that
place, the files will be accessible by all users and won't be clobbered by a

Vim upgrade. IIUC, "mysyntaxfile" is no more used in version 6.

$VIM/vimfiles is the "normal" place for system-wide customizations of Vim.
It lies "just outside" the Vim install proper. What an upgrade or a
reinstall will modify is the contents of the $VIMRUNTIME directory, whose
name is version-dependent, for instance $VIM/vim63 or $VIM/vim70aa.

See also
    :help 'runtimepath'
    :help new-filetype (and scroll down to section C.)

Whenever a file type is determined, Vim will set the corresponding syntax --

assuming that you have ":filetype on" and ":syntax on" set. One way to set
them is to have the line

    source $VIMRUNTIME/vimrc_example.vim

somewhere in your vimrc.


Best regards,
Tony.

P.S. I'm not a Vim employee or other official, but just a plain Vim user,
more knowledgeable than some, less than many. Next time, please use "Reply
to All" so everyone (not just me) sees your reply.
 ------


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender. 3167
--------------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Can't define my own syntax for *.pts files anymore

A.J.Mechelynck
----- Original Message -----
From: "Ravier, Pierre-Philippe" <[hidden email]>
To: "'Tony Mechelynck'" <[hidden email]>; "Ravier,
Pierre-Philippe" <[hidden email]>
Cc: <[hidden email]>
Sent: Tuesday, July 26, 2005 5:19 PM
Subject: RE: Can't define my own syntax for *.pts files anymore


> This is great, thanks for your help.
>
> By adding the following statement to my .vimrc I solved the remainind
> issue
> :
> set runtimepath=/vimfiles,$VIMRUNTIME

There are more directories in 'runtimepath', which might be useful. If you
are dead set on using /vimfiles rather than $VIM/vimfiles, you may want to
use

    set runtimepath-=~/.vim
    set runtimepath-=~/.vim/after
    set runtimepath^=~/.vim,/vimfiles
    set runtimepath+=/vimfiles/after,~/.vim/after

to add an additional pair of "before" and "after" directory trees (which may
be nonexistent until they are needed) and let them be overridden on a
user-by-user basis. Or instead, on systems where soft links exist, you could
make $VIM/vimfiles a link to /vimfiles and leave 'runtimepath' at its
default.

Anyway, the above should go in a system-wide vimrc ($VIM/vimrc with no
period or underline) or the setting itself won't be set system-wide, and its
purpose will be defeated.


Best regards,
Tony.