Forum Archive

Editor configurability?

flip

Curious as to how configurable the editor is. I'm using an iPad Pro + the apple smart keyboard and would love to make various emacs-y things work correctly. This begs two questions:

  1. Is there a 'cheat sheet' around for the current editor keyboard configuration? Some of the 'smart' keyboard features (like the = -> != for example) don't seem to work when I have the Smart Keyboard attached, so it would be nice to know what does what etc.

  2. It appears that the editor is, itself, python. Are there configuration options somewhere?

dgelessus

If you hold down the command key, iOS will display an onscreen list of all key bindings. This works with any app that has hardware keyboard shortcuts under iOS 9. From my experience the list isn't always complete though, I don't exactly know why. Pythonista's is correct though as far as I can tell.

The editor is not written in Python, it's in Objective-C like the rest of the app. The editor module was previously a Python extension module written in (Objective-)C, now I think it's Python code that uses objc_util to work with the editor internals.

JonB

Are you using the app store version, or the beta? I think some of these issues were recently fixed in the beta

The editor is written in objc, however the editor module has quite a few useful features for getting/setting text. There are a few undocumented functions in this module, so it might be worth opening the editor module to see what is there. You can navigate to Standard Library-> site-packages-> editor.py

While the editor is in objc, with the objc module, there is a fair bit of customization possible.

For instance, you can make your own keyboard shortcuts:

https://forum.omz-software.com/topic/2609/custom-keyboard-shortcuts
https://forum.omz-software.com/topic/2049/possible-to-subclass-uiview-and-redefine-keycommands-property/7

You can create shortcuts to the add new file menu, or navigate direct to the file explorer
https://github.com/jsbain/objc_hacks/blob/master/addnewfileshowchooser.py

One could put these customizations into pythonista_startup.py in site-packages to make them "permanent". Or run from the wrench menu.

flip

Beautiful- Thanks for the pointers to that stuff! (Sadly, I can't quite get good 'search' results using the in-forum search, easier/better to Google externally... heh)

I'm using the AppStore version. I suppose I should ask to be put on the beta to try this out.