Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to directory not listed in zoxide #21

Open
lucasrabiec opened this issue Mar 5, 2023 · 1 comment
Open

Change to directory not listed in zoxide #21

lucasrabiec opened this issue Mar 5, 2023 · 1 comment

Comments

@lucasrabiec
Copy link

lucasrabiec commented Mar 5, 2023

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?

@dundalek
Copy link

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
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants