Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: set extension for =( ) created file

> On Sep 24, 2016, at 4:14 PM, Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
>> On 24 September 2016 at 21:55, Lawrence Velázquez
>> <larryv@xxxxxxxxxxxx> wrote:
>> Any competently written program that cares about the structure of its
>> input has some other way of validating said structure, like actually
>> parsing it or checking for a file signature / header / magic number.
>> Programs that process stdin already have to do this.
> Yeah, one of such programs is Vim and it fails recognizing e.g.
> ctags/awk.c as ft=zsh.

Then vim's file detection logic needs work. (Or maybe your vim is not
configured correctly. I downloaded ctags literally 30 seconds ago and
opened awk.c, and my vim set filetype=c correctly.) Not zsh's problem.

>>> Extension-aware =( ) would be a masterpiece feature for Zsh,
>>> though, IMO.
>> Unless it were implemented using libmagic or something, I would
>> consider it a massive waste of time and effort.
> What time and effort? I guess it can be a beautiful few lines patch.
> Modify name of file? Something like strcat. Parsing clever syntax that
> would provide the extension? Also possibly basic.

A few lines (of C!) to reliably detect dozens/hundreds/thousands of file
formats? Okay.

(FWIW, file(1) -- a whole program/library made expressly for this
purpose -- gives me hilariously bad results on a regular basis.)


Messages sorted by: Reverse Date, Date, Thread, Author