Change your working directory between packages in a NodeJS workspace.
This plugin works with yarn
, npm
, pnpm
, and yarn-berry
. If you need
support for another package manager, please create an issue or submit a pull
request.
With Packer:
use {
"nvim-telescope/telescope.nvim",
requires = {
"ec965/telescope-node-workspace.nvim"
}
}
First, Load the telescope extension.
require('telescope').load_extension "node-workspace"
Then you can use Telescope node-workspace
to pull up the telescope picker or you can kind it to a key.
-- bind it to a key
vim.keymap.set("n", "<leader>cdg", ":Telescope node-workspace<CR>", { noremap = true, silent = true })
Selecting an entry in the picker will change your current working directory to the directory of the chosen package.
The package's package.json
is shown in the preview window.