All Projects → vuki656 → package-info.nvim

vuki656 / package-info.nvim

Licence: GPL-3.0 license
✍️ All the npm/yarn commands I don't want to type

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to package-info.nvim

trouble.nvim
🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Stars: ✭ 2,663 (+973.79%)
Mutual labels:  neovim-plugin, neovim-lua
awesome-neovim
Awesome Configurations for C/C++,Zig,Web and Lua development in NeoVim
Stars: ✭ 54 (-78.23%)
Mutual labels:  neovim-plugin, neovim-lua
modes.nvim
Prismatic line decorations for the adventurous vim user
Stars: ✭ 299 (+20.56%)
Mutual labels:  neovim-plugin, neovim-lua
which-key.nvim
💥 Create key bindings that stick. WhichKey is a lua plugin for Neovim 0.5 that displays a popup with possible keybindings of the command you started typing.
Stars: ✭ 2,043 (+723.79%)
Mutual labels:  neovim-plugin, neovim-lua
nvim-hardline
A simple Neovim statusline
Stars: ✭ 122 (-50.81%)
Mutual labels:  neovim-plugin, neovim-lua
neogen
A better annotation generator. Supports multiple languages and annotation conventions.
Stars: ✭ 339 (+36.69%)
Mutual labels:  neovim-plugin, neovim-lua
tmux.nvim
tmux integration for nvim features pane movement and resizing from within nvim.
Stars: ✭ 299 (+20.56%)
Mutual labels:  neovim-plugin, neovim-lua
diffview.nvim
Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Stars: ✭ 1,472 (+493.55%)
Mutual labels:  neovim-plugin, neovim-lua
winshift.nvim
Rearrange your windows with ease.
Stars: ✭ 230 (-7.26%)
Mutual labels:  neovim-plugin, neovim-lua
Comment.nvim
🧠 💪 // Smart and powerful comment plugin for neovim. Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
Stars: ✭ 796 (+220.97%)
Mutual labels:  neovim-plugin, neovim-lua
upgreat
CLI for a painless way to upgrade your package.json dependencies!
Stars: ✭ 47 (-81.05%)
Mutual labels:  yarn, package-json
express-starter
ARCHIVED: Please use @neutrinojs/create-project
Stars: ✭ 14 (-94.35%)
Mutual labels:  yarn
21 Points
❤️ 21-Points Health is an app you can use to monitor your health.
Stars: ✭ 244 (-1.61%)
Mutual labels:  yarn
Core
Native HTML Elements with CSS superpowers. 🕶
Stars: ✭ 237 (-4.44%)
Mutual labels:  yarn
Yarn Completion
Bash completion for Yarn
Stars: ✭ 210 (-15.32%)
Mutual labels:  yarn
ansible-role-yarn
Install Yarn via Ansible to Ubuntu and RedHat systems!
Stars: ✭ 20 (-91.94%)
Mutual labels:  yarn
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (-71.77%)
Mutual labels:  neovim-plugin
Yalc
Work with yarn/npm packages locally like a boss.
Stars: ✭ 3,155 (+1172.18%)
Mutual labels:  yarn
Front End Guide
📚 Study guide and introduction to the modern front end stack.
Stars: ✭ 14,073 (+5574.6%)
Mutual labels:  yarn
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: ✭ 202 (-18.55%)
Mutual labels:  yarn

All the npm/yarn/pnpm commands I don't want to type

Lua

License Status Neovim

Features

  • Display latest dependency versions as virtual text
  • Upgrade dependency on current line to latest version
  • Delete dependency on current line
  • Install a different version of a dependency on current line
  • Install new dependency
  • Automatic package manager detection
  • Loading animation hook (to be placed in status bar or anywhere else)

Display Latest Package Version

Runs npm outdated --json in the background and then compares the output with versions in package.json and displays them as virtual text.

Keybinding

vim.api.nvim_set_keymap(
    "n",
    "<leader>ns",
    "<cmd>lua require('package-info').show()<cr>",
    { silent = true, noremap = true }
)
  • NOTE: after the first outdated dependency fetch, it will show the cached results for the next hour instead of re-fetching every time.
  • If you would like to force re-fetching every time you can provide force = true like in the example below:
vim.api.nvim_set_keymap(
    "n",
    "<leader>ns",
    "<cmd>lua require('package-info').show({ force = true })<cr>",
    { silent = true, noremap = true }
)

Delete Dependency

Runs yarn remove, npm uninstall, or pnpm uninstall in the background and reloads the buffer.

Keybinding

vim.api.nvim_set_keymap(
    "n",
    "<leader>nd",
    "<cmd>lua require('package-info').delete()<cr>",
    { silent = true, noremap = true }
)

Install Different Version

Runs npm install dependency@version, yarn upgrade dependency@version, or pnpm update dependency in the background and reloads the buffer.

Keybinding

vim.api.nvim_set_keymap(
    "n",
    "<leader>np",
    "<cmd>lua require('package-info').change_version()<cr>",
    { silent = true, noremap = true }
)

Install New Dependency

Runs npm install dependency, yarn add dependency, or pnpm add dependency in the background and reloads the buffer.

Keybinding

vim.api.nvim_set_keymap(
    "n",
    "<leader>ni",
    "<cmd>lua require('package-info').install()<cr>",
    { silent = true, noremap = true }
)

Loading Hook

Function that can be placed anywhere to display the loading status from the plugin.

Usage

  • It can be used anywhere in neovim by invoking return require('package-info').get_status()
local package_info = require("package-info")

-- Galaxyline
section.left[10] = {
    PackageInfoStatus = {
        provider = function()
            return package_info.get_status()
        end,
    },
}

-- Feline
components.right.active[5] = {
    provider = function()
        return package_info.get_status()
    end,
    hl = {
        style = "bold",
    },
    left_sep = "  ",
    right_sep = " ",
}

⚡️ Requirements

📦 Installation

packer

use({
    "vuki656/package-info.nvim",
    requires = "MunifTanjim/nui.nvim",
})

⚙️ Configuration

Usage

require('package-info').setup()

Defaults

{
    colors = {
        up_to_date = "#3C4048", -- Text color for up to date dependency virtual text
        outdated = "#d19a66", -- Text color for outdated dependency virtual text
    },
    icons = {
        enable = true, -- Whether to display icons
        style = {
            up_to_date = "|  ", -- Icon for up to date dependencies
            outdated = "|  ", -- Icon for outdated dependencies
        },
    },
    autostart = true -- Whether to autostart when `package.json` is opened
    hide_up_to_date = false -- It hides up to date versions when displaying virtual text
    hide_unstable_versions = false, -- It hides unstable versions from version list e.g next-11.1.3-canary3
    -- Can be `npm`, `yarn`, or `pnpm`. Used for `delete`, `install` etc...
    -- The plugin will try to auto-detect the package manager based on
    -- `yarn.lock` or `package-lock.json`. If none are found it will use the
    -- provided one, if nothing is provided it will use `yarn`
    package_manager = `yarn`
}

256 Color Terminals

  • If the vim option termguicolors is false, package-info switches to 256 color mode.
  • In this mode cterm color numbers are used instead of truecolor hex codes and the color defaults are:
colors = {
    up_to_date = "237", -- cterm Grey237
    outdated = "173", -- cterm LightSalmon3
}

⌨️ All Keybindings

Plugin has no default Keybindings.

You can copy the ones below:

-- Show dependency versions
vim.keymap.set({ "n" }, "<LEADER>ns", require("package-info").show, { silent = true, noremap = true })

-- Hide dependency versions
vim.keymap.set({ "n" }, "<LEADER>nc", require("package-info").hide, { silent = true, noremap = true })

-- Toggle dependency versions
vim.keymap.set({ "n" }, "<LEADER>nt", require("package-info").toggle, { silent = true, noremap = true })

-- Update dependency on the line
vim.keymap.set({ "n" }, "<LEADER>nu", require("package-info").update, { silent = true, noremap = true })

-- Delete dependency on the line
vim.keymap.set({ "n" }, "<LEADER>nd", require("package-info").delete, { silent = true, noremap = true })

-- Install a new dependency
vim.keymap.set({ "n" }, "<LEADER>ni", require("package-info").install, { silent = true, noremap = true })

-- Install a different dependency version
vim.keymap.set({ "n" }, "<LEADER>np", require("package-info").change_version, { silent = true, noremap = true })

📝 Notes

  • Display might be slow on a project with a lot of dependencies. This is due to the npm outdated --json command taking a long time. Nothing can be done about that
  • Idea was inspired by akinsho and his dependency-assist.nvim
  • Readme template stolen from folke
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].