elmarsto / telescope-nodescripts.nvim

A telescope.nvim extension to run scripts from your package.json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

telescope-nodescripts.nvim

An extension for telescope.nvim to run scripts from your package.json.

demo

Requirements

Install

Install with your preferred package manager, the following example uses packer:

use "luissimas/telescope-nodescripts.nvim"

Setup

You can explicitly load the extension (but you don't need to).

require("telescope").load_extension("nodescripts")

The picker can be called using the run function:

require('telescope').extensions.nodescripts.run({})

No default keybindings are provided, you can set a keybinding for the extension like this:

vim.api.nvim_set_keymap("n", "<leader>fs", ":lua require('telescope').extensions.nodescripts.run({})<Enter>", {noremap = true, silent = true})

Configuring

The extension can be configured using the extensions key in telescope's setup function. Here's a example configuration using the default values:

require("telescope").setup {
  extensions = {
      nodescripts = {
          command = "npm run",        -- command to run your node scripts
          display_method = "vsplit",  -- window method to open the terminal
          ignore_pre_post = true      -- ignore pre and post scripts
        }
    }
}

Inspirations

https://github.com/David-Kunz/jester

https://github.com/nvim-telescope/telescope-project.nvim

About

A telescope.nvim extension to run scripts from your package.json


Languages

Language:Lua 100.0%