Community
    • Login

    Feature Request - Toggle Line Numbers

    Scheduled Pinned Locked Moved General Discussion
    feature requestborderline number
    16 Posts 7 Posters 1.5k 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.
    • drankinattyD
      drankinatty
      last edited by

      All,

      One feature that is sorely missing from npp is the ability to simply toggle line-numbers on/off without having to go to

      Settings->Margins/Border/Edge->Line Number [  ]Display
      

      each time I want the line numbers on or off. The easiest way to do this is just to expose that setting through the shortcut-keys interface and let the user set a shortcut for it (it would also be a nice addition under the view menu)

      This is sorely needed for compiled languages when the only time you really care about the line number is when the compiler spits out a warning or error that needs addressing (or multiple warnings/errors). Then it is imperative to have line numbers visible (my preference would be to simply tap F11 - like kate/kwrite in KDE). When done, another tap of F11 would hide the line numbers again recovering the screen real estate for code.

      I don’t know how difficult this would be, but each time I have to sit down to windows and grab my goto editor npp – I’m reminded about this shortcoming. Can this be done? If so, do you need a formal feature request in bugzilla or an issue opened on github? Let me know either way and I’m happy to do it.

      Terry RT Alan KilbornA dinkumoilD Neil SchipperN 5 Replies Last reply Reply Quote 2
      • Terry RT
        Terry R @drankinatty
        last edited by Terry R

        @drankinatty
        In your example it would make it much easier (quicker) with a shortcut key to achieve it. However I do wonder if there would be enough users to follow on from your request to support it enough for the developer to take notice.

        Regardless, if you do want to get it featured as a request you will need to read the FAQ post here as this forum can only talk about it and make suggestions, nothing the developer is in any way committed to reading or following through on.

        Please do make sure you check if it already exists either as an open request or maybe even one that has already been canned by the developer (and team). And also if you do submit it, please re-post here the link to your (new) request.

        Good luck.
        Terry

        PeterJonesP 1 Reply Last reply Reply Quote 1
        • Terry RT
          Terry R @drankinatty
          last edited by

          @drankinatty

          I began to wonder if possibly a plugin exists which will help. And it does appear so. Try CustomLineNumbers which states it can be turned on/off via menu entry.

          It might not be exactly what you want (a single hotkey) but possibly an alternative if you get no traction as a user request.

          Terry

          1 Reply Last reply Reply Quote 2
          • Alan KilbornA
            Alan Kilborn @drankinatty
            last edited by

            @drankinatty

            Please don’t create a new feature request for this. An open one already exists HERE.

            My guess is that developers don’t consider this an important enough item to act upon. Indeed, I don’t see why (a) someone wouldn’t want line numbers always visible, (b) why someone would want line numbers conditionally shown (related to “a” I guess), or © why this little bit of screen space couldn’t just be “ignored” by a user. But, I learned a long time ago, people want what they want.

            However, given all that, a scripting solution to this has been offered before. Details on that are HERE.

            As scripting involves a plugin, if you want to go with a plugin at all to solve this “problem”, probably first trying the one @Terry-R pointed out is the simplest thing.

            1 Reply Last reply Reply Quote 1
            • dinkumoilD
              dinkumoil @drankinatty
              last edited by

              @drankinatty @Terry-R @Alan-Kilborn

              Author of CustomLineNumbers plugin here. Unfortunately my plugin is not suitable for the mentioned use case. When the plugin gets deactivated, the default line number margin is activated again. Thus, it’s not possible to turn off line numbers with my plugin.

              1 Reply Last reply Reply Quote 3
              • PeterJonesP
                PeterJones @Terry R
                last edited by PeterJones

                @Terry-R said in Feature Request - Toggle Line Numbers:

                In your example it would make it much easier (quicker) with a shortcut key to achieve it.

                And unfortunately, keyboard shortcuts cannot be assigned to preference changes, and you cannot macro-record preferences changes, either.

                @drankinatty,

                The best bet for the feature that you asked for is to use the script that @Alan-Kilborn linked to, and to 👍 the existing feature request.

                But as a simpler alternative, if you’re really just using it to visually identify the line number for finding where errors are, you could just keep line numbers off, and use Ctrl+G (Search > Goto) and enter the line number that your compiler spits out at you. It won’t be as obvious as a number, but it will still take you to the right location in the file.

                If you do end up using the PythonScript plugin and the script that @Alan-Kilborn linked, make sure to follow his link to “further info on using the PS plugin may be obtained HERE”, as it will help you with getting things set up correctly.

                With PythonScript installed, you might also want to try out something like this other script by Alan which can run a syntax check (or your compiler) and set an “annotation” on the right line number in Notepad++, so that you can visually see the problem. Since Alan’s “annotation” script uses the internal python syntax checking, you might want to look at my variant of that script, which also runs an external command (in my case, wperl -c) to compile and syntax-check perl code; you could do something similar to run gcc or whatever compiler you need on .c or similar, then have the except block process the error messages from that compiler rather than wperl -c, similar to the way I show there. But this is just “extra”, which may or may not be of interest to you.

                Also, the NppExec plugin has automatic “filtering”/“error highlighting” (Plugins > NppExec > Console Output Filters > Highlight), so if you use NppExec to run your compiler, it can highlight error messages in its console, and if you double-click on the error there, it will take you to the right line of code in your file. It’s already set up for standard c-style error and warning messages … and if your compiler doesn’t follow the FILENAME:LINENUMBER:other pieces format that gcc uses, and you cannot understand the syntax shown, you could probably paste an error message in this discussion (make sure to use the </> button on the forum toolbar), and one of us will likely be able to share the right highlighting format for your specific style of error message.

                Alan KilbornA 1 Reply Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @PeterJones
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • Neil SchipperN
                    Neil Schipper @drankinatty
                    last edited by

                    @drankinatty

                    I added this comment to Issue #10762:

                    Only somewhat tangentially,

                    1. promoting line number to a first class per-file attribute that persists across sessions is clearly not a priority, and this is understandable, however…
                    2. double clicking on the line number column presently does nothing (different than single-clicking) so it seems to me that toggling line numbers visibility (thus sometimes overriding the Settings-Preferences directive) on a per-file but non-persistent basis by double-click should be “almost free” to code. When I say “almost free” I mean: no anguish over cluttering up any options dialogs; no extensions to session xml; and almost no need to document since folks nowadays will often double-click or right-click on a visual element just to see what happens; … which in turn suggests …
                    3. Somewhat nicer still would be a right-click pop-up menu “Toggle line nums for this file” item
                    Alan KilbornA drankinattyD 2 Replies Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Neil Schipper
                      last edited by

                      @Neil-Schipper said in Feature Request - Toggle Line Numbers:

                      double clicking on the line number column

                      OK, so double-clicking on the line number column will cause it to disappear, and to get it to reappear just what exactly do I double-click on??

                      Neil SchipperN 1 Reply Last reply Reply Quote 0
                      • Neil SchipperN
                        Neil Schipper @Alan Kilborn
                        last edited by

                        @Alan-Kilborn Persistent skinny margin.

                        Alan KilbornA 1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn @Neil Schipper
                          last edited by

                          @Neil-Schipper said in Feature Request - Toggle Line Numbers:

                          Persistent skinny margin.

                          I see. So the line number margin is always visually available, just when it is “logically hidden” it still has some minimum visual component to allow restoration. I suppose if it is very minimal then it is hard to hit to restore it, but if it isn’t very minimal it doesn’t really achieve the goal of being hidden. Maybe as long as numbers aren’t visible the goal is achieved.

                          1 Reply Last reply Reply Quote 0
                          • drankinattyD
                            drankinatty @Neil Schipper
                            last edited by

                            @Neil-Schipper Neil, thank you and all that replied. and thank you for the FAQ link. I see you have added suggestions to #10762, if that is sufficient for the issue, then that’s good for me.
                            I understand features are added based on a user-support type system, and I’ve seen that in other projects as well. It has merit, but I agree that for smaller, specific features such as a line number toggle, it is unlikely that it will generate sufficient vote interest. (not much sex-appeal from a feature standpoint)
                            That is where the user-support (vote) system has its weakness. Many features are just those that are expected in any editor, the type where any one of the nuts-and-bolts features are unlikely to receive many “popular” votes for addition. That doesn’t mean the feature shouldn’t be added, moreover just that basic features are not the type that end up at the top of a users wish-list.
                            If you think it would be helpful for me to follow the FAQ further to put the issue before the developers, let me know and I’m happy to do it. Thanks again to all that replied.

                            1 Reply Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn
                              last edited by

                              Really, one could just use the script I linked to before and stop all the discussion. It works, end of story.

                              One of the main points of scripting is giving you control over things so you don’t have to wait for developers to agree that what you want is worth it, then wait even longer for then to code, document and release it.

                              drankinattyD 1 Reply Last reply Reply Quote 2
                              • drankinattyD
                                drankinatty @Alan Kilborn
                                last edited by

                                @Alan-Kilborn I installed PythonScript plugin. That really isn’t an efficient solution. Installing a 20M plugin just to toggle line-numbers on/off seem a bit overkill. (not to mention the additional vulnerability from having yet another part of npp automatically pulled from github - and being python - the recent Pypy attack is a reminder that isn’t always a good idea)

                                Lycan ThropeL Alan KilbornA 2 Replies Last reply Reply Quote 1
                                • Lycan ThropeL
                                  Lycan Thrope @drankinatty
                                  last edited by

                                  @drankinatty,
                                  The other option is to write your own plugin, or wait until one of the developers thinks it’s important enough to make part of the codebase.
                                  There are always going to be “attacks” by malcontents. Your only true option to avoid this type of problem is to get a Smith Corona to do your text editing. Then you can control everything with no need for code.

                                  1 Reply Last reply Reply Quote 3
                                  • Alan KilbornA
                                    Alan Kilborn @drankinatty
                                    last edited by

                                    @drankinatty said in Feature Request - Toggle Line Numbers:

                                    I installed PythonScript plugin. That really isn’t an efficient solution. Installing a 20M plugin just to toggle line-numbers on/off seem a bit overkill.

                                    I really can’t conversate rationally with someone that is going to complain about a 20MB usage in today’s world.

                                    (not to mention the additional vulnerability from having yet another part of npp automatically pulled from github - and being python - the recent Pypy attack is a reminder that isn’t always a good idea)

                                    Another irrational point – go with Smith Corona, as suggested?


                                    We’re just N++ users here, attempting to point out ways in which you can obtain your desired functionality right this instant. Often these ways involve some sort of compromise on your part. Your alternative is to just go on missing the feature you are missing.

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