GnikDroy / projections.nvim

A map to your filesystem
GNU General Public License v3.0
236 stars 8 forks source link

Is it possible to specify where to store those session files (maybe from the `setup`)? #6

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

As title. In your README.md:

workspaces = stdpath('data') .. 'projections_workspaces.json'
sessions   = stdpath('cache') .. 'projections_sessions/'

My intuition tells me that:

  1. I have to do some backup for these files so that it's always possible to restore my project sessions. For this, it would be great to have these paths customizable.
  2. It's a good idea to save these files inside the project folder it belongs to, so I would be able to restore the session from another machine. (but this is based on my assumption that these files could be loaded from another machine/platform/OS)
  3. It's better for me to choose another place to store these files since I used to do rm -rf ~/.local/share/nvim/... when I encountered some serious bugs on NeoVim.

Thanks in advance!

GnikDroy commented 1 year ago

It is indeed possible to override this. But the current API is not to my liking. (Same reason why this is not present in README)

Currently, you need something like,

local path = require("projections.path")
require("projections").setup({
    workspaces_file = Path.new('path/to/workspaces.json'),
    sessions_folder = Path.new('/home/some/path/here')
})

The reason this is not included in the README is because I do not like exposing projections.path, which is an implementation detail.

I would like them to be plain old strings, so something like.

require("projections").setup({
    workspaces_file = 'path/to/workspaces.json',
    sessions_folder = '/home/some/path/here',
})

Fortunately, this is a pretty easy fix. I will take a look at this later today.

nyngwang commented 1 year ago

[...] But the current API is not to my liking. (Same reason why this is not present in README)

Good plugin author identified! Nice decision!

Fortunately, this is a pretty easy fix. I will take a look at this later today. [end]

Great to know! And take your time! I will definitely try it after you're done.

GnikDroy commented 1 year ago

7efa010a4109b144e9ede70d9b9e54dbcdb09433 should fix this