How to compile and run C files from within Notepad++ using NppExec plugin?

前端 未结 10 1448
北荒
北荒 2020-11-30 00:45

How can I configure the NppExec plugin for Notepad++?

I would like NppExec to compile my C files, run them, and show their output, all within Notepad++.

10条回答
  •  青春惊慌失措
    2020-11-30 01:08

    For perl,

    To run perl script use this procedure

    Requirement: You need to setup classpath variable.

    Go to plugins->NppExec->Execute

    In command section, type this

    cmd /c cd "$(CURRENT_DIRECTORY)"&&"$(FULL_CURRENT_PATH)"
    

    Save it and give name to it.(I give Perl).

    Press OK. If editor wants to restart, do it first.

    Now press F6 and you will find your Perl script output on below side.

    Note: Not required seperate config for seperate files.

    For java,

    Requirement: You need to setup JAVA_HOME and classpath variable.

    Go to plugins->NppExec->Execute

    In command section, type this

    cmd /c cd "$(CURRENT_DIRECTORY)"&&"%JAVA_HOME%\bin\javac""$(FULL_CURRENT_PATH)"
    

    your *.class will generate on location of current folder; despite of programming error.

    For Python,

    Use this Plugin Python Plugin

    Go to plugins->NppExec-> Run file in Python intercative

    By using this you can run scripts within Notepad++.

    For PHP,

    No need for different configuration just download this plugin.

    PHP Plugin and done.

    For C language,

    Requirement: You need to setup classpath variable.
    I am using MinGW compiler.

    Go to plugins->NppExec->Execute

    paste this into there

       NPP_SAVE
    
       CD $(CURRENT_DIRECTORY)
    
       C:\MinGW32\bin\gcc.exe -g "$(FILE_NAME)" 
    
       a
    

    (Remember to give above four lines separate lines.)

    Now, give name, save and ok.

    Restart Npp.

    Go to plugins->NppExec->Advanced options.

    Menu Item->Item Name (I have C compiler)

    Associated Script-> from combo box select the above name of script.

    Click on Add/modify and Ok.

    Now assign shortcut key as given in first answer.

    Press F6 and select script or just press shortcut(I assigned Ctrl+2).

    For C++,

    Only change g++ instead of gcc and *.cpp instead on *.c

    That's it!!

提交回复
热议问题