Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    use plugin from macro

    Help wanted · · · – – – · · ·
    4
    7
    2798
    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.
    • gfgtdf
      gfgtdf last edited by

      I’m currently using the addon “indent by fold” to indent my lua code, however is indents lines that begin with ‘else’ incorrectly so i wrote a macro that fixed these mistakes with a regex replace.

      This means that i have to click 2 buttons to indent my code, which is annyoing does anyone know how i can extend my macro to call ‘indent by fold’ first?

      Claudia Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        Claudia Frank @gfgtdf last edited by

        @gfgtdf

        to be honest - if you are programming lua why don’t you use the
        lua script plugin from dail and program your own indent routine or better check out his examples as far as I remember there was already an indent functionality developed?!

        Cheers
        Claudia

        Scott Sumner 1 Reply Last reply Reply Quote 0
        • Scott Sumner
          Scott Sumner @Claudia Frank last edited by

          @Claudia-Frank

          I believe you are talking about this posting?: https://notepad-plus-plus.org/community/topic/12741/auto-identation-in-lua-code-language

          1 Reply Last reply Reply Quote 1
          • gfgtdf
            gfgtdf last edited by

            Thx to both of you, this was quite helpful.

            1 Reply Last reply Reply Quote 0
            • dail
              dail last edited by

              @gfgtdf

              If you do plan on using that Lua code you probably instead want to use this slightly updated version of it. The post Claudia and Scott referenced was a very early version of it I put together real quick.

              1 Reply Last reply Reply Quote 0
              • gfgtdf
                gfgtdf last edited by

                Thx again, i noticed though that the script cannot currectly indent functions that are passed as parmeters to other functions, in particular LuaAutoIndent.lua cannot correctly indent itself since it contain multiple lines like npp.AddEventHandler("OnSwitchFile", function(filename, bufferid) also it doesn’t indent correctly after the line if editor:findtext(increaseIndentPattern, SCFIND_REGEXP, start_pos, end_pos) then this is becasue the end in end_pos

                1 Reply Last reply Reply Quote 0
                • dail
                  dail last edited by

                  @gfgtdf

                  I never said it was perfect ;) You are welcome to make changes and submit a pull request.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright © 2014 NodeBB Forums | Contributors