Insert File Header/Copyright Feature


#1

I would like to request this as a feature:

A package in Atom for creating headers for different programming languages? With information like :

Author Name
Date Created
Date Modified
Copyright
FileName
Details/Description

Several existing editors have similar packages, for example sublime has - https://packagecontrol.io/packages/FileHeader, and emacs which I commonly use has the make-headers package, which is quite complete.


#2

For those whose needs aren’t quite as complex, there is my auto-copyright package that will insert a customizable header as a comment in files. It doesn’t support macros other than copyright owner name and copyright year … but that is enough for many.


#3

Thanks @leedohm . I actually did have a look at the auto-copyright package. I was hoping to extend it myself, but unfortunately, I am unfamiliar with coffeescript.

Hope somebody else picks this up :slight_smile:


#4

Consider this an opportunity to learn an excellent language. (grin)


#5

I just wrote a FileHeader for Atom. I think it solves your problem. Check it out! :smiley: https://atom.io/packages/file-header


#6

I just made a snippet for myself: Cmd+Shift+P -> Application: Open your snippets, Added this: my snippets

giphy (1)


#7

Hi cKx - Kick it up a notch. How about developing some coding that paste the note in from a short-cut or from the command-pallet.

You can have the text adapt the comment marker to the code grammar used.

TIP: Here is some Coffeescript to sip on…

return false unless _editor = atom.workspace.getActiveTextEditor()
_prefix = _editor.getCommentStrings(_editor.getCursorScope()).commentStartString

#8

How do you run the package?


#9

Apparently there is a command that you can call from the command palette, or bind it to a keybinding: auto-copyright:insert. Alternatively, there is a menu entry in the package section, called “Auto Copyright”, or the context menu from the editor (right click anywhere in a text editor, then click on “Insert Copyright”).

Hope this helps!


#10

Thanks! I ran it but I got a bug.