CP Editor is a native Qt-based code editor written in C++. It's specially designed for competitive programming, unlike other editors/IDEs which are mainly for developers. It helps you focus on your coding and automates the compilation, executing and testing. It even fetches test cases for you from webpages and submits codes on Codeforces!
- Submit code on Codeforces inside the editor.
- Parse problem example test cases from over 30+ online platforms, and test on them with verdict feedback.
- You can use code snippets conveniently.
- Fast and memory efficient. Runs flawlessly on low-end devices.
- Code formating using clang-format.
- Customizable hotkeys for actions in the editor.
- Over 5 themes to choose from (Drakula, Monkai, Solarised, Solarised Dark and Light).
- Supports Multi tabs.
Head over to the release page and download the binary/installer depending upon your OS.
- Windows users can find a
setup.exefor installation. - Linux users can find an
AppImage:chmod +x <AppImagePath>or make it executable in GUI by right-clicking on it.- Just run it, either from bash or in GUI.
- Mac users please install from source for the time being.
For Chinese users who are not convenient to download on Github, there is an alternative download link (it's not guaranteed to be up to date).
-
Install
g++/python/javadepending on which language you are using. Make sure that they are in the system PATH so that you can run them directly in the command line. -
Set the preferences in the preference window. Make sure that
clang-formatis in the system PATH if you want to use it. -
If you want to use the Competitive Companion for parsing examples from online platforms like Codeforces, install it here. Don't forget to set the same port for the editor and the browser extension.
-
If you want to use CF-Tool for submitting on Codeforces inside the editor, install it here. Don't forget to configure it by
cf config(set the user and the template).
You must not make your Java class public, and the name of the class should be a .
| Shortcut | Description |
|---|---|
| CTRL+N | Launches a new session and resets the editor. Once you solved a problem you need to launch a new session for the next problem. |
| CTRL+Q | Quit and exit application |
| CTRL+O | Opens a new source file into the editor |
| CTRL+S | Saves the current content of editor to a File |
| CTRL+Shift+S | Saves as |
| CTRL+Alt+L | Formats the editor using clang-format, format selection only if there is a selection |
| CTRL+Shift+R | Compile and Run |
| CTRL+Shift+C | Compile only |
| CTRL+R | Run |
| CTRL+K | Kill all running Test cases / Samples |
| CTRL+Shift+D | Run the program in a separate window (Detached mode) |
| CTRL+T | Use any saved snippet codes |
The key bindings for the code editor are here and here.
You can also set hotkeys for all of the above actions manually from Preferences. However the standard keys are fixed and cannot be changed, hotkeys are additional shortcuts.
-
Clone this repo:
git clone https://github.com/coder3101/cp-editor.git cd cp-editor git submodule init git submodule update -
Install Qt (5.12 or higher) and CMake.
-
Set environment variable
CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake. -
Run the following commands:
-
Linux:
mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build .
-
Windows:
mkdir build cd build cmake .. cmake --build . --config Release
-
If you found any bugs or have any feature requests, please open an issue here, and don't forget to follow the issue templates. Users' responses are important for contributors to improve the project.
If you want a try on developing, you can install Qt and CMake, then fix bugs / make new features by yourself! After finishing the coding, just open a pull request here. Don't worry if you are not familiar with Qt / GUI programming, Google is your friend, and Qt is a well documented library. Don't forget to use .clang-format file in the root directory to format the codes.
Contributions are always welcomed. Together we can build the best editor for ourselves.
You can join the Telegram group for asking quetions about using the editor / developing.
- Where does the editor save my code and binary executable?
- The editor does not save your files if you don't save them yourself. You can find your binary executable at
C://Users/<NAME>/AppData/Local/Temp/a.exein windows and on NIX in/tmp/a.out. At those locations, the source file could also be located with the namesol.cpp.
- The editor does not save your files if you don't save them yourself. You can find your binary executable at
- I am using it in Java and the editor is not working.
- Make sure
javaandjavacare in PATH variables. Please Log/Restart your machine if it does not recognize the Java Compiler. Now make sure your source code has non-public class named a.
- Make sure
- I get DLL Missing error while launching the application?
- What is Competitive Companion and how do I set it up to parse test cases from websites?
- Please read this blog carefully. It has detailed instructions on setting up the competitive companion to parse test cases.
- What is CF-Tool and where to download it?
- CF tools provide you to perform many actions like submitting code on Codeforces from the command line. It is a CLI application that can be downloaded from here. It is a standalone executable, simply keep it in a directory and add that directory to PATH.
- I am using it on Codeforces but the submit button is not clickable.
- Please reboot if you have already added
cfto your PATH. If you haven't already, addcfto your PATH. Submit button will be active only if the editor finds that thecftool is on PATH and invokable.
- Please reboot if you have already added
- When I click on Submit on Codeforces, I get some message saying template is required?
cftool requires that you first configure it before you use it. Please read this blog carefully to configure it for your device.