• Login
Community
  • Login

How to make Notepad++ do some automatic cleanup before saving certain files?

Scheduled Pinned Locked Moved General Discussion
4 Posts 3 Posters 709 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    Hassan Iqbal
    last edited by Jun 21, 2020, 4:56 PM

    I write VHDL source code. To keep code clean, I need to remove trailing spaces and convert tabs to spaces just before I save the file. I then commit it into Git repository. I want that this be done automatically.

    Either I can increase the functionality of the save feature or, create a keyboard shortcut that will do the above things and also save the file. How do I go about doing this automation for VHDL files ONLY?

    A 1 Reply Last reply Jun 21, 2020, 5:20 PM Reply Quote 0
    • A
      Alan Kilborn @Hassan Iqbal
      last edited by Jun 21, 2020, 5:20 PM

      @Hassan-Iqbal said in How to make Notepad++ do some automatic cleanup before saving certain files?:

      remove trailing spaces and convert tabs to spaces

      You can do this part with a macro.

      I then commit it into Git repository. I want that this be done automatically.

      From what I know, you have to have done a “git add” on the file, then you can do a “git commit”. These are command-line options, so you can set something up on the Run menu to do that, I suppose.

      But, would you really want to commit each and every time you save? I wouldn’t. I’d want that to be more “controlled”, logically.

      1 Reply Last reply Reply Quote 5
      • H
        Hassan Iqbal
        last edited by Jun 21, 2020, 6:58 PM

        The Git stuff will happen outside Notepad++
        The thing is, I want to automate only the things within Notepad++

        You are implying that I can assign the macro to a keyboard shortcut? But how to make sure that the macro stays there every time I open Notepad++ or restart the computer?

        E 1 Reply Last reply Jun 21, 2020, 7:20 PM Reply Quote 0
        • E
          Ekopalypse @Hassan Iqbal
          last edited by Jun 21, 2020, 7:20 PM

          @Hassan-Iqbal said in How to make Notepad++ do some automatic cleanup before saving certain files?:

          You are implying that I can assign the macro to a keyboard shortcut?

          The macro menu contains the item Modify Shortcut/Delete Macro…, there you can assign a shortcut after you have recorded the macro.

          But how to make sure that the macro stays there every time I open Notepad++ or restart the computer?

          Because the macro is stored in a file called shortcuts.xml.

          1 Reply Last reply Reply Quote 4
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors