"Use tabs: off" only replaces tabs with spaces in lists

Info

When Use tabs is toggled off under Settings --> Editor, a certain number of spaces (I’m assuming 2, but it does not say) should be inserted when Tab is pressed instead of a tab character as stated; however, that is not the case. Tab characters are still inserted when Tab is pressed.

Steps to reproduce

  1. Set Settings --> Editor --> Use tabs to off
  2. Go to any note and press the Tab key on your keyboard

Expected result

2 spaces should be inserted into the note.

Actual result

1 tab character is inserted into the note.

Environment

  • Operating system: Windows 10 Pro for Workstations
  • Obsidian version: v0.8.1 (Although I believe this has been a bug in previous versions)

Additional information

I also noticed that if I opened up a new line via Enter or o in Vim mode, it would insert spaces no matter if the previous line was indented with spaces or tabs. If I set Use tabs to on though, and the previous line was a list item indented with spaces, then it inserts spaces still, but if the previous line was indented with spaces and not a list item, it inserts a tab character. So, this settings’ behavior seems to be fairly unpredictable when it comes to indentation as well as pressing the Tab key.

I didn’t see a setting for it, but it would also be useful to configure the number of spaces that the Use tabs setting would insert when set to off.

1 Like

I’ve been surprised by this today.

With use tabs on off:

If you are on a list, like this (| is the cursor)

- Hello|

And press Enter + Tab, you get spaces.

But, if you are just on plain text:

Hello|

And press Enter + Tab, you get a tab.

Just wanted to mention that I was fighting formatting the markdown for a list of checkboxes to align appropriately and I was having problems because a tab snuck in a previous list item. It was frustrating.

I searched, and in the last week I have 3 files with tabs in some of the list items.

This is usually invisible but when it bites you it is quite frustrating to figure out :sob:

I have double checked this issue. I agree with @joakin that the setting work only in list and not elsewhere.
So we either fix this or clarify what the toggle does.

EDIT: renamed topic

Personally, I believe this setting should definitely apply to all whitespace indentation. It would be a little silly and inconsistent to mix tabs and spaces in the same file in my opinion. I am a software engineer and always use spaces in everything I write (except Makefiles of course). It also makes it easier to use other unix tools with plain text files such as these.

2 Likes

The setting should definitely change all tabs to spaces.
Everything else makes no sense whatsoever.

I realized today the this behavior is what caused this bug report from me:


Because sometimes I write the lists by hand it apparently entered a tab when the rest of the list was using spaces.