Monday, October 28, 2013

Re: How do I make a file not be recognized as a file type?

Nikolay Pavlov wrote:
>
>
> On Oct 28, 2013 7:35 PM, "Charles E Campbell"
> <drchip@campbellfamily.biz <mailto:drchip@campbellfamily.biz>> wrote:
> >
> > Nikolay Pavlov wrote:
> >>
> >>
> >>
> >> On Oct 28, 2013 7:14 PM, "Charles E Campbell"
> <drchip@campbellfamily.biz <mailto:drchip@campbellfamily.biz>
> <mailto:drchip@campbellfamily.biz <mailto:drchip@campbellfamily.biz>>>
> wrote:
> >> >
> >> > Paul Isambert wrote:
> >> >>
> >> >> Sam Roberts <vieuxtech@gmail.com <mailto:vieuxtech@gmail.com>
> <mailto:vieuxtech@gmail.com <mailto:vieuxtech@gmail.com>>> a écrit:
> >>
> >> >>>
> >> >>> On Fri, Oct 25, 2013 at 10:46 AM, Charles Campbell
> >> >>> <Charles.E.Campbell@nasa.gov
> <mailto:Charles.E.Campbell@nasa.gov>
> <mailto:Charles.E.Campbell@nasa.gov
> <mailto:Charles.E.Campbell@nasa.gov>>> wrote:
> >> >>>>
> >> >>>> Do you have a comment character? Use modelines. Assuming %
> kicks off a
> >> >>>> comment, put the following at the bottom of the file:
> >> >>>
> >> >>> json does not, infamously, support comments
> >> >>>
> >> >>> But even if it did, I want ALL *.json to be not recognized as
> javascript.
> >> >>
> >> >> Delete the autocommand defined in filetype.vim:
> >> >>
> >> >> :au! filetypedetect BufNewFile,BufRead *.json
> >> >>
> >> > Modifying a file such as filetype.vim that came with vim (ie. a
> system file) is a Bad Idea. After the next update, the changes (long
> forgotten) will "disappear".
> >>
> >> There is no such :au***bang*** command in filetype.vim. Suggested
> method was removing the autocommand from vim in-memory structures.
> >>
> > Yes, there is. Try looking at
> [/usr/local/share/vim/]vim74/filetype.vim line#968. Suggested method
> involved removing the line from vim's distribution file. Bad Idea.
> >
>
> No, there is not. Reread the line, it suggests using banged version of
> autocommand to remove it. **Banged**. Line you are suggesting to look
> at contains **no** *banged* version. It also contains more then just
> *.json in a list of patterns. It does *not* contain string
> "filetypedetect" because it is specified at the top of the file with
> :augroup.
>
> Suggested method is undefining autocommand *after it was defined*. It
> though lacks information about where it should be put (most likely
> after :filetype ... on command), but it does not involve editing
> filetype.vim.
>
>
The method that was suggested by Paul Isambert was to delete the line
setting up the json syntax recognition in the system file. Still a bad idea.

To reiterate, what I suggested was to _override_ -- which works without
any exclamation marks. It works. Tried it. Before I sent out my
response to the OP.
Repeat: create/edit a personal file, $HOME/.vim/filetype.vim . Put in
it the following line:

au BufNewFile,BufReadPost *.json setl ft=

Getting rid of the filetypedetect autogroup would remove a lot of syntax
detection, not just the *.json files.

C Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment