/insert command

I would love to have a /insert command inspired by Slack and Dropbox Paper. Some examples uses:

  • /date → today’s date (related to this post)
  • /table → insert markdown table formatting
  • /anyMarkdownSpecificFormating → aka all of the various syntax that can be hard to remember, images, links, footnotes
  • /backlinks → insert backlinks
  • /emoji → search emojis

I am sure there would be many more uses over time, could also be a great way to invoke plugins.

13 Likes

It seems to me that a keyword like /insert makes more sense within a chat program like Slack, than an editor like Obsidian.

FWIW, most of what you ask for can be done already using text expanders or other third-party programs. Unless Obsidian is the only place one writes in, it’s better to have general tools that work across writing applications.

For example, on the Mac I use Rocket to insert emojis because I do so in all sorts of contexts (email, online forums, etc.). It’s easier for me to learn one interface (Rocket’s) rather than a different one for each program/context.

YMMV, of course. I’m just sharing my own preference here.

3 Likes

Thanks, I am familiar with Rocket and various Text Expander options but that is not what I am hoping for here. I am looking for functions explicit to Obsidian that a third party app could not provide. Inserting a Date would just be the starting point.

Here is an example of this function from Dropbox Paper:

This would be very helpful to those who use Obsidian on company-issued laptops where text expansion software is a no-go. I didn’t realize how much water TextExpander was carrying until I sent my MacBook in for service.

3 Likes

Hi Ehsan, you might want to check TextExpander as it does that and much more, and works system-wide.

1 Like

I hear ya @tacotuesday, company-locked devices are a PITA.

I should note that there are currently two existing systems for invoking commands:

  1. Keyboard shortcuts
  2. Command palette

Folks have also emphasized the need for proper menus, which would add a third way to get at commands.

The OP is proposing a different method of invoking commands and plugins. Any new functionality would require further #feature-requests, either for plugins or core development.

(Unless I’ve misunderstood.)

1 Like

I understand how it can be more user-friendly to have this feature built-in to obsidian.

but I would also argue for great ways to implement this with text-expansion tools. I personally use espanso which is open-source and free.
espanso

I’m in linux, so the path where I set this up would be different, but just for example. I create a file called date.yml

~/.config/espanso/user/date.yml

with the following set up:

name: date
parent: default
matches:

  # Dates
  - trigger: "/date"
    replace: "{{mydate}}"
    vars:
      - name: mydate
        type: date
        params:
          format: "%Y-%m-%d"

that’s how one would quickly set a trigger for date

for regular text expansions the process only requieres something as simple as this:

  - trigger: "/rocket"
    replace: "🚀"

Here’s the espanso website which has great documentation and works on Linux, Mac and Windows

Hope it helps!

4 Likes

I’ve put together a basic proof-of-concept because I wanted the same.

I really like @tacotuesday’s point on company laptops. I hadn’t even thought of that.

For me it was similar that I wanted to manage the keywords within Obsidian (as opposed to OS-level)

The settings are super bare-bones at the moment:

The plugin is in pre-release at the moment under

Let me know what you think!

6 Likes

@Ehsan In addition to the text expander alterantive, I want to add that a lot of those are, to a degree, already existing commands (either core or from plugins) that you can use from the command palette or through a hotkey.

In order:

  • natural language date plugin
  • advanced tables plugin <-- doesn’t insert, but greatly aids with formatting
  • links do have a core shortcut, there’s also a plugin to paste links into text
    • I’d be willing to add hotkeys for footnotes and images in hotkeys++, but aren’t images also autocompleted by Obsidian core?
  • not sure what you mean by inserting backlinks? There’s also a plugin that may be related to that --> Backlinks into document
  • this is the only one that I see missing but is easily covered by a text expander as mentioned above

your obsidian text expander idea is amazing, @akaalias will this be possible as a community plugin eventually? Or does it need to be a more manual install. I love espanso and it’s what personally use, but I can see how some people might have trouble setting it up. Which is why I think a built in text expander plugin is an excellent idea!

And @argentum is right there are a few great ways already to achieve this functionality, I still see why a text expander approach is more comfortable, but it’s good to know that the functionality for many things already exists

3 Likes

Thanks everyone for the suggestions. akaalias your proof of concept looks very promising!

I am realizing I could have been more clear with my original post and could have clarified that I am aware of tools like TextExpander/expanso/etc and that I do not think those are good solutions for how I envision this to work.

  1. I really like the command palette, no need to change anything there. This is in addition to that. This would serve a different function focused on editing the page content. There is only one item I could find in the command palette that edits page content: insert link. This should move to this new tool.
  2. To clarify /insert would be focused on editing page content. It could include some default built in options but would also provide a way for plugins to insert content. It is beneficial to separate these edit functions from the command palette
  3. I do not believe tools like TextExpander can achieve what I am envisioning would be possible with this. One additional example: /insertfile could open up a file browser for you to find a file on your computer, import that into obsidian and insert the link in your current document all in one go.
  4. Long term, I would love to see Obsidian bend towards the arc of becoming more accessible to novice users and requiring people to have separate apps installed on their machines creates an uphill battle that would reduce adoption.

Final thought: none of this is required and is possible with external tools. That is not the point hopefully. This could really unlock new possibilities and dramatically streamline workflows. If people prefer their external tool, nothing will stop them from using that. This suggestion is probably not for the advanced users who are already on this forum and more targeted for new users who have yet to adopt Obsidian.

4 Likes

@Ehsan you are right, I like your final thoughts, on how builtin features would make it more accessible for beginners.

Like someone mentioned previously, a lot of these features are already available through different community plugins, but after seeing your perspective on it, I do see the value of unifying these features under a simple and straight forward method.

2 Likes

Thank you so much for your kind words!

Yup, it’s in the final stages of releasing a first version. Before that I wanna make sure the highlight-extractor one is published as well.

I appreciate that Santi :smiling_face_with_three_hearts:

1 Like

Looking super interesting @akaalias!

2 Likes

Use case or problem

As a newbie it’s sometimes more intuitive to use a method some of the other similar products have implemented - namely using a ‘/’ character which then brings up a list of things that can be added (tables, tasks etc etc).

Proposed solution

Using the backslash character to give the user a list of things that can be inserted at the current cursor point.

Oh! You mean like notion and remnote!

3 Likes

I think you meant [forward] slash (/), not backslash (\) :slight_smile:

For those wondering, this is how inserting ‘slash commands’ looks like in Notion:

Edit: For context, the previous two and my comment were just merged into this thread - I hope my image wasn’t superfluous at that point :sweat_smile:

@Ehsan made great points why and how this would be a great addition to Obsidian’s current options of insertion. I’m all for ‘native text expansion’.

2 Likes

Thanks for the info about espanso, @santi! Alas, it doesn’t run on anything less than Windows 10, so I grabbed BeefText instead, which is also open source.

What I’ve ended up doing is creating an expansion for [[[ of [[#{dateTime:yyyyMMddHHmm} #{cursor}]].

That expands to e.g. [[202101181243 ]] with the cursor just after the space… which lets me just type the rest of a new note name, and then hit the hotkey for “Follow link under cursor” or “Open link under cursor in new pane”, and voila… instant Zettelkasten link from my daily notes without needing to write another g*d AutoHotKey macro where I have to constantly look up the syntax and decide which of the eight or ten key-sending methods to use. :wink:

Now all I need to do is throw together an Obsidian plugin to automatically trigger Obsidian’s “insert template” command when navigating to a pane with an empty document, and I’ll be all set. :wink:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.