Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.49 KB

File metadata and controls

62 lines (46 loc) · 1.49 KB

run_command.nvim

A Neovim plugin that provides an interactive interface to run shell commands in your README.md file.

Features

  • Extract shell commands from README.md files with descriptions
  • Interactive command selection using Telescope
  • Preview command blocks before execution
  • Run commands in a toggleable terminal
  • Remember and re-run last executed command

Command extraction rule

The script will extract code blocks marked as sh or bash from the project's root README.md file. For each code block found, the preceding line (if it exists) will be used as its description.

Check the test README and the extracted commands for examples.

Installation

Using lazy.nvim:

require("lazy").setup({
  {
    "ideless/run_command.nvim",
    dependencies = {
      "akinsho/toggleterm.nvim",
      "nvim-telescope/telescope.nvim",
    },
    opts = {
      window = {
        direction = "horizontal", -- or "vertical" | "float"
        name = "cmd_term",        -- terminal display name
      },
      shell = {
        exit_on_error = true,     -- join commands by && or ;
      },
    },
  },
})

Usage

  • :RcRun - Open the command picker to select and run a command
  • :RcRunLast - Re-run the last executed command

Development

Test extract_commands.lua:

lua test/test_extract_commands.lua | diff - test/README.md.yaml

Run indefinite_task.sh:

bash test/indefinite_task.sh