buffer local autocmd

2007-06-05 Thread Markus Schulz
hello,

i want to setup some things only for php-source files. But i don't get 
the autocmd local to buffer. The setup was also applied to opened c++ 
files after the first php file.

currently i have this inside my .vimrc (php.vim sets some tabulator 
options)

autocmd   FileType  php source ~/.vim/php.vim

i've tried something like:

autocmd   FileType   php source ~/.vim/php.vim

without luck.

Any hints how i can achieve this?

-- 
Markus Schulz


Re: buffer local autocmd

2007-06-05 Thread Gary Johnson
On 2007-06-05, Markus Schulz <[EMAIL PROTECTED]> wrote:
> hello,
> 
> i want to setup some things only for php-source files. But i don't get 
> the autocmd local to buffer. The setup was also applied to opened c++ 
> files after the first php file.
> 
> currently i have this inside my .vimrc (php.vim sets some tabulator 
> options)
> 
> autocmd   FileType  php source ~/.vim/php.vim
> 
> i've tried something like:
> 
> autocmd   FileType   php source ~/.vim/php.vim
> 
> without luck.
> 
> Any hints how i can achieve this?

The problem may be in your ~/.vim/php.vim file.  Make sure any 
options are set there using "setlocal", not just "set".  "set" 
applies most options globally while "setlocal" applies most options 
to only the current buffer.  See

   :help setlocal

To make mappings local to the current buffer, see

   :help map-

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Mobile Broadband Division
 | Spokane, Washington, USA


Re: buffer local autocmd

2007-06-05 Thread A.J.Mechelynck

Markus Schulz wrote:

hello,

i want to setup some things only for php-source files. But i don't get 
the autocmd local to buffer. The setup was also applied to opened c++ 
files after the first php file.


currently i have this inside my .vimrc (php.vim sets some tabulator 
options)


autocmd   FileType  php source ~/.vim/php.vim

i've tried something like:

autocmd   FileType   php source ~/.vim/php.vim

without luck.

Any hints how i can achieve this?



Instead of ~/.vim/php.vim, name it ~/.vim/after/ftplugin/php.vim and you won't 
even need an autocommand. (Create the directories if they don't exist).


Make sure the script contains only local commands such as ":map " and 
":setlocal".



Best regards,
Tony.
--
Lewis's Law of Travel:
The first piece of luggage out of the chute doesn't belong to
anyone, ever.


Re: buffer local autocmd

2007-06-06 Thread Markus Schulz
Am Dienstag, 5. Juni 2007 21:00 schrieb A.J.Mechelynck:
> Markus Schulz wrote:
> > hello,
> >
> > i want to setup some things only for php-source files. But i don't
> > get the autocmd local to buffer. The setup was also applied to
> > opened c++ files after the first php file.
> >
> > currently i have this inside my .vimrc (php.vim sets some tabulator
> > options)
> >
> > autocmd   FileType  php source ~/.vim/php.vim
> >
> > i've tried something like:
> >
> > autocmd   FileType   php source ~/.vim/php.vim
> >
> > without luck.
> >
> > Any hints how i can achieve this?
>
> Instead of ~/.vim/php.vim, name it ~/.vim/after/ftplugin/php.vim and
> you won't even need an autocommand. (Create the directories if they
> don't exist).
>
> Make sure the script contains only local commands such as ":map
> " and ":setlocal".

thanks. works great.

-- 
Markus Schulz