NomarCub / obsidian-open-vscode

Open vault in VSCode button for Obsidian.md
MIT License
97 stars 5 forks source link

Please add variable for current folder #8

Closed gowerc closed 1 year ago

gowerc commented 1 year ago

Hi,

Would it be possible to add in a variable for the folder of the currently opened file? A common use case I have that I have a file open in a directory and actually I want to open that whole directory (not the whole vault) in VScode. I think this could easily be done by splitting out {{filepath}} into {{path}}/{{file}} (if possible)

NomarCub commented 1 year ago

Hi! I don't want to change existing variables, that would affect existing users. I made a new, relative {{folderpath}} variable, locally. Would you test if this is adequate for you? Here's the new build: main.zip.

gowerc commented 1 year ago

Heya,

Apologies for not getting back sooner, I ended up going with a different extension to get the functionality I was after. I guess feel free to close the issue if you no longer wish to implement this, if so apologies for wasting your time !

NomarCub commented 1 year ago

If there's no demand, I'll close it for now. What extension did you go with?

gowerc commented 1 year ago

I ended up going with "Shell commands" and mapping the command open folder in vscode in the quick menu to:

PATH=$PATH:/usr/local/bin:/usr/bin/code ; code  {{folder_path:absolute}}

for mac

and

xdg-open vscode://file/{{folder_path:absolute}}

for linux