Skip to content

An Obsidian plugin to make the tab key insert a tab, and make it feel like any other IDE regarding tabs and indentation.

License

Notifications You must be signed in to change notification settings

jrymk/restore-tab-key

Repository files navigation

Restore Tab Key Plugin for Obsidian

Restore tab key behaviour: tab key inserts a tab, the way it should be.

To summarize, this plugin can make code blocks, or anywhere, behave like any IDE as you would expect, everything regarding tabs and indentation, which Obsidian does terribly.

By default, there is no way to insert a tab character in Obsidian without cutting and pasting, can you believe that?

Sure, tabs are pretty useless in Markdown, however, that can't be said in Markdown code blocks, the tab key behavior is just absolutely unreasonable, and this plugin should solve that.

Check out the forum thread that inspired this plugin: Feature Request: Option to disable tab to indent | Obsidian Forum

Restore Tab Key

Before

before

After

after


Braces Auto Indent

Before

before_braces

After

after_braces


Settings

Quick configuration for just code

  • Turn on Only activate in code blocks
  • Decide to use space or tabs by setting Use spaces instead of tab

ALL the settings image image


Indent using tabs

Select some text and press tab to indent, like just about any IDE.
The indent action is completely unaltered (native indentMore command), you can change "Indent using tabs" and "Tab indent size" in Editor settings to change that behavior.


Hard space

Hard spaces (U+00A0) as tab allows you to insert wide blanks inside text. Without using hard spaces, repeated spaces (and tabs) will be rendered as one single space. You can toggle whether to use hard space instead of regular spaces.
You can insert hard spaces in the beginning of a line to act like indentation. You will have to move the cursor to the beginning and press tab to insert them though. Indenting (select text and press tab) will not insert hard spaces.

live preview/source view: (Yes, with hard spaces as indentation it still turns into a code block. Aaargh!)

after render (reading view):


Also comes in Chinese

image

设定页可选择显示语言,部分翻译内容和中国大陆在地化参考了 ACodeHX 的 fork。