Open .md files in Obsidian

I want to open the selected .md file in Obsidian. I can do it in a button using Obsidian's URI scheme. I can of course assign a hotkey to that button. Is there a way to bang that useful URI string from the button (see below) into the Settings>Filetypes interface so that I can do the same from a context menu and/or make this the default opening behavior for .md files?

The only method I can find to open files in Obsidian uses the URI scheme, which unlike a command-line-plus-arguments does not seem to go with the Settings>Filetype approach. Though I am likely missing something.

This works from a button:

A previous post, Launch the selected file in Obsidian, has the necessary pieces, which for the thick-headed (raises hand) can be helpfully written all in one place as:

  • Add a new button to a toolbar and edit it.
  • In the Command Editor window, leave the type as "Standard Function (Opus or external")
  • In the text area of that window, type or paste the following:

obsidian://open?path={filepath$|urlencode}

...which yields a button that does indeed open .md files in Obsidian.

Notes for the perplexed:
If you need to learn how to add a button to your toolbar and edit it, here's a writeup many people in this forum recommend: How to use buttons and scripts from this forum

If you want to know more about the Obsidian URI scheme, start at Obsidian URI - Obsidian Help

This works fine:

Thank you for your reply, it set me on the right path. This does not work with the "open" action, but does work as an addition to the context menu, and does work in the events tab where you can edit the left-double-click action. Marking this as solution, and putting it all in one place here:

Make a button that opens the selected file in Obsidian:

  • Add a new button to a toolbar and edit it.
  • In the Edit window, leave the type as "Standard Function (Opus or external")
  • In the text area of that window, type or paste the following:

obsidian://open?path={filepath$|urlencode}

...which yields a button that does indeed open the first selected .md file in Obsidian.

Add a context menu so that you can open a right-clicked file in Obsidian:

  • Open the Settings > File Types... menu
  • Select the .md markdown file type and click the Edit button
  • Select the Commands tab
  • Select the Context Menu subtab
  • Click the New button
  • In the "Edit new action for type: markdown" dialog, choose "Run an Opus Function" from the Type dropdown
  • Enter a name for the action, e.g. "Open in Obsidian"
  • In the large edit area at the bottom, enter

obsidian://open?path={filepath$|urlencode}

...which adds an "Open in Obsidian" item to the context menu.

Make double-clicking a file open that file in Obsidian:

  • Open the Settings > File Types... menu
  • Select the .md markdown file type and click the Edit button
  • Select the Commands tab
  • Select the Events subtab
  • Select the Left double-click event
  • Click the Edit button
  • In the large edit area at the bottom, enter

obsidian://open?path={filepath$|urlencode}

...which makes the file you double-click open in Obsidian

Note that obsidian://open?path={filepath$|urlencode} will NOT open the file in a new Obsidian tab--it clobbers the active tab, unfortunately.

Thanks very much for this thread.
I'm not certain how I'll use it yet.

For now, I'm opening .md files in my text editor.
I don't think you are wrong, I appreciate what you have done here.

One of the things I find useful about Obsidian is the ability to simply edit the .md text file.
This makes it very easy to edit equation glitches using the AsciiMath plugin.
When I write these things, I'm thinking the math, not mindlessly pointing my mouse all over the place.

The math can be converted back to Latex easily within Obsidian, which can then be used in MS-Word. It certainly is easier than using MS Word's confused Equation GUI and much easier and natural than Latex. The Latex can then be fine tuned if needed.

This is only a different point of view.
I still think you are right. :grinning_face: