Skip to content

0xfraso/command.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

command.nvim

Easily select and launch commands directly from neovim

It uses toggleterm.nvim as backend

image

📦 Installation

Lazy (recommended)

With defaults

{
  "0xfraso/command.nvim",
  opts = {}, -- see section below for configuration options
  dependencies = {
    "akinsho/toggleterm.nvim",
  }
}

⚙️ Configuration

Defaults

{
  cache_file = vim.fn.stdpath("cache") .. "/commands", -- path to cache file
  sort = 'asc' -- Can be "asc", "desc" or "none"
}

⚡ Commands

command.nvim exposes the following user commands:

:CommandSelect
:CommandSelectShellHistory
:CommandExecLast
:CommandPrompt
:CommandPromptLast
:CommandEdit

For example, you can map commands using lazy.nvim:

{
  "0xfraso/command.nvim",
  opts = {
    cache_file = vim.fn.stdpath("cache") .. "/commands", -- path to cache file
    shell_file = os.getenv('HOME') .. "/.zsh_history",   -- change with your shell history file
    sort = "asc"
  },
  dependencies = {
    "akinsho/toggleterm.nvim",
    "stevearc/dressing.nvim", -- optional, but recommended
  },
  keys = {
    { "<leader>tl", ":CommandSelect<CR>",             desc = "Select command" },
    { "<leader>tr", ":CommandSelectShellHistory<CR>", desc = "Select command from history file" },
    { "<leader>tp", ":CommandPrompt<CR>",             desc = "Prompt command" },
    { "<leader>tP", ":CommandPromptLast<CR>",         desc = "Prompt last command" },
    { "<leader>tc", ":CommandExecLast<CR>",           desc = "Exec last command" },
    { "<leader>te", ":CommandEdit<CR>",               desc = "Edit commands file" },
  }
}

About

Launch and quickly manage commands within Neovim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages