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. In addition, it can automatically reformat your notes (if enabled in the settings) and convert any existing tabs to spaces (or vice versa, if you decide you're a tab-person after all). A dedicated toolbar button calls the same action manually.
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.
@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
in any context, the tab key is always converted to spaces (based on the parameters in the plugin's settings)
when pressed anywhere on a list item, the tab key indents the line using spaces
new toolbar button: reformat tabs, which converts all tabs in the current note to spaces (or changes spaces back to tabs, when the plugin is set to indent with tabs)
new setting (off by default) to apply the above reformatting to any note when it's being loaded
Welcome @rainiur! I hope that I understood your question correctly.
The plugin can change what happens when you press the Tab key (switch between spaces or tab).
The plugin can also modify existing notes when you open them, and replace Tab >> Spaces, or Spaces >> Tab (Joplin Settings --> Space Indenter --> Automatic find & replace of tab --> space (or vice versa)). There is also a toolbar button for this command: Reformat note with spaces/tabs.
Alternatively, you may continue to use Tabs but change how they are displayed, that is how many Spaces will be shown for each Tab (Joplin Settings --> Space Indenter --> The width of a tab character. Defaults to 4.). In this case the note is not being edited, only the way that it is viewed changes.