Sunday, August 27, 2017

Re: .cl file type?

On So, 27 Aug 2017, Barry Gold wrote:

> What does vim think an extension of ".cl" means?
>
> I've been writing a program that will take a list of input HTML files (some
> written using an editor like vim, some generated by MS Word) and convert
> them to legal (and reasonably clean) XHTML. The program is written in PHP,
> and I've been following the convention of putting each class in a separate
> file. So I have one top-level file (an "executable" using the #!
> convention), a few "include" files with the extension ".inc", and my classes
> in files with the extension ".cl".
>
> But when I try editing the .cl files with vim, auto-formatting doesn't work.
> I have autoindent set, but every new line starts in column 1, regardless of
> the indention of the previous line. Also linewrapping doesn't work (set
> fo+=tcroqj)
>
> I had various ideas of what was wrong, and I think I have eliminated all the
> others. But as far as I can see, vim does what I expect *unless* the
> extension is ".cl". In a file named *.cl, autoformatting just doesn't work.
> Period.
>
> What's up with the .cl extension? Is there a way to get .vim to treat it
> like .php? Or should I just live with it and change my naming convention to
> match whatever assumptions are built into .vim?
>
> Btw, this occurs in the vim that is downloaded with cygwin
> VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 27 2017 13:34:58)
>
> and also when I right click on a file and choose "Edit with Vim".

Your php files have probably special settings in the corresponding
filetype plugins. And possibly, if you enabled indent plugins, there
exists special logic there as well. If you want to have your .cl files
be handled like php files, check e.g. the faq:
https://vimhelp.appspot.com/vim_faq.txt.html#faq-26
(there are several questions in the 26 block, that might be of interest
to you). And follow the links to the documentation in Vim.

Also, if .cl is kind of a official extensions for Vim, we might need to
extend our logic to detect php like files.

Best,
Christian
--
Es ist komisch, daß kein Mensch mit Esprit ein Glück möchte, das auf
Dummheit gegründet ist, und doch ist es klar, daß man dabei einen
guten Tausch machen würde.
-- François Marie Voltaire

--
--
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/d/optout.

No comments: