Option to disable tab to indent

Use case or problem

Whilst this is not a problem in native Obsidian, with plugins such as GitHub - ArianaKhit/text-snippets-obsidian: Snippets plugin for obsidian, and tools like AutoHotKey, it is incredibly useful to be able to reserve the tab key for expanding snippets, e.g. for faster LaTeX.

Currently, when tab is pressed the whole line is indented.

  1. Indenting does not seem too useful unless you write a lot of code blocks. Many users do not.
  2. This doesn’t seem like the expected behaviour (c.f. all of the forum posts linked below!)

Proposed solution

Have an option to either turn off tabbing entirely, or revert to how tabs worked pre-Live Preview.

Current workaround (optional)

Workarounds include using the Legacy Editor (but then there are other problems such as the vimrc plugin not working - although of course that’s a community plugin, so not in the scope of a feature request)

Or indeed just not pressing the tab key!

Related feature requests and problems

https://forum.obsidian.md/t/allow-the-tab-key-to-insert-tab-characters-in-the-new-editor/29308

https://forum.obsidian.md/t/create-tabs-or-spaces-at-the-position-of-your-cursor/28488/14

10 Likes

Use case or problem

In the new editor (Version 0.13.14), it is not possible to insert tab characters with the Tabkey inside lists and LaTeX blocks.
Currently, the Tab key only modifies indentation.

This is also breaks functionality for some AutoHotkey scripts, which used to work fine before the update.

Proposed solution

Add a toggle switch in the settings, which allows to switch between two modes:

  1. Insert tab characters, when the Tab key is pressed in the editor (as before Version 0.13.14)
  2. Modify indentation, when the Tab key is pressed in the editor (as since Version 0.13.14)

Current workaround

One can use the old editor. However, then one then cannot make use of the real time preview, which is especially important for editing LaTeX equations.

3 Likes

Another related thread, although it was only flagged as a mobile problem in that thread:
https://forum.obsidian.md/t/create-tabs-or-spaces-at-the-position-of-your-cursor/28488

There could also be a switch by modifier key, e.g. tab indents the line and ctrl-tab inserts the tab character.

1 Like

While this would fix the impossibility of inserting tab characters, it would still break AHK scripts. One could of course switch the behaviour around, so that, e.g. Ctrl+Tab indents.
I assume there are two different groups of users, expecting two different behaviours for the tab key, which is why I proposed a switch in the settings.

Steps to reproduce

I try to toggle off the use tabs option in the obsidian mobile for iPadOS. instead of create spaces.

Expected result

create more spaces. Normal behavior of tab button

Actual result

It keep indent the line when pressing the tab button

Environment

  • Operating system: IPADOS
  • Obsidian version: 1.0.5

Additional information

4 Likes

Hi anyone here?

The problem was use tabs option doesn’t work. I use iCloud to store the vault. in the iPadOS 15.1 the tab behavior will move all the line from the start even when toggle off.

In macos catalina , same vault, the tab button will create space only even toggle on.

It’s really annoying. Anyone know the problem? I did remove and reinstall the app. Didn’t work. Remove .obsidian config folder. Didn’t work too.

I can’t tell which way you want. You said “turn off tabs” and “instead of spaces”.

Can you please clarify: do you want tabs or spaces?

I tested this on Mac and iPad, and I can’t reproduce it. It works for me:

  • If I turn “Use tabs” on, tab will insert a tab character.
  • If I turn “Use tabs” off, tab will insert space characters.

Can you please test this in the Help Vault and see if it still happens? Maybe a plugin is interfering.

Thank you rigmarole for the reply. I think I did misunderstand the use of “turn off tabs” options.

My problem is:

I want tabs button to create tab character. However, in my Ipad, the tab button work like a shift-tab. It move all the line from the start. And it also changes the line into red color.

I had thought there is a hot key defined with the tab button but it doesn’t.

I have just update to newest version macOS and it happened to macOS too.

I use safe mode so no community plugins are installed

https://imgur.com/a/Wjch4bX

I uploaded a picture of this behavior. I really don’t know how to help reproduce this error cause seems it happen only to me.

I think I see what you mean now! Can you let me know if I understand you correctly?

You want to insert spaces (or tab character) where your cursor is positioned. But no matter where your cursor is positioned, it indents the entire line.

tabIndentation

Yes, this happens to me too on MacOS.

2 Likes

I renamed your topic. If I misunderstood, please let me know!

Thank you for respond. Exactly this problem. I confirmed. The new name of topic is appropriate I think.

reviving this thread as I think its the same desired tab handling as a much more recent one: https://forum.obsidian.md/t/vim-code-block-turn-off-tab-to-indent-happens-in-middle-of-the-line

No solution there yet either but I wanted to link the two and bump as I am having the same problem

4 Likes

The same problem appears here. Any solution would be helpful.

My workaround for this in MacOS was to use BTT (Better Touch Tool) to replace the TAB key with four spaces when I press it inside Obsidian (BTT is a great tool that I use in my daily workflow and I already had the license for it).

  1. Open the BTT Configuration
  2. Add Obsidian App by clicking in the plus sign that is in the bottom left corner
  3. Select ‘Keyboard Shortcuts’ from the top dropdown
  4. Click on the plus sign at the bottom of the ‘Groups and Top Level Triggers’ section and set the TAB key to this trigger by selecting ‘Keyboard Shortcuts’ in the trigger configuration (right side)
  5. Click on the plus sign at the ‘Actions Assigned to Selected Trigger’ section and select ‘Insert/Type/Paste custom Text’ as the action
  6. Write the four blank spaces in the ‘Insert/Type/Paste custom Text’ action configuration and save
3 Likes

Please fix this. Not being able to insert tabs is such a massive flaw. This alone feels like a dealbreaker for me already.

2 Likes

Obsidian is a plain text editor that uses Markdown. Basic Markdown does not include
tabs. It is not a word processor. Obsidian is extensible, so maybe someone can write a plug in or CSS snippet to do tabs, like they have done for tables. Remember this is still essentially beta software.

2 Likes

Can someone please implement this feature? Why this isn’t in already is mind-boggling.

1 Like

For vim users, we already have ctrl+D and ctrl-T to change indentation. So yeah we don’t need Tab to change indentation. At the very least, we could have ctrl-V Tab insert a tab just like in vim. I wonder if CodeMirror could be tweaked to enable that.

In the meantime, BTT sounds like an OK workaround (although it may conflict with plugins that use TAB to navigate in or reformat markdown tables)

2 Likes