Header in new file
-
Dears, I’m looking for a Notepad++ plugin that insert a header in all new files. Example: if I click in File>New, or Ctrl+N, the new blank file brings the text “Created by Bob” at first line. There’s something like this? Thanks!
-
@Roberto-Moreno said in Header in new file:
Example: if I click in File>New, or Ctrl+N, the new blank file brings the text “Created by Bob” at first line. There’s something like this? Thanks!
Nothing built-in, however it is easy to set up.
Just create a macro by recording the steps:
- Create a new tab
2.Write the “header” info, followed by enter. - Stop the macro and save it using a meaningful name, together with a “hot key” of your choice (one that isn’t currently used).
The macro gets saved in the
shortcuts.xmlfile, generally located under Notepad++ folder within the%AppData%hidden folder. So on any subsequent session hit the “hot key” and you will have a new tab with the header line inserted.Terry
- Create a new tab
-
Here’s a way of doing it with PythonScripting (PythonScript is a plug-in):
# -*- coding: utf-8 -*- from Npp import * try: HINF__callback_npp_BUFFERACTIVATED except NameError: def HINF__callback_npp_BUFFERACTIVATED(args): if editor.getTextLength() == 0: editor.setText('Created by Bob') notepad.callback(HINF__callback_npp_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED])One option is to put most of that script into startup.py, or make a call to the script from startup.py if you don’t embed it.
-
T Terry R referenced this topic on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login