Run npm scripts from the comfort of your favorite editor.
Features:
vim.ui.select()
for a picker which makes it easy to seamlessly integrate with your setup(telescope/fzf or anything else). See opts.select
" using vim-plug
Plug 'antonk52/npm_scripts.nvim'
-- using packer.nvim
use {'antonk52/npm_scripts.nvim'}
-- optional
-- call this if you want to override global plugin options
require'npm_scripts'.setup(opts)
require'npm_scripts'.run_script()
to run a script from a root package.json
require'npm_scripts'.run_workspace_script()
Execute a script in a workspacerequire'npm_scripts'.run_buffer_script()
Find current buffer's closest package.json and executes a script from itrequire'npm_scripts'.run_from_all()
Find all package.json and select a script from a single list of package.json#name
: script_name
Function. By default set to vim.ui.select
. You can provide a custom function with the same signature(see :help vim.ui.select
) or use a 3rd party solution like stevearc/dressing.nvim
for telescope
, fzf
, fzf-lua
support, or telescope-ui-select.nvim
to override global vim.ui.select
and have your favorite picker everywhere.
String. Pick a package manager to use to run scripts. By default it searches for lock files and pick one of bun
, pnpm
, yarn
or npm
. If no lock files found fallbacks to npm
.
Function. Takes a table run_opts
with fields script_name
, path
, and package_manager
. It is called after a user selects a script to run. By default opens a terminal in a split and runs the selected script there.
String. Default "Select a script to run:"
Function. Default tostring
String. Default "Select a workspace to run a script:"
Function. Default tostring
Boolean. Default true
Whether to pick a workspace script via a single search or two searches, over workspaces and picked workspace scripts
quiet
option ie run script in background