JoseConseco / telescope_sessions_picker.nvim

MIT License
17 stars 4 forks source link

Custom Session Directory is not set. #1

Open ChrisGitIt opened 2 years ago

ChrisGitIt commented 2 years ago

Hi and thanks for the plugin!

I tried to set a custom session directory, but it does not seem to work and I get the error that the directory is not existing (referencing to the default "session" dir instead of my set "sessionS" dir (which exists and is used by other plugins)).

I mainly just copied and paste the config: require('telescope').load_extension('sessions_picker') require'telescope'.setup { extensions = { sessions_picker = { sessions_dir = vim.fn.stdpath('data') ..'/sessions/', } }, }

I tried some debugging, but I'm not good in Lua and just get gibberish when I tried to "print_r(ext_config)" in your setup function

JoseConseco commented 2 years ago

Hi chris. Are you sure your sessions dir exist? What if you setup addon path as string, rather than using fn.stdpath ? like this: '/home/user/.local/share/nvim/session'

ChrisGitIt commented 2 years ago

Hi @JoseConseco and thanks for your feedback!

Unfortunately it does not seem to work. Your Plugin seems to register just fine with telescope (":Telescope sessions_picker" is there and gives me the error of missing directory)

I also tried an appending / for the directory (little mismatch between doc and code (local sessions_dir = vim.fn.stdpath('data') ..'/session/'))

This is my init.lua:

use {
    'JoseConseco/telescope_sessions_picker.nvim',
    config = function()
        require('setup/session_picker')
    end
}

and in ./lua/setup/session_picker/init.lua:

require('telescope').load_extension('sessions_picker')
require'telescope'.setup {
  extensions = {
    sessions_picker = {
      sessions_dir = '/Users/me-user/.local/share/nvim/sessions',  -- same as '/home/user/.local/share/nvim/session'
    }
  },
}

The directory is definitely up and running (used by Shatur/neovim-session-manager" as Session Manager).

Any other hints? I'm on Mac with nvim 6.1 via https://github.com/qvacua/vimr

Bye the way, I noticed that I had to do ":PackerCompile" in order to install and uninstall your plugin correctly ... not sure what that is about.

Chetan496 commented 2 years ago

@JoseConseco I am facing this issue as well. I really want to use this plugin as it fits my workflow. but this issue is a bit of a blocker. I am on Ubuntu 20.04 and neovim 7.0

Chetan496 commented 2 years ago

@JoseConseco I am facing this issue as well. I really want to use this plugin as it fits my workflow. but this issue is a bit of a blocker. I am on Ubuntu 20.04 and neovim 7.0

I see the problem(s) now..

  1. The plugin has issue if we use bash variables. So variable substitution does not happen
  2. A trailing slash needs to be added.

Here is what worked for me:

local dirForSessions='/home/chetan/nvim-sessions/'
require('sessions').setup({
   events = { "BufEnter" },
   session_filepath = dirForSessions
})

require('telescope').setup {
  extensions = {
   sessions_picker = {
     sessions_dir = dirForSessions  
   }
  }
}

But the following does not work:

local dirForSessions='/home/chetan/nvim-sessions'
require('sessions').setup({
   events = { "BufEnter" },
   session_filepath = dirForSessions
})

require('telescope').setup {
  extensions = {
   sessions_picker = {
     sessions_dir = dirForSessions  
   }
  }
}

and neither does the following work:

local dirForSessions='$HOME/nvim-sessions/'
require('sessions').setup({
   events = { "BufEnter" },
   session_filepath = dirForSessions
})

require('telescope').setup {
  extensions = {
   sessions_picker = {
     sessions_dir = dirForSessions  
   }
  }
}

I think bash variable subsitution should work, that will make the configuration portable.

JoseConseco commented 2 years ago

Ok, do you have idea how to implement 'bash substitution'? For reference for other people this is how config should look like: image

mawkler commented 2 years ago

@JoseConseco I'm guessing that this is where the config should be loaded. With a setup like the one in your screenshot the sessions_dir argument is nil. Have you tried changing sessions_dir to something else in your config, because I think it's always set to the value in your screenshot.