ryjjin / Obsidian-shortcuts-extender

Plugin for Obsidian: Use shortcuts for input special symbols and changing level of headings without language switching
70 stars 6 forks source link

Insert code block #7

Closed captaincaed closed 2 years ago

captaincaed commented 3 years ago

I really like this plugin, thank you! Having the headers easy to type is very nice.

It would be nice to have a shortcut for an entire code block as well, with the cursor at the end of the top three ticks, so you can write your language right away:

 <foo>

Thanks for the consideration!

ryjjin commented 2 years ago

Sorry, i really forgot about it. Now it works with shortcut ctrl + `

Slava-Nik commented 6 months ago

Useful plugin, I like it. It would be great to also add a feature of inserting code blocks with different languages. Something like that. Thanks

this.addCommand({
        id: "shortcut-code-block-go",
        name: "Shortcut for toggling a ts code block",
        callback: function () { return _this.shortcutToggleCodeBlock('go'); },
        hotkeys: [
            {
                modifiers: ["Ctrl"],
                key: "g",
            },
        ],
    });
    this.addCommand({
        id: "shortcut-code-block-js",
        name: "Shortcut for toggling a ts code block",
        callback: function () { return _this.shortcutToggleCodeBlock('javascript'); },
        hotkeys: [
            {
                modifiers: ["Ctrl"],
                key: "j",
            },
        ],
});