Giter VIP home page Giter VIP logo

restore-tab-key's Introduction

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。

restore-tab-key's People

Contributors

jrymk avatar meskill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

meskill acodehx

restore-tab-key's Issues

[FR] Compatibility with Tabout

Hi!
Your plugin is great, but it come to be conflict with tabout.

It will be cool if the plugin can be "disabled" (aka no indent, no space) if we are in between all markdown markup.

Another solution is to set the plugin on another key, for example shift+tab, or alt+space.

Compatibility with Outliner

In #3 ,
you are provided Plugin's setting Use with Obsidian Outliner plugin

i tried this setting .
It looks like below when Outliner plugin.

  1. Outliner is On
    OutlinerOn

  2. Outliner is Off
    OutlinerOff

1. isn't input .
(but tab is input in bullet point text.)
This may be especially troublesome when you want to insert a tab in a code block.

i think feel this needs to be fixed.

Thank you so much for adding this feature!

Compatibility with Advanced Tables

Tab is used in the popular Advanced Tables plugin to jump into the next column of a table.
This obviously conflicts with the intended use of restore-tab-key.

I suggest an option to disable the restore-tab-key behaviour when the cursor is inside a markdown table.

Many thanks for the great plugin btw!

Wrong link to forum?

I might be wrong, and sorry if this is presumptuous. But the link you use in the forum seems quite different to what this plugin does.

I wonder if you actually meant to link to this FR post? https://forum.obsidian.md/t/option-to-disable-tab-to-indent/40868

That was the thread where you first announced this plugin. And it has a much larger discussion including different use cases related to typing tab mid-sentence, or inside bar-codes.)

The Help thread you linked in your description doesn't seem exactly related to your plugin.

Chris (rigmarole)

Suggestion: "Activate in table" setting

I normally type out tables by hand, with the pipe characters lined up so they "look right" in the markdown source as well as the rendered output. I use the TAB key to space things out for this.

I have to turn off the "Only activate in code blocks" setting for this, but this also disables the TAB key's functionality when typing bulleted lists (where I want the TAB key to indent the whole line rather than adding spaces or a TAB character).

It might make sense to offer separate toggles for different "typing states", such as ...

  • Enable within code blocks
  • Enable within a table
  • Enable within a list
  • Enable in all other cases

I personally would use "yes, yes, no, no" for these, but I can see where others might want different settings, especially if they're using other plugins that I don't use (or have never heard of).

Holding Tab Causes Whole Line to Be Indented

Hello,

Thank you for this plugin. It really saved my life by not forcing me to change a very deep muscle memory.

Anyway, if you hold TAB to insert several tabs, it goes back to the original behavior and indents the whole line, even though nothing is selected. Is there a way to fix this?

[Feature Request & Bug Report]: Tab still make whole line move if some texts are selected, hope to use tab to replace

Thanks for your efforts to make obsidian operates as we expect !!!

Normally the plugin works fine.

The problem is when we select some texts, the tab behaviors as it used to do: indent who lines selected.

one line

select between []:

    app.service.[include]()

press tab:

        app.service.include()

multiple lines

select between []:

    app.service.[include()
    app.flow create]()

press tab:

        app.service.include()
        app.flow.create()

When we use VSCode, tab on multiple lines behavior the same, but on single line, tab will use tab or spaces to replace the selected text, I hope we can change for such pattern.

Restore Tab has conflicts against Outliner Plug In and breaks

When using the plug in "Restore Tab Key" and "Obsidian Outliner" together, it results in errors whenever indenting a group of bullet points.

An example of this is by trying to indent the following group of bulletpoints which do not indent.
image
instead it result into a large amount of repeating errors of 34 identical errors.
image
The following is he error message.
RangeError: Maximum call stack size exceeded
at t.getCursor (app.js:1:1250775)
at MyEditor.getCursor (index.ts:65:19)
at OperationPerformer.perform (OperationPerformer.ts:32:21)
at ListsMovementCommands.indentList (ListsMovementCommands.ts:86:63)
at Object.eval [as editorCallback] (createEditorCallback.ts:8:35)
at e.mobileOnly.Mt.isMobile.e.checkCallback (app.js:1:1835420)
at o_ (app.js:1:1834718)
at e.executeCommand (app.js:1:1836282)
at e.executeCommandById (app.js:1:1836189)
at run (plugin:restore-tab-key:62:24)

If you try to indent the group of bullet points even after failing, Obsidian eventually crashes.
image

Restore Tab Key breaks bullet lists with quotation marks

Hey,
thanks at first for the great plugin, the default tab behavior in obsidian is absolutely not to my taste.

The plugin causes one problem though:
If line in a bullet list ends with ' " ', the next line will not have a bullet, as expected:
1

actual result with plugin enabled:
2

With Restore Tab Key disabled, it works as expected.

Kind Regards, Lichtwitzig

Unsure if I misunderand the purpose

Hi, and thank you for your work on this plugin. Unfortunately it doesn't seem to work, as I assume it would, for me.

I have the latest version (updated just now) with the default settings. However, when I press tab on a line (not selecting anything), it indents instead of putting in spaces (as per the configuration).

Additionally i have enabled use with Advanced Tables, but when I tab in a cell it indents that entire line (as seen in source code view), instead of navigating to the next cell.

Apologies if I'm misunderstanding the purpose of this mod. However, if my understanding is correct, is there any reason why the plugin might not be working for me? I'm a new obsidian user and don't have many plugins installed other than: Advanced Tables, Jelly Snippets, Emoji Shortcodes, and of course yours.

Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.