Skip to content

A Neovim plugin for JavaScript, TypeScript projects. It provides a way to execute npm scripts without leaving the editor.

Notifications You must be signed in to change notification settings

sajjathossain/nvim-npm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nvim NPM

A Neovim plugin for JavaScript, TypeScript projects. It provides a way to execute npm scripts without leaving the editor.

FeaturesScreenshotsInstallationCommandsApiDefault MappingsConfigurationConfiguration options

Features

Execute npm scripts without leaving the editor

Screenshots

  • Search projects that contain a package.json file

search projects

  • Show scripts in a telescope window

search scripts in the project

  • execute script

execute command

Installation

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

Commands

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

Api

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

Default Mappings

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

Configuration

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

Configuration options

Option Type Default Description
mappings table or false default mappings key mappings. set to false to disable default mappings

About

A Neovim plugin for JavaScript, TypeScript projects. It provides a way to execute npm scripts without leaving the editor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages