Open files tabs - auto-sorted how?



  • I would like to keep open files tabs sorted at all times without clicking “sort”. Is there any plugin for this or settings? I can’t find it :-( If there is none, can a plugin be written for that or Notepad++ don’t allow plugins to access file tabs?



  • Can someone write such plugin if possible, I would pay for it. I really need it.



  • @maxitrol

    there is no official notepad++ API to handle this case but this doesn’t
    mean it can’t be done. Maybe one needs to hook into
    npps message queue and act accordingly.
    If I have time I will see if a python script can be written to make it work,
    but this means you need to install pythonscript plugin and,
    more important, exactly describe what you want to have.



  • @Ekopalypse

    The code to “Sort tabs” in the Window=>Windows… menu dialog seems to be here.

    I tried in Perl Script, but like you said the API doesn’t seem to be exposed - there is no getBufferByIndex() and setBuffer() calls. in Perl Script.

    Cheers.



  • @Michael-Vincent

    thx - now I remember that I have thought about it once and
    I guess it isn’t that easy. WDN_NOTIFY is NOT a normal windows message but one registered by npp.
    Hmm … have to think about it once more.



  • @Michael-Vincent

    I have not found a way to receive the custom registered messages
    using the Windows API.
    I’ve also tried to see if this is cached in the registry in any way,
    but no luck so far.



  • Too bad. I really want auto-sort tabs because it is driving me crazy when I am coding and having 10 tabs open. Any other light weight editor with such feature? I only need three things:

    1. auto sort tabs in real time
    2. list of functions in current file i am editing
    3. list of files in folder


  • @Maxitrol-Mat

    you can always ask here for a feature request.



  • auto sort tabs in real time

    But it is really a dumb feature to use or not use an editor based upon. And…you’re not going to find any editors out there that do it.



  • Hello @maxitrol-mat, @ekopalypse, @michael-vincent, @alan-kilborn and All,

    @maxitrol-mat, you said :

    I really want auto-sort tabs because it is driving me crazy when I am coding and having 10 tabs open

    To my mind, it doesn’t seem that difficult to distinguish a particular tab among a set of 10 tabs or so ! Am I missing something, here ?


    Four tips :

    • You could un-tick the Reduce option in Settings > Preferences... > General > Tab Bar

    • You could un-tick the Darken inactive tabs option in Settings > Preferences... > General > Tab Bar

    • You may also change the color of the foreground and/or the background of these inactive tabs in Settings > Style Configurator... > Global Styles > Inactive Tabs

    • May be, dividing your tabs between the main view and the sub-view could be interesting, with the main used files in the main view and the others in the secondary view, which would be allowed a smaller area ?


    Moreover, hitting twice on the default shortcut Alt + W to get the list of all opened files, then on the Alt + T shortcut to sort them doesn’t seem an insurmountable task…, especially since you only have to do it if you open an other file, not yet present in your current N++ session !

    Best Regards

    guy038



  • @guy038

    Am I missing something, here ?

    Apart from the fact that the OP wants this automated, probably nothing.



  • Not that I think the whole concept of auto-sorted tabs has much usefulness…

    But how about a P.S. “buffer-activated” solution that checks the “order” (whatever that means, path, file, type, etc. hasn’t been defined yet, really by the OP) and if it finds an out-of-order situation, it saves the current state to a session xml file, closes all tabs (save or not could be a problem here), reorders the session file according to the sort algo, then opens the session file.



  • @Alan-Kilborn said in Open files tabs - auto-sorted how?:

    But how about a P.S. “buffer-activated” solution that checks the “order”

    That might work, but it would certainly annoy me.
    I mean, you always get the closing and opening
    and possibly confirm the task whether to save or not …
    Would definitely annoy me :-D



  • @Ekopalypse

    annoy

    Well, a use-case of questionable value (auto-sorted tabs) may spur on extraordinary suggested solutions. :-)
    Maybe the OP could say more about why the sorted tabs makes a lot of sense for his application, but I’m thinking that this might be impossible.



  • @Alan-Kilborn said in Open files tabs - auto-sorted how?:

    Maybe the OP could say more about why the sorted tabs makes a lot of sense for his application, but I’m thinking that this might be impossible.

    Yes, how we say, that would give room for further thoughts.



  • @guy038 said in Open files tabs - auto-sorted how?:

    Moreover, hitting twice on the default shortcut Alt + W to get the list of all opened files, then on the Alt + T shortcut to sort them doesn’t seem an insurmountable task…, especially since you only have to do it if you open an other file, not yet present in your current N++ session !

    If the OP really wanted to do that a lot, and since Notepad++ Macros cannot influence inside the Windows dialog box, I’d suggest an external macro-defining application, such as AutoHotKey (which I never use, but have heard good things about). In AHK, one should be able to define a macro that sends the keystrokes Alt+W Alt+W Alt+T Alt+O (I added clicking the OK when done sorting), then it could be done with a single keystroke instead of 4, which is an improvement (though not technically automatic).



  • @PeterJones said in Open files tabs - auto-sorted how?:

    such as AutoHotKey

    or maybe some SendKeys games with P.S.



  • @PeterJones said in Open files tabs - auto-sorted how?:

    I’d suggest an external macro-defining application, such as AutoHotKey (which I never use, but have heard good things about)

    OK, I bite. I scripted something related to this Window... menu item a couple of weeks ago —wanted a list of all the open tabs—, so here is my attempt (works fine here :)

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    
    #IfWinActive, ahk_class Notepad++
    !w::
    WinActivate ahk_exe notepad++.exe ahk_class Notepad++
    WinMenuSelectItem, A, , Window, Window...
    Sleep, 100
    WinActivate, Windows
    SetControlDelay -1
    ControlClick, Button4, Windows
    Sleep, 100
    ControlClick, Button5, Windows
    WinClose, Windows
    return
    #If
    

    This AutoHotkey script only works if Notepad++ is the active application —as the #IfWinActive directive stats— so it cannot interfere with other applications. Fire it pressing Alt + W, the same key combo that opens the Window... window.

    Have Fun!



  • I don’t understand why some of you are complicating this like its a rocket science. Simple tickbox either: A) Leave tabs unsorted (like it is now) B) Always auto sort in real time

    A programmer who is working on this editor, could do that in 10 minutes. I would, but I am not C programmer and I don’t have to source code.

    Its that easy… and yes, it is useful!



  • @Maxitrol-Mat ,

    You asked if it was possible. We told you how it wasn’t possible in the current application, and gave you workarounds. If you don’t like that, fine.

    We aren’t the programmers. A quick search of this forum, or the offiical Notepad++ homepage, would have directed you where to actually request new features: I’ll give you a hint, it’s not here. Oh, right, @Ekopalypse even linked you to the FAQ that explains it.

    yes, it is useful!

    Maybe so, maybe not. But no one above said it wasn’t. You may have misread Alan, who said the lack of that feature was a dumb reason to stop using Notepad++, but he didn’t say the feature itself was dumb.

    I am not C programmer and I don’t have to source code.
    Its that easy…

    There are two errors in those statements:

    1. You do have access to the source code, and you can submit PR to that source code, if you have the ability.
    2. If you are not a C programmer, then you cannot know how easy, or not, it is – especially if you have not studied the source code. Every time a user says “it only takes a few minutes, but I won’t/can’t”, that person proves they don’t have the knowledge to comment meaningfully on the programming task at hand. There are often many complicating factors that you, as a user, cannot think of immediately; one change may affect something else unexpected, or require edits in multiple sections, or…

    And, as I said before, you never asked in the right place to request a new feature , so it doesn’t matter how long it would take to program, because the developers never got the request.

    Your choices are to continue to whine, which helps no one and annoys many; to accept things the way they are and possibly use a workaround as suggested above; or to submit a feature request, and possibly use a workaround while waiting for the feature to either be added or rejected.


Log in to reply