Community
    • 登入

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

    已排程 已置頂 已鎖定 已移動 General Discussion
    4 貼文 3 Posters 850 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Hassan IqbalH
      Hassan Iqbal
      最後由 編輯

      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?

      Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
      • Alan KilbornA
        Alan Kilborn @Hassan Iqbal
        最後由 編輯

        @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 條回覆 最後回覆 回覆 引用 5
        • Hassan IqbalH
          Hassan Iqbal
          最後由 編輯

          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?

          EkopalypseE 1 條回覆 最後回覆 回覆 引用 0
          • EkopalypseE
            Ekopalypse @Hassan Iqbal
            最後由 編輯

            @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 條回覆 最後回覆 回覆 引用 4
            • 第一個貼文
              最後的貼文
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors