Skip to content

Instantly share code, notes, and snippets.

@Beercow
Last active September 13, 2023 03:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Beercow/980a533f0b9f13b454568812fa1df70a to your computer and use it in GitHub Desktop.
Save Beercow/980a533f0b9f13b454568812fa1df70a to your computer and use it in GitHub Desktop.
  1. Install Notepad++ (check "set as default HTML editor" to replace Notepad in IE).

  2. Run Notepad++, update its plugins, and install "NppExec" via Plugins, Plugin Manager.

  3. Download DBGpPlugin . Place in C:\Program Files (x86)\Notepad++\plugins\DBGpPlugin

  4. Use this link to download a modified version of the Komodo Remote Debugging Package. Place in plugin directory. (Unmodified Komodo package does not work with DBGpPlugin) Also contains DBGpPlugin

  5. Enter these scripts for Python debugging:

    Press F6 to create a NppExec Execute script, save as "Run Python":

    cd "$(CURRENT_DIRECTORY)"
    py.exe "$(FILE_NAME)"
    

    To mark and link (by double-click) errors, press Shift+F6 to add active Console Output Filters, with Red set to FF:

    *File "%FILE%", line %LINE%,*
    
  6. And context-sensitive help using Shift+F1 (because F1 alone now shows About):

    <Command name="Get Python help" Ctrl="no" Alt="no" Shift="yes" Key="112">https://www.google.nl/#q=python+$(CURRENT_WORD)</Command>
    

    in %appdata%\Notepad++\shortcuts.xml (use a different editor for this to work)

  7. Add style checking using PyLint (pip install pylint):

    Press F6 to create a NppExec Execute script, save as "Run PyLint":

    C:\Python27\Scripts\pylint.exe --reports=n -f parseable "$(FULL_CURRENT_PATH)"
    

    To mark and link (by double-click) errors, press Shift+F6 to add active Console Output Filters, with Red set to FF:

    %FILE%:%LINE%:*
    
  8. Better Python Standard Library Autocompletion for Notepad++

  9. Configure DBGp:

    • Plugins -> DBGp -> Config...
      • Check "Bypass all mapping (local windows setup)"
      • Check "Refresh local context on every step"
      • Check "Refresh global context on every step"
      • Check "Break at first line when debugging starts"
  10. Enter these scripts for Python DBGp debugging:

    Press F6 to create a NppExec Execute script, save as "python2 debug":

    NPP_SAVE
    cd "$(CURRENT_DIRECTORY)"
    NPP_MENUCOMMAND Plugins\DBGp\Debugger
    INPUTBOX "Command Line Arguments: "
    py -2 "$(NPP_DIRECTORY)\plugins\PythonDebug\pydbgp.py" -d 127.0.0.1:9000 "$(FILE_NAME)" $(INPUT)
    

    Press F6 to create a NppExec Execute script, save as "python3 debug":

    NPP_SAVE
    cd "$(CURRENT_DIRECTORY)"
    NPP_MENUCOMMAND Plugins\DBGp\Debugger
    INPUTBOX "Command Line Arguments: "
    py -3 "$(NPP_DIRECTORY)\plugins\PythonDebug\py3_dbgp.py" -d 127.0.0.1:9000 "$(FILE_NAME)" $(INPUT)
    
  11. If you have a dark theme, use this to make tool tips dark:

    Press F6 to create a NppExec Execute script, save as "SetCallTipStyle":

    NPP_CONSOLE -
    // use CALLTIPSTYLE instead DEFAULT
    SCI_SENDMSG SCI_CALLTIPUSESTYLE 0
    // background to black ( 0 )
    SCI_SENDMSG SCI_CALLTIPSETBACK 0xa4a4a4
    // foreground to white ( 0xffffff )
    SCI_SENDMSG SCI_CALLTIPSETFORE 0xffffff
    NPP_CONSOLE +
    

    Then, navigate to Plugins -> NppExec -> Advanced Options offers the option Execute this script when Notepad++ starts on the upper right area of the config dialog. Select the script name under which you saved the line (e.g. SetCallTipStlye)

  12. Not related to python. Replace perl section in functionList.xml with:

        <parser
            displayName="PERL"
            id         ="perl_function"
        >
            <function
                mainExpr="^\s*(?&lt;!#)\s*sub\s+\w+\s*\(?[^\)\(]*?\)?[\n\s]*\{"
            >
                <functionName>
                    <nameExpr expr="(sub\s+)?\K\w+" />
                </functionName>
                <className>
                    <nameExpr expr="\w+(?=\s*::)" />
                </className>
            </function>
        </parser>
    
@Beercow
Copy link
Author

Beercow commented Feb 21, 2020

NPP_Python_IDE

@CaptchaCenter
Copy link

Can you please give a link to the archive already made according to your manual notepad ++? I'm tormented by your manual for a long time, but nothing comes out, downloading old 32 bit versions of notepad ++, and the plugin constantly gives errors. My pycharm has become very slow when debugging and running simple programs.

@Beercow
Copy link
Author

Beercow commented Aug 11, 2023

@mischa-94 are you talking about number 4. Just updated it.

@CaptchaCenter
Copy link

@mischa-94 are you talking about number 4. Just updated it.

I'm veryy sorry, I've tried again but an error pops up - - the file cp1251.py appears, it's something with encoding I think. And I have 2 questions - what version of notepad do you use? 32 bit? And what to type in "exit command" window when it pops out? Nothing?

@CaptchaCenter
Copy link

@Beercow also about your manual - you can correct number 6: https://www.google.nl/#q=python+$(CURRENT_WORD) doesn't work right now, so you can change it to https://www.google.com/search?q=python+$(CURRENT_WORD), and I will write more npp scripts that you can do if your notepad++ works for me :)

@Beercow
Copy link
Author

Beercow commented Aug 11, 2023

It’s been a while since I set this up from scratch. 32 bit because there was only a 32 bit version of DBGp at the time. Have not tested with the 64 bit version. Can you attach the exit window. It’s been a while since I’ve used this.

@CaptchaCenter
Copy link

@Beercow thanks a lot for answering! It's okay, I understand everything. Can you please in the manual and give me a link to the notepad ++ program already configured according to your manual? It will be just a great gift! Somewhere also on mega or somewhere else.
I also promised to give nppexes scripts, here they are:

you can run all code in python interactive console
cd $(CURRENT_DIRECTORY)
python -u -i $(fILE_NAME)

you can run interactive python console just without code:
cd $(CURRENT_DIRECTORY)
python -i

you can run your python code (or programm) in your created venv directory and note in standart python enviroment:
cd "$(CURRENT_DIRECTORY)"
env_set PYTHONIOENCODING=utf-8
"$(CURRENT_DIRECTORY)\venv\Scripts\python.exe" -u "$(FULL_CURRENT_PATH)"

If you opened cmd console in notepad++ and you exit notepad, an window will occur to kill process. To prevent that, you can silently kill process with script:
set @exit_cmd_silent = exit and make this script run when notepad++ starts (like in number 11 of your manual, you can just put it together

Also to exit interactive python console, press ctrl+c, it didn't work in pycharm for me but works here.

Too bad I also couldn't create a silent exit for the interactive console.
There is PyPadPlusPlus where you can run part of the code but it's not necessary with the interactive console, just put the code you need there and it will work. Good for a beginner.

@CaptchaCenter
Copy link

@Beercow dear friend, do you still have this tuned version of notepad++? Can you please upload it to a file hosting service if you have left?

@nikoxf
Copy link

nikoxf commented Aug 30, 2023

I followed the instructions and it works. If you install the latest 64 bit DBGpPlugin, change the port to 9003.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment