A Neovim plugin for JavaScript, TypeScript projects. It provides a way to execute npm scripts without leaving the editor.
Features • Screenshots • Installation • Commands • Api • Default Mappings • Configuration • Configuration options •
Execute npm scripts without leaving the editor
- Search projects that contain a package.json file
- Show scripts in a telescope window
- execute script
Install the plugin with your favorite package manager:
Plug 'sajjahossain/nvim-npm'
Plug 'akinsho/toggleterm.nvim',
Plug 'nvim-telescope/telescope.nvim'
Plug 'rcarriga/nvim-notify'
use 'sajjahossain/nvim-npm'
use 'akinsho/toggleterm.nvim',
use 'nvim-telescope/telescope.nvim'
use 'rcarriga/nvim-notify'
require('lazy').setup({
{
'sajjahossain/nvim-npm',
config = true,
dependencies = {
'nvim-telescope/telescope.nvim',
'akinsho/toggleterm.nvim',
'rcarriga/nvim-notify',
}
}
})
Command | Description |
---|---|
:InstallPackage |
Installs a package in the current project |
:OpenTerminal |
Opens one of the available terminals |
:RefreshPackageJsonCache |
Refreshes the package.json cache |
:ShowScriptsInTelescope |
Shows the available scripts in a telescope window |
Function | Description |
---|---|
require('nvim-npm').exitAllTerminal() |
Closes all the terminals |
require('nvim-npm').exitTerminal() |
Closes the current terminal |
require('nvim-npm').installPackage() |
Installs a package in the current project |
require('nvim-npm').openTerminal() |
Opens one of the available terminals |
require('nvim-npm').showScripts() |
Shows the available scripts in a telescope window |
Mode | Key | Action |
---|---|---|
Normal | ;pi |
Installs a package in the current project |
Normal | ;pl |
Lists the available scripts |
Normal | ;po |
Opens one of the available terminals |
Normal | ;pr |
Refreshes the package.json cache |
You can configure the plugin by setting the following options:
require('nvim-npm').setup({
mappings = { -- key mappings [optional]
t = {}, -- terminal mode mappings
n = {} -- normal mode mappings
}
})
Option | Type | Default | Description |
---|---|---|---|
mappings | table or false | default mappings | key mappings. set to false to disable default mappings |