foam icon indicating copy to clipboard operation
foam copied to clipboard

`cmd + click` Create a file in the same level directory instead of the root directory.

Open faydanube opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

cmd + click Create a file in the same level directory instead of the root directory

Describe the solution you'd like

cmd + click Create a file in the same level directory instead of the root directory

Describe alternatives you've considered

A path config like "${currentFolder}"

Screenshots or Videos

image image

faydanube avatar May 09 '22 07:05 faydanube

This issue is a bit more complicated as various people have different expectations regarding where the note should be created. We have been looking into a paradigm to reason about it in #683 but that effort has stalled atm

riccardoferretti avatar May 09 '22 12:05 riccardoferretti

This issue is a bit more complicated as various people have different expectations regarding where the note should be created. We have been looking into a paradigm to reason about it in #683 but that effort has stalled atm

Is it difficult to add a configurable item? I will keep an eye on this issue, thanks very much.

faydanube avatar May 11 '22 04:05 faydanube

My thinking at the moment is the following:

  • a configuration item with options to create the new file in the same directory or in the repo root
  • the item is overridden by a filepath property in the template, which must resolve to an absolute path to be used. If it doesn't resolve to an absolute path, it will ask the user to confirm the path of the item. A few variables are made available in the template to help with the resolution

Given the big amount of thinking and work @movermeyer put into spear heading this issue (in #683) and his "special interest" for templates in Foam, I wanted to include him in the resolution (although per the stalled PR I reckon he has been taken over by other things).

But thanks for bringing up the issue, I am sure several users are affected by this and would love some clear resolution rule with some level of flexibility.

riccardoferretti avatar May 11 '22 14:05 riccardoferretti

Currently, we can use [[directory/filename]] to create the file in directory but not root (I'm not sure it's been designed on purpose or coincidentally).

I use the following snippet to help me create the syntax which contain directory name.

{
    "New Foam Node": {
        "scope": "markdown",
        "prefix": "node",
        "body": [
	   "[[${RELATIVE_FILEPATH/(.*)\\..+/$1/}.$2.md]]$0"
        ],
        "description": "add new foam node"
        }
}

Lauviah0622 avatar May 11 '22 16:05 Lauviah0622

Currently, we can use [[directory/filename]] to create the file in directory but not root (I'm not sure it's been designed on purpose or coincidentally).

I use the following snippet to help me create the syntax which contain directory name.

{
    "New Foam Node": {
        "scope": "markdown",
        "prefix": "node",
        "body": [
	   "[[${RELATIVE_FILEPATH/(.*)\\..+/$1/}.$2.md]]$0"
        ],
        "description": "add new foam node"
        }
}

Keyboard Shortcuts do allow for this, but I'm mainly talking about cmd + click

image

faydanube avatar May 14 '22 09:05 faydanube

My thinking at the moment is the following:

  • a configuration item with options to create the new file in the same directory or in the repo root
  • the item is overridden by a filepath property in the template, which must resolve to an absolute path to be used. If it doesn't resolve to an absolute path, it will ask the user to confirm the path of the item. A few variables are made available in the template to help with the resolution

Given the big amount of thinking and work @movermeyer put into spear heading this issue (in #683) and his "special interest" for templates in Foam, I wanted to include him in the resolution (although per the stalled PR I reckon he has been taken over by other things).

But thanks for bringing up the issue, I am sure several users are affected by this and would love some clear resolution rule with some level of flexibility.

Looking forward to problem solving, thanks for your reply.

faydanube avatar May 14 '22 09:05 faydanube

This sounds like a duplicate of #864

tv42 avatar Oct 26 '22 01:10 tv42

I'm facing the same issue, as I put all my notes under project home/docs folder, and whenever I control+click to create a note, it will be created under project home. Which makes the handy control+click unusable for me.

Looking for a solution for this. Thanks..

xu4wang avatar Dec 22 '22 05:12 xu4wang

This has been fixed in 0.20.6, with the introduction of foam.files.newNotePath

riccardoferretti avatar Feb 09 '23 14:02 riccardoferretti

This has been fixed in 0.20.6, with the introduction of foam.files.newNotePath

Hi, it doesn't work. command + click Create a file in the root directory even if "foam.files.newNotePath": "currentDir"

Is your feature request related to a problem? Please describe.

cmd + click Create a file in the same level directory instead of the root directory

Describe the solution you'd like

cmd + click Create a file in the same level directory instead of the root directory

Describe alternatives you've considered

A path config like "${currentFolder}"

Screenshots or Videos

image image

faydanube avatar Feb 14 '23 16:02 faydanube

Please open a new issue for the bug

riccardoferretti avatar Feb 22 '23 03:02 riccardoferretti

Well, it doesn't work, and I did: #1170.

tv42 avatar Feb 23 '23 18:02 tv42