Check : https://cpeditor.github.io
CP Editor met Competitive Companion in 3.0, giving it the ability to parse contests from over 30+ online competitive programming websites. Now, with CP Editor 5.0, it met CF tools, a wonderful tool by xalanq which can do all most everything in code-forces, even submit solutions. Read more about CF tools in his blog.
If you are a pro-user and like vim keybindings, using cf-tools on your favorite terminal with tmux would give your more than what CP Editor has to offer but at the same time, it is very time consuming and difficult to setup on windows.
Let's dive into what is new for us in CP Editor 5.0
- Submit solution to Codeforces from CP Editor, you don't need to copy or upload your solutions manually. Let CP Editor do it for you with just one button click. This feature requires that you have
cf-toolsinstalled and you have correctly configured cf-tools. Read the instructions below on how to install and setup
cf-tools. Please note the submit button will be only visible in the editor if the problem was parsed by Competitive Companion from code-forces.
First download the zip file which contains CF-tool. It will be one single file with no dll or dependencies. You can download it from https://github.com/xalanq/cf-tool/releases
Now you need to add it to your SYSTEM ENVIRONMENT PATH. Here is how I prefer to add it. First Create a new directory in your Home directory (in windows C:\Users\<name>) named bin, and copy cf to that directory. Now your cf is located in ~/bin/cf (in unix) or C:\\Users\\bin\cf.exe (in windows). Add this directory to your PATH just like normal. Alternatively, UNIX users can directly copy cf to /usr/local/bin
Verify if you added it to your PATH correctly by opening a new terminal or command window and typing cf --version. If you get the version proceed to next step, else go to step 2 and follow (re)carefully.
Now you need to login to code-forces using cf tools. In a command window type cf config and then choose type 0 (username and password). Enter your username and password of code-forces. If everything goes well, cf tool will say login succeeded!
Now you need to set templates in cf tools. In our case templates will decide which code-forces language to choose when doing a submission (there are many C++ compiler, which to use? when uploading .cpp file). Follow the given steps below to add a template to cf tools (in this case Python). You may need to do add up to 3 templates for each language. If however are sure you will never use java then you can skip addition of java template.
5.1 Open a command window or terminal.
5.2 Type cf config
5.3 Choose index 1 (add template)
5.4 Select a language index (this is the language you want to submit on codeforces with, 31 for python3)
5.5 Now cf tool will ask for any template for selected language.
5.6 Type in an absolute PATH to any file with language extension. (It must have .py extension in this case)
5.7 Now it ask other suffix. Keep it empty
5.8 Now it will ask for Template alias. Type in extension of language (py in this case)
5.9 Now it asks before script. Keep it empty
5.10 Now it asks script. Type anything (say "dummy" in this case)
5.11 Not it asks after script. Keep it empty
5.12 Make it default (NO)
You should repeat step 5.1 to 5.12 for other language as well. Make sure that you change the file extension in 5.8 and file in 5.6 (It can be an empty file but must be one of .cpp or .py or .java extension depending upon language for which you are adding template)
Now nothing is needed, yes make sure to reboot or sign out for updated PATH variable to be visible to CP Editor. Make sure you don't create two different templates for same language, if you did so by mistake please delete one with cf config -> remove template.
- Set up snippets of codes like Sublime Text, You can add as many snippets as you want in all 3 officially supported languages in CP Editor. You can set up hotkeys for triggering snippets and then search for your snippets and paste it into text editor. You can even rename snippets. Snippets are language defined, you won't find C++ Snippets when your Tab language is set to Python. All snippets are stored inside cp_editor_settings.ini file, which is located in your home directory and contains all the settings of CP Editor. This also, portable and platform independent. In order to inspect it, you can open it like any normal text file.
Big Thanks to ouuan for his work in making snippets available.
View Modes: CP Editor now has 3 view modes, in Editor mode the complete window of the application will be occupied with Code Editor, in IO Mode complete window will be occupied by Input output boxes and normal mode is called Split Mode, in which window is shared between the two. You can even set hotkeys to toggle the views from Preferences for a quick change of view modes.
You now have ability to just apply settings. There are three options, "Okay", "Apply" and "Cancel", Okay will close the window and settings will be applied and Apply will keep the preference window open while settings are applied and Cancel will close the preference window.
There are many other bug fixes and quality of experience improvements. There are some performance improvements too.
Sources : https://github.com/coder3101/cp-editor
- Star the project and spread the word about this editor.
- else you can open Editor and Help -> Support me, to buy me a coffee
I will be busy with my new semester and also with Google Summer of Code 2020, Hence pace of development will slow down a bit for this project starting today.
Telegram group for community
Please join our telegram group https://t.me/cpeditor
You have can discuss, share your views and get helped or help other there.