Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
351 stars 11 forks source link

Output channel: Open a file #143

Closed Taitava closed 2 years ago

Taitava commented 2 years ago

I've had this idea for some time, and in some inspiration peak I just coded it. Normally I'd open a discussion for this, but now I implemented it already. 🙂

Still needed:

Later (make a new issue for these at the time this issue gets closed):

FelipeRearden commented 2 years ago

Hello @Taitava !!!

I just wanna add two things about opening files:

Have a great day!

Taitava commented 2 years ago

I just wanna add two things about opening files:

  • open in a new panel vertically
  • open in a new pane horizontally

Once I get output channel options implemented, I can add an option for opening the file in a new pane (edit 2022-02-20: this option will not use the graphical UI settings, more below). At least a quick glance at the Obsidian API shows a possibility to open in a new pane. But can I control if the pane is vertical or horizontal - I don't know yet.

I don't know yet, when I get to implement the output channel options.

  • when the file is already open but is not active, the SC could make the file active instead of open a second file

Good point!

Have a great day!

Have a nice day, too! 🙂

FelipeRearden commented 2 years ago

Once I get output channel options implemented, I can add an option for opening the file in a new pane. At least a quick glance at the Obsidian API shows a possibility to open in a new pane. But can I control if the pane is vertical or horizontal - I don't know yet.

Just to let you know -> the core search assistant plugin and QuickAdd have these options. Might be a good source of information:)

FelipeRearden commented 2 years ago

Hello @Taitava !!!!

One more source of information about open files in a new pane + split horizontally

https://gist.github.com/GitMurf/5ba341b8dba7ccd7e24129f4469ca920

https://www.loom.com/share/53b2c6b599ff4d6492b90833a1797d70

Have a great day!!!!!

Taitava commented 2 years ago

Thanks! 🙂

Taitava commented 2 years ago

One more source of information about open files in a new pane + split horizontally

https://gist.github.com/GitMurf/5ba341b8dba7ccd7e24129f4469ca920

Hmm, I guess app.workspace.getAdjacentLeafInDirection() method is private API, as I cannot find it in Obsidian API's 0.13.21 public interface. If it's private, I could use it, but it's not safe, as any version update to Obsidian might change how it behaves, or remove the method completely and thus make SC crash when it tries to use it. So I'd rather postpone the ability to decide the direction of the new pane.

Taitava commented 2 years ago

Implemented: :new-pane and :can-create-file options in the output text

I decided to make the new tab opening option to be presented in the output text instead of making it to be a graphical setting in a UI. This is because then the shell command (or an external program) itself can decide case-by-case if the file should be opened in a new pane or not.

The same applies for allowing or denying to create a new file. By default, the file will not be opened at all, if it does not exist, in order to avoid accidentally creating new files if there is a mistake in the file name. :can-create-file option can be use to allow creating new files, if needed.

Example output from a shell command: MyNote.md:5:6:new-pane:can-create-file. Open the file in a new pane and place caret on line 5, column 6. If the file does not exist, create it.

Taitava commented 2 years ago

Implemented: Support for selections

FelipeRearden commented 2 years ago

Woooww !!!!!!!!

@Taitava

Can I combine new-pane with selections ?????

Taitava commented 2 years ago

Can I combine new-pane with selections ?????

Yes 👍

FelipeRearden commented 2 years ago

Amazing @Taitava !!!!!!

Taitava commented 2 years ago

Done and will be released in 0.11.0. There will be a beta test.

FelipeRearden commented 2 years ago

New Command :popover (Hover Editor Plugin)

Hello @Taitava !!!!

Just to let you know that we have a new plugin in beta that has a feature that I think will change the way that we use Obsidian forever.

https://github.com/nothingislost/obsidian-hover-editor

Basically, it will add a new type of way to open notes making them floating in the screen.

This way, we gonna have this options:

This way, I think would be great to have a new command aligned to this new view :)

I know in very early to write about this ... but since I'm testing this new plugin (and creating workflows around it) I decide to write this now to not forget in the future :)

Take a look at the plugin, I think you will gonna like it !!!

Have a great day!!!!!

Taitava commented 2 years ago

Hi @FelipeRearden 🙂

I created a new discussion for this, as this particular issue is more about implementation of an already released feature, so discussions related to planning new features are not so related to this issue. 🙂 That being said, your suggestion is good and I'll comment more in the new discussion soon.

https://github.com/Taitava/obsidian-shellcommands/discussions/186