gennaro-tedesco / nvim-possession

📌 the no-nonsense session manager
MIT License
215 stars 7 forks source link

About vimscript configuration issues #17

Closed whxcode closed 1 year ago

whxcode commented 1 year ago

I am using the vimscript script configuration, and there is an error at runtime, what should I do?

image
gennaro-tedesco commented 1 year ago

Good morning and thank you for reporting the issue. This is caused by the fact that most likely your session directory does not exist on your computer: make sure to create one (still, I need to handle the error properly, I will fix this).

This is the default directory for sessions on your computer: does such folder exists?

Once we validate this is the root cause I will make a fix to better handle the error message.

whxcode commented 1 year ago

Good morning and thank you for reporting the issue. This is caused by the fact that most likely your session directory does not exist on your computer: make sure to create one (still, I need to handle the error properly, I will fix this).

This is the default directory for sessions on your computer: does such folder exists?

Once we validate this is the root cause I will make a fix to better handle the error message. I asked you another question in Google Mail, please take a look if you have time, thank you!

gennaro-tedesco commented 1 year ago

Is the folder the root cause of the issue? Namely would that fix it?

whxcode commented 1 year ago

Is the folder the root cause of the issue? Namely would that fix it?

no it's another one

I want to use a set of shortcut keys to copy the currently selected content into the specified register or paste the content of the specified register under the cursor, although I can use "xy and "xp to do it. But I feel that the operation is cumbersome. I want to use the shortcut keys of cx and vx to complete the above work. How should I do it? Thank you.

The letter x represents the designated register.

gennaro-tedesco commented 1 year ago

I believe there is some confusion here:

  1. to address there error shown in your initial screenshot, does the session folder exist on your computer? By reproducing it I obtain the same exception only if I specify a path that doesn't exist, so that should be it.

  2. I want to use a set of shortcut keys to copy the currently selected content into the specified register or paste the content of the specified register under the cursor, although I can use "xy and "xp to do it.

what selected content are you referring to, here? Is this in the context of this issue where you see the error by invoking require("nvim-possession").list()? I have the impression this is a different topic, or am I wrong?

whxcode commented 1 year ago

I believe there is some confusion here:

  1. to address there error shown in your initial screenshot, does the session folder exist on your computer? By reproducing it I obtain the same exception only if I specify a path that doesn't exist, so that should be it.

I want to use a set of shortcut keys to copy the currently selected content into the specified register or paste the content of the specified register under the cursor, although I can use "xy and "xp to do it.

what selected content are you referring to, here? Is this in the context of this issue where you see the error by invoking require("nvim-possession").list()? I have the impression this is a different topic, or am I wrong?

Yes, not the same problem.

image

gennaro-tedesco commented 1 year ago

So let us please dedicate one issue per topic, otherwise it can generate confusion also for other users referring to this issue (looking for similar solutions).

For this particular issue, namely the error that you showed in your original screenshot, is that addressed by specifying a path to an existing folder (or creating a folder in the default path)? Let us check on this first (so that I can merge the fix in https://github.com/gennaro-tedesco/nvim-possession/pull/18) and then move on to the next one :)

whxcode commented 1 year ago

After I installed it, I used it directly like this.

image

Does the above error need to configure anything?

gennaro-tedesco commented 1 year ago

You need to call the setup({}) function to expose those interfaces as specified in the README (and as you did in your first comment). So

  1. install the plugin (with your plugin manager)
  2. require("nvim-possession").setup({}) somewhere in your configuration
  3. make sure the session path exists on your computer (create the folder if not)
  4. invoking require("nvim-possession").list() (and other commands) will work

I tested it with vimscript configuration as well and it works. The original problem was that your session path didn't exist on your computer (see point 3. above), the problem you just showed now is because you didn't call setup({}) anywhere in your config.

gennaro-tedesco commented 1 year ago

I merged https://github.com/gennaro-tedesco/nvim-possession/pull/18, now the exception is handled with an error message. You should see the new behaviour upgrading the plugin directly.

whxcode commented 1 year ago

I merged #18, now the exception is handled with an error message. You should see the new behaviour upgrading the plugin directly.

Good morning, according to the steps you said, I can already use the plugin, thank you.