Plugin: Space Indenter

Space Indenter

I find spaces to be a bit easier to manage on the mobile (compared to tabs, which I hold in respect), so I looked for a solution.

This plugin exposes CodeMirror's relevant settings to Joplin users, which enable switching between tab indentation and space indentation, and... that's it.

AFAIK replacing tabs with 4 spaces is OK as far as CommonMark is concerned, and in practice most things work as expected even with 2 spaces. If there are caveats to this approach, please discuss below.

Thanks to Rich Markdown (@CalebJohn), that heavily influenced this implementation.

4 Likes

@shikuz, I prefer to set editors to use 4 spaces rather than tabs, so this is a welcome addition.

On testing, it doesn't seem consistent, sometimes it will insert a tab character, and sometimes four spaces. I can't figure out a particular pattern to it.

Setup in use here:
Joplin 2.8.8 (prod, linux)
Client ID: 615c7880d02145c5a89371d6264bdcb9
Sync Version: 3
Profile Version: 41
Keychain Supported: No
Revision: c2a6a13

CodeMirror's logic in this case is indeed a bit obscure, but I believe the following rules apply:

key / event result
Indent less/more command (Edit menu) SPACE
TAB while text is selected SPACE
TAB on an empty bullet/checkbox line SPACE
TAB on any other event (e.g., cursor in mid-line) TAB
2 Likes