• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
8 Posts 4 Posters 2.7k 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.
  • P
    perlsmith
    last edited by May 15, 2018, 6:58 PM

    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…

    C 1 Reply Last reply May 15, 2018, 11:30 PM Reply Quote 2
    • C
      Claudia Frank @perlsmith
      last edited by Claudia Frank May 15, 2018, 11:30 PM May 15, 2018, 11:30 PM

      @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

      1 Reply Last reply Reply Quote 2
      • P
        perlsmith
        last edited by May 16, 2018, 11:58 AM

        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.

        S 1 Reply Last reply May 16, 2018, 12:20 PM Reply Quote 0
        • S
          Scott Sumner @perlsmith
          last edited by Scott Sumner May 16, 2018, 12:21 PM May 16, 2018, 12:20 PM

          @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. :)

          1 Reply Last reply Reply Quote 2
          • C
            cipher-1024
            last edited by May 16, 2018, 8:32 PM

            @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!

            C 1 Reply Last reply May 16, 2018, 9:04 PM Reply Quote 1
            • C
              Claudia Frank @cipher-1024
              last edited by Claudia Frank May 16, 2018, 9:05 PM May 16, 2018, 9:04 PM

              @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

              1 Reply Last reply Reply Quote 1
              • P
                perlsmith
                last edited by May 17, 2018, 3:13 AM

                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…

                C 1 Reply Last reply May 17, 2018, 10:57 AM Reply Quote 0
                • C
                  Claudia Frank @perlsmith
                  last edited by May 17, 2018, 10:57 AM

                  @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

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