Join us
@siddhant230 ・ Aug 26,2022 ・ 2 min read ・ 2599 views
A simple guide on this extremely simple yet rare setup.
This was my question as well a few days back; when I decided to start CP again. One thing I noticed was the abundance of articles and blogs for setting up code editors for CP using C++ as main language; it is completely natural given quick pace, macros and short syntax of C++. But, the lack of resources to set up code editors with python really bugged me. I too wanted to create the same cool looking CP window with partition; and here it is; a simple guide on this extremely simple yet rare setup. Here we go…
Step 1: Install Python
Windows: https://www.python.org/downloads/
Linux: https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-20-04-server
MacOS: https://docs.python-guide.org/starting/install3/osx/
Step 2: Install Sublime Text
Windows/ MacOS: https://www.sublimetext.com/download
Linux: https://computingforgeeks.com/install-sublime-text-on-ubuntu-debian/
Step 3: Install a good auto-complete engine
My choice for this is Tabnine, You can follow this to setup Tabnine for your sublime text in few easy steps.
https://www.tabnine.com/install/sublime
Step 4: From here, begins the most crucial part, i.e. looks, just kidding ;-)
before that, create three files as given below:
1. solution.py: The file for writing the code.
2. input.txt: The file where we will be giving the input.
3. output.txt: The file where the output will be displayed.
4. error.txt: The file where the error will be displayed.
Step 5: Changing the view : Open your sublime text, Now, perform the following steps:
Step 6: Opening all files that we created on each panel.
Simply move to the panel and press “Ctrl + O”, and select the files you want for each panel. After doing this the editor would look something like this:
Step 7: Setting up the template code; so that you need not to write same stdin and stdout everytime:
Select Tools > Developer > new snippet, and replace the existing code with the one given below:
Let me explain above snippet a bit;
Inside the <content> tag we are going to place our default code, whose first 4 lines deals with setting up your standard input/output/error to a custom file(which we already created), below that you can put any sort of template code you want(you can see mine in picture above the code snippet).
Next, we have <tabTrigger>dsa</tabTrigger>, you can replace “dsa” with anything, your name/city/any other command, the aftermath of this is that, whenever you will open a new file, type “dsa” and hit Enter, it will automatically put your template on your empty editor. Isn’t that convenient?
Step 7: Finishing up
Write your code on python file we created, and put your input onto input.txt file, to build the script, press: “Ctrl+b”, you will see your output reflected in output.txt file, which is open in 2nd panel on right view/column.
And we are done, I know a lot could be done apart from this; like creating our own build; but, I am aiming for a simple and easy to understand setup, and hopefully that is what I delivered. Do let me know in comments if you want to see the custom-build step as well; though I have to research on that a bit ;-).
Finally, All the best for your learning and Happy coding!!
For custom build, and better experience follow the simple step mentioned in second part of this article.
Join other developers and claim your FAUN account now!
Research Engineer-ML, @siemens
@siddhant230Influence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.
I think in Step 5, Part 1, you should select columns as 4 instead of 3. :)