How to set preferences for particular files which do not have a file extension suffix?

15 views
Skip to first unread message

jason404

unread,
Jan 5, 2020, 1:10:43 PM1/5/20
to niceeditor
I have been editing a lot of dockerfiles using ne.  They are always called 'Dockerfile'.

I know how to set autoprefs for files with file extensions, by naming the prefs file like txt#ap, for text files for example.  How could I make an autoprefs file for files called 'Dockerfile'?

At the moment I am just settings preferences in .default#ap.

Thanks

todd_...@unc.edu

unread,
Jan 6, 2020, 7:19:08 AM1/6/20
to niceeditor
This is exactly what "virtual extensions" handles. I'll be lazy and just quote from ne.texinfo:

Some files have no extension, but the file type can be
discerned by simple examination. Consider for example a
file named @file{example} which contains XML. You may
reasonably expect it to be treated as an @file{.xml} file
rather than a generic file. For the purposes of applying
automatic preferences and syntax definitions, @code{ne}
provides a mechanism for overriding a wrong or missing
extension with a @dfn{virtual extension} based on a
document's contents. You do this by creating a
@file{~/.ne/.extensions} file which is fully described in
the @ref{Virtual Extensions} section.

The "Virtual Extensions" section goes on to describe how ne examines the first bit of some files to determine whether to override an existing extension or pretend one exists when there is none. Give it a read, and if you still have questions after that, by all means, post them here.
Reply all
Reply to author
Forward
0 new messages