Using PythonAnywhere in Chrome's App mode


Using Vim inside a PythonAnywhere console could be a bit annoying. A number of keyboard shortcuts are caught by the browser before they ever hit our site. Notably for Vim these include Ctrl-W and Ctrl-T.

But there is a better way! And it involves making Chrome open PythonAnywhere in it’s special application mode. In this mode absolutely none of the keyboard shortcuts are captured. It’s neat. Which is my reserved way of saying that it fixes EVERY problem I’ve had with PythonAnywhere and Vim.

I also imagine that those intrepid Emacs users will be happy to be able to send all those torturous escape sequences as well. Bless them.

Anyway, it looks like this:

PythonAnywhere as a Google Chrome app!

Notice that all of Chrome’s chrome is gone. It looks a bit like a native application. To get into this mode you have a couple of options. Firstly you can start chrome with the command line switch

"--app=https://www.pythonanywhere.com"

Or, even easier you can create a desktop shortcut via Chrome itself.

Simply

  1. Visit https://www.pythonanywhere.com
  2. Open the Chrome menu and select: Tools / Create Application Shortcuts…
  3. Tick the locations you want the short cuts to appear

And there you have it. Now you can start an appified version of PythonAnywhere from your Start / Application menu and or desktop shortcut.

Try it out, it’s made vim in a PythonAnywhere console indistinguishable from using it in a local console for me.

ps: If you are wondering what the hell that decorator is actually doing in the screenshot. It’s something we use for testing. It’s a decorator that decorates decorators and provides a set of the decorators used to decorate the function. It means we can easily assert that a function has been decorated by a particular decorator. Clear?

comments powered by Disqus