Aloso / Rust wiki editor shortcuts

Published:

Version: 1.2.2+30854f2 updated

Summary: Configurable keyboard shortcuts for the Rust wiki editor

Copyright: 2020, Aloso (https://openuserjs.org/users/Aloso)

License: MIT

Keyboard shortcuts for the plaintext editor of the Rust wiki.

Warning: Unfortunately this script doesn't work properly in Chrome because of MediaWiki's keyboard shortcuts, which can't be disabled in Chrome.

To view the available shortcuts, open the browser console (press F12 and go to the "console" tab) and enter

showShort()

To add, remove or change shortcuts, follow the instructions in the console. To show help information, type

help()

Note that the shortcuts only work in the plaintext editor, not in the visual editor. The editor must be focused, some shortcuts also require that some text is selected.

Add shortcuts

To add a shortcut, enter something like the following in the console:

setShort('alt+x', 'prefix', 'postfix')

This adds two shortcuts, alt+x and alt+shift+x. The first shortcut wraps the selected text between prefix and postfix, the second one removes the prefix and postfix. For example, when you select TEST and press alt+x, it will be replaced with prefixTESTpostfix.

Remove shortcuts

Shortcuts are removed with the delShort function:

delShort('alt+x', 'alt+shift+x')

You can specify as many shortcuts as you want.

What if a shortcut doesn't work?

Counterintuitively, you have to write the key the way it would be printed in a text field. For example, you have to write shift+F instead of shift+f, and alt+shift+! instead of alt+shift+1 on a German keyboard.

Maybe you specified the modifier keys in the wrong order. The order must be meta, ctrl, alt, shift. They must be lowercase. Furthermore, the meta key might not work in your browser.

To check what the correct shortcut for your key combination is, open the browser console, enter

KEY_DEBUG = true

and then press the key combination, while the wiki editor is focused. The correct shortcut should now be printed to the console.

Rating: 0