Hi guys,
I’m Conrad- a new member of the PythonAnywhere team. As a rather junior and beginner programmer, I would like to share with you my story of how I set up my work environment- my rationale for choosing and customizing my text editor, my shell, my windows manager etc, and what I learned along the way.
When I started out on this project, I had two goals in mind: to be as lazy as possible, and to be as scalable/consistent as possible (ie. be able to take what I learnt and setup the same thing quickly and easily on a new PythonAnywhere project, on my mac laptop, on a Ubuntu server, on a friend’s Window machine… etc with zero extra changes/tweaks).
When it comes to being lazy, some may say that I have quite an extreme stance, including using as much automation as possible, and tweaking my key bindings and other work conditions to be as ergonomic as possible:
-
For any sort of typing, I want to do it with the least number of key strokes.
- eg: Instead of
cd
, I have an aliasg
that does exactly the same thing. - If you are a Python programmer, you probably use colons a lot more than semi-colon. So I switched
:
with;
so I won’t have to press shift as often.
- eg: Instead of
-
If anything can be done automatically, I don’t want to have to call it/click it/run it myself.
-
eg: I have a shortcut to edit my bashrc/vimrc and and then source/reload it automatically after I save.
-
For you PythonAnywhere webapp users reading this, I also have a bash alias to reboot my webapp from the console:
> touch /var/www/<your-web-domain>_wsgi.py
Do you recognize this file path? It’s your wsgi.py file that you have likely been editing when you customize your webapp!
-
-
If I do need to type, I don’t want to move my fingers too much from their resting positions (ergonomics!!).
- eg: My vim and tmux leader keys are Space and Ctrl+Space, because your thumb is the strongest/most underworked finger, and is natually resting on the Space key already.
- Interestingly, there are a lot of limitations to using Ctrl + x or Alt + x type commands as shortcuts. This is because some Ctrl + x and many many alt + x keys gets captured by your operating system, or your browser etc to do whatever shortcut they have set. To be able to have consistent key mappings across platforms, you probably want to avoid depending on too many Ctrl/Alt key shortcuts.
- Having said that, there are definitely a couple local mappings I do enjoy, even though I run the risk of not having these mappings available when working on different operating systems, or working on someone else’s computer:
- I switch Escape with Caplocks, since I use the Escape key so much more often.
- I also switch the Left Alt key with the Left Ctrl key, so that I can use my thumb instead of extending my pinky when I need to hit ctrl, and so that both alt and ctrl are accessible from my thumb. Currently I have Left Alt and Left Ctrl switched (instead of Right Alt and Right Ctrl), because I want to be able to use my mouse and copy/paste with a single hand. However, when purely typing, ergonomically it makes more sense to hold down shift/ctrl/alt with one hand and press the other key with the other hand. So maybe, I’m thinking, the ideal solution is actually to swap Right Alt and Right Ctrl, and use the mouse when needed with your left hand! They do recommend switching mouse hands for people with RSI…
-
There are other aspects to ergonomy as well: why have your editor take up just half the screen and then have to squint because the font size needs to be smaller to fit into your editor?
Here is a quick tip for PythonAnywhere users: adding “/frame” to the end of your console url will take you to a page with just the console frame. That extra bit of screen real estate basically means that you can have larger fonts if you like, or you can browse through two files in parallel easier within a vim split pane (as below), or you can actually see a couple lines of commands on your mobile phone after your keyboard pops up and blocks half the screen etc.
If you do that, here is what you get when working with PythonAnywhere in full screen:
WOW LOOK AT THIS PYTHONANYWHERE CONSOLE IN MY WORKSPACE! Now look below… Now back up top, now back down, now back up. Sadly, the bottom PythonAnywhere console will never be in my workspace, but if it had used the /frame hack, it could at least look like it’s my console.
Not even comparable.
In any case, a lot of this may of course just be attributable to personal preference. Having rambled on for so long and gotten severely off topic, I am going to end this blog post for now. But keep your eyes peeled for a follow up post soon on what my work setup actually looks like, featuring tmux, a bootstrapping bash script to setup my configs, and many more other goodies and adventures along the way!