Including a Mercurial (ini file) syntax with Vim

7 views
Skip to first unread message

Ted Pavlic

unread,
Dec 8, 2008, 2:25:55 PM12/8/08
to vim_use
Vim presently comes packaged with a "gitconfig" filetype. However, it
doesn't have any support for Mercurial hgrc files.

Interestingly, both git and Mercurial simply use INI files. That is, it
seems wrong to have a special gitconfig filetype (and a special
hgrc/etc.). They should all just be ini files.

Today, this was released:

http://bitbucket.org/boredzo/vim-ini-syntax/

It's an INI syntax file for Vim, and there are instructions on
associating the file type with hgrc files. It could just as easily be
applied to gitconfig as well.

Sometime in the next Vim, it would be nice to see hgrc syntax support
(as an INI file or otherwise).

--Ted

--
Ted Pavlic <t...@tedpavlic.com>

Ted Pavlic

unread,
Dec 8, 2008, 2:40:16 PM12/8/08
to vim_use
Alternatively, the existing "cfg" file type works well for such files

autocmd BufNewFile,BufRead *.hgrc,*hgrc setfiletype cfg

--Ted

Matt Wozniski

unread,
Dec 8, 2008, 6:48:30 PM12/8/08
to vim...@googlegroups.com
On Mon, Dec 8, 2008 at 2:40 PM, Ted Pavlic wrote:
>
> Ted Pavlic wrote:
>>
>> Vim presently comes packaged with a "gitconfig" filetype. However, it
>> doesn't have any support for Mercurial hgrc files.
>
> Alternatively, the existing "cfg" file type works well for such files
>
> autocmd BufNewFile,BufRead *.hgrc,*hgrc setfiletype cfg

So does the already existing 'dosini' filetype. However, neither
'dosini' nor your 'ini' syntax file allow for comments at end of line,
ie

gitproxy=default-proxy ; for all the rest

gitconfig handles this, as well as checking that strings stored to
variables are properly terminated, and that recognized escape
characters are not highlighted within a string. All of these are
valuable things for a syntax file to do. 'cfg' or 'ini' or 'dosini'
aren't inappropriate, they just don't know as much about the format
git requires and can't highlight it as well because of that. Like
setting ft=c in a C++ file, most things will work but not everything.

~Matt

Ted Pavlic

unread,
Dec 8, 2008, 7:01:08 PM12/8/08
to vim_use
> So does the already existing 'dosini' filetype. However, neither
> 'dosini' nor your 'ini' syntax file allow for comments at end of line,
> ie

Okay. All good points.

So maybe "gitconfig" should be the filetype for hgrc files.

Reply all
Reply to author
Forward
0 new messages