On 07/07/09 22:22, Benct Philip Jonsson wrote:
>
> Ben Fritz skrev:
>>
>>
>> On Jul 7, 12:17 pm, Benct Philip Jonsson<[email protected]> wrote:
>>> Tony Mechelynck skrev:
>>>> for all buffers: in your vimrc
>>>> set matchpairs+=<:>
>>>> for all files of a given filetype (e.g. html): in (on Linux)
>>>> ~/.vim/after/ftplugin/html.vim
>>>> setlocal matchpairs+=<:>
>>>> (replace html in the filename by whatever filetype you want to apply it
>>>> to. Create the file and/or directories if they don't yet exist.)
>>> Can this be done form a syntax definition file?
>>>
>>
>> Technically, yes. But why would you want to? The syntax definition
>> file is meant to provide syntax highlighting rules, nothing more. The
>> CORRECT place for this is in an ftplugin directory, as Tony suggests.
>> Is there any reason you don't want to do it this way?
>
> Only to avoid having two files when I can have one.
>
> /BP
I think this is a borderline case, as 'matchpairs' will (ultimately)
influence highlighting, however not by means of the usual ":syntax
<something>" and ":highlight <something>" commands, but by means of a
buffer-local option -- see below.
However, I recommend NOT placing "everywhere in the same place" just to
avoid creating additional files -- or you could also create additional
autocommands from your vimrc, and, if you set the autocommand groups
appropriately, it might allow you to avoid ever creating any other
vimscript than your vimrc -- but you'd end up with a spaghetti vimrc
which would be much more bug-prone than if you had created the
appropriate scripts to begin with.
I still believe that the "right" place for filetype-dependent option
settings is ":setlocal" commands in a filetype plugin (which should
preferably be limited to buffer-local options). The same applies to
filetype-depent mappings: use any variant of the ":map {lhs} {rhs}" or
":abbrev {lhs} {rhs}" command (other than :lmap -- keymaps are better
for this purpose and can be set by a buffer-local option, see above),
use the <buffer> modifier, and place the command in a filetype-plugin
(in an |after-directory| if there is a distributed filetype-plugin for
that filetype and you don't want to rewrite all of it).
Best regards,
Tony.
--
If someone had told me I would be Pope one day, I would have studied
harder.
-- Pope John Paul I
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---