[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qapi: Add vim magic modelines for qapi definiti
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] qapi: Add vim magic modelines for qapi definitions |
Date: |
Wed, 05 Dec 2018 17:20:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Marc-André Lureau <address@hidden> writes:
> Hi
>
> On Wed, Dec 5, 2018 at 4:34 PM Peter Krempa <address@hidden> wrote:
>>
>> On Thu, Oct 04, 2018 at 13:34:12 +0200, Peter Krempa wrote:
>> > On Tue, Sep 04, 2018 at 09:03:10 +0200, Peter Krempa wrote:
>> > > The files have a json suffix but look terrible with json syntax
>> > > hilighting enabled. Add a magic modeline for vim to switch to python
>> > > file format for hilighting similarly to the emacs modeline already
>> > > present.
>> > >
>> > > Signed-off-by: Peter Krempa <address@hidden>
>> > > ---
>> >
>> > Ping?
>>
>> Ping 2. It looks like no new json files were added meanwhile.
>
> I use both emacs and vim. We solved this for me with emacs .editorconf
> file_type_emacs.
>
> The vim plugin doesn't have an equivalent, however, the documentation
> suggest vim_filetype, but you need to add
> to .vimrc:
>
> function! FiletypeHook(config)
> if has_key(a:config, 'vim_filetype')
> let &filetype = a:config['vim_filetype']
> endif
>
> return 0 " Return 0 to show no error happened
> endfunction
>
> call editorconfig#AddNewHook(function('FiletypeHook'))
>
> I think this is a better solution than having to add modelines
> everywhere, what do you think?
These .json files are not valid JSON. They *are* valid Python (except
for a few tests, which could perhaps be fixed). Makes me wonder why on
earth we insist on naming them .json and create all this trouble.