Disable autocomplete on a per file (tab/window) basis and with shortcut



  • It looks like a global setting that applies to everything. Is there a way to suspend it for this tab/window only ?

    How about accessing the setup easily through a keyboard shortcut? I’d settle for that.

    For code, autocomplete is great, but for a general notes type of doc, it’s annoying…



  • @perlsmith

    at the moment I think the only way to have it work like you described is to
    use a scripting plugin and define a set of character that when typed cancel
    the auto-completion list. Hoping that this won’t result in screen flickering.
    Something like this

    editor.autoCStops('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-+!?')
    

    Cheers
    Claudia



  • Ok. I was hoping for something like CTRL-F8 :) (to toggle the enable/disable of autocomplete)

    Does Notepad++ come with a command language - I haven’t done any homework on this. For now, my solution is to open the file I don’t want Autocomplete on in sublime.



  • @perlsmith

    Does Notepad++ come with a command language

    Not quite sure what you mean here, but what first comes to mind is what Claudia mentioned: scripting. Check this out for more info on that: https://notepad-plus-plus.org/community/topic/15297/scripts-creating-editing

    I suppose the built-in auto-complete feature bothered me similarly, because I have long-since turned it off and scripted my own autocomplete that works like the one in the editor I used to use. Turning it back on now and setting the # of characters in a word before completion occurs to 3 I found that, while annoying, it is possible to simply ignore it and type on through. However, it would be nice to be able to disable it such as you describe.

    A totally separate editor just to avoid this seems extreme, though. I might be tempted to unmothball notepad.exe in such situations. :)



  • @persmith, Claudia’s solution works for me, and you can save the python script and assign it a shortcut key combo like CTRL-F8. I don’t see any way to GET the autocomplete stops, so I don’t know how to make that into a toggle, but you can make another python script that empties the stops like this:

    editor.autoCStops('')
    

    And assign it another shortcut like CTRL-SHIFT-F8 so you can re-enable autocomplete. I didn’t notice any performance issues with the script. Thanks Claudia!



  • @cipher-1024

    in order to make a toggle script you could request an unique identifier,
    if it exists would e.g. mean it is active and if it doesn’t exist or is set to false then
    it is inactive. So something like

    try:
        if AUTO_COMPLETION_TOGGLE == True:
            # reenable it
            editor.autoCStops('')
            AUTO_COMPLETION_TOGGLE = False
        else:
            # disable it
            editor.autoCStops('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-+!?')
            AUTO_COMPLETION_TOGGLE = True
    except:
        # disable it'
        editor.autoCStops('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-+!?')
        AUTO_COMPLETION_TOGGLE = True
    

    should do the trick.

    Cheers
    Claudia



  • Appreciate it. Looks like the answer is here, but I’m a total noob. I would have to learn a lot to implement the solution. Any chance someone could create a doc with screen captures to walk a newbie through the steps so that there is no learning to do? I know this is asking for spoon-feeding, but…



  • @perlsmith

    1. Install PytonScript Plugin using PluginManager
    2. Plugins->Python Script->New Script and give it a meaningful name
    3. copy and paste the script
      (don’t modify if you don’t know python and make sure that the layout
      is exactly the same as posted, because python needs this indention to
      identify its code blocks)
    4. save it
    5. Plugins->Python Script->Configuration and add it to the Menu
    6. Optional: in same window change Initialisation from LAZY to ATSTARTUP
    7. Restart npp

    Now you should see that under Plugins->Python Script your script is shown.
    As it is now in the menu section you can add/modify a shortcut in the normal way
    by using menu Run->Modify Shortcut/Delete Command and search in the Plugins Command
    tab for your script.

    Cheers
    Claudia


Log in to reply