SmartPhrases

Dear all,

I am a newcomer, hooray!

Things I have tried

Search on the forum and with Google.

What I’m trying to do

I work in the medical field and use a software called Epic. In it, there is something called “SmartPhrases” or “dot phrases”. It works as: after pre-setting a smartphase called .test to “this will generate a test message this long”, when I type in the note .test and hit enter, it automatically generates “this will generate a test message this long” for me. Is there a way to do this in Obsidian?

Thank you all very much!

USMLEBoy

It seems like there are some options available to this, one of them is the GitHub - ArianaKhit/text-snippets-obsidian: Snippets plugin for obsidian .

However, there is a few pitfalls as it’s not updated lately, and the keypress detection method it uses is not supported in the newer version. See this issue for a more complete explanation: "Space" doesn't expand anymore · Issue #47 · ArianaKhit/text-snippets-obsidian · GitHub

There are two workaround available, which I’ve found so far. One is to use a fixed main.js linked from in that issue thread, and the other is to just disable the shortcuts in settings, and add your own hotkey.

So get it to work do the following:

  • Install the plugin “Text snippets” via Settings > Community plugins, and enable it
  • Goto the settings of the plugin, and add the text you want expanded into the large box (and disable the tab and Space expansion, as they don’t work anyways)
  • Goto Settings > Hotkeys and search for “run snippet replacement” (you only need to type parts of that), and hit the plus icon, and enter a hotkey of your own

Now when you type your smart phrase, you can hit that hotkey, and it’ll expand the text for you. You can even go to one of your smart phrases in retrospect, and hit the hotkey and it’ll expand it for you.

Do note that dot phrases are not supported out of the box, as it messes with the word delimiters. But if you remove period from the word delimiter characters in the bottom of plugin settings, you can use .test as a smart phrase as well. But then again, since you need to hit the hotkey, you could just use test as the smart phrase…

Hope this helps!

PS! If you’re looking for expansion outside of Obsidian, this thread talks about something called espanso: Espanso (text expander) Snippet Showcase

1 Like

You can create template snippets for text of any length and insert them easily if you have a hotkey (I use CMD /) assigned to open the template modal. Templates are inserted at the cursor point without overwriting the existing text.

And if you use Apple devices, text replacements work in Obsidian, across OS platforms. Text replacements can be words, phrases, or multiple paragraphs of text.

Thank you for the suggestion! It worked for me.

Thank you for the suggestion. This is an excellent solution for simple replacement!

1 Like

I use this robust plugin on mobile as well:

I use it in conjunction with this:

In the latter, you can configure (write in) e.g. .test > .test A option, .test B option, etc. It is not automatically pasting in the lines though, you need to select from the list (and delete the dot afterwards).

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