telescope-zoxide icon indicating copy to clipboard operation
telescope-zoxide copied to clipboard

Change to directory not listed in zoxide

Open lucasrabiec opened this issue 1 year ago • 1 comments

I want to change the cwd to project which is not listed on Zoxide List without leaving nvim. Is there any option to do that?

lucasrabiec avatar Mar 05 '23 02:03 lucasrabiec

I started using the plugin recently and came up with following solution, hope it is useful.

It works by listening to vim directory changes and adding them to zoxide. Therefore if a project is not listed, then you can use vim command :cd /some/project to change the directory manually and it will appear in the zoxide list next time.

Config snippet to be added to init.lua:

-- Add directory to zoxide when changed for example with `:cd`
local zoxide_group = vim.api.nvim_create_augroup("zoxide", {})
vim.api.nvim_create_autocmd({ "DirChanged" }, {
  group = zoxide_group,
  callback = function(ev)
    vim.fn.system({ "zoxide", "add", ev.file })
  end
})

dundalek avatar Apr 13 '23 09:04 dundalek

Ty for your suggestion! I was a little absent lately due to ... Life. I just want to let everyone know will check all Open issues and PR's shortly.

jvgrootveld avatar Aug 08 '24 07:08 jvgrootveld

Hi @lucasrabiec the only functionality of this plugin is to list the existing entries from zoxide and select it. With #23 I will fix that Neovim will update Zoxide when selecting an entry.

I find it an interesting idea to support directory navigation for directories not listed so they appear in the Zoxide list. The only thing I'm struggling with is that this plugin is a Neovim integration for Zoxide, not plain directly navigation. I think @dundalek 's idea is great. For now I will add this idea into the Readme. If you have more ideas, please share!

jvgrootveld avatar Aug 08 '24 07:08 jvgrootveld

Won't fix due to not being a plain old directory navigating plugin. Will add the idea to the Readme so everyone knows how to add (new) entries to Zoxide from plain old :cd or other directory navigating plugin.

jvgrootveld avatar Aug 08 '24 07:08 jvgrootveld