Skip to content

samuelnihoul/pluginbar.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

pluginbar.nvim

A vertical, floating plugin bar pinned to the top-right of your Neovim window. Each installed plugin shows as an icon; click one (mouse or keyboard) to pop open a menu of that plugin's commands.

Plugins expose their commands through a tiny, optional API — no hard dependency on pluginbar.

Requirements

  • Neovim ≥ 0.11
  • lazy.nvim (used to auto-list installed plugins; optional)
  • mouse enabled for click support (default in Neovim)

Installation (lazy.nvim)

{
  "samuelnihoul/pluginbar.nvim",
  cmd = "PluginBar",
  keys = { { "<leader>pb", desc = "Toggle plugin bar" } },
  config = function()
    local bar = require("pluginbar")
    bar.setup({ keymap = "<leader>pb" })

    -- Register plugins that expose a command API. `commands` is wrapped in a
    -- function so the plugin is only required when its icon is clicked.
    bar.register({
      name = "Flashcards",
      icon = "📇",
      match = "flashcards.nvim",
      commands = function() return require("flashcards").commands() end,
    })
    bar.register({
      name = "Immersion",
      icon = "🌐",
      match = "immersion.nvim",
      commands = function() return require("immersion").commands() end,
    })
  end,
}

Usage

  • :PluginBar (or <leader>pb) toggles the bar.
  • In the bar: click an icon, or move with j/k and press <CR>.
  • In the command menu: click a command, or <CR> to run it; q/<Esc> to go back.

The command API

Any plugin can participate by exposing two things on its main module:

-- Icon shown in the bar (optional; falls back to the first letter).
M.bar_icon = "📇"

-- Returns a list of user-facing actions.
function M.commands()
  return {
    { name = "Review", desc = "Review due cards", run = function() vim.cmd("FlashReview") end },
    { name = "Add card", desc = "Add a flashcard", run = function() vim.cmd("FlashAdd") end },
  }
end

Each command is { name = string, desc = string?, run = function }. The bar calls run (scheduled, after closing itself) when the command is selected.

You then register the plugin with the bar (see installation), or call require("pluginbar").register({ name = ..., commands = ... }) from anywhere.

Configuration

require("pluginbar").setup({
  width = 5,           -- bar width in columns
  max_height = 0.9,    -- max bar height as a fraction of editor height
  border = "rounded",
  show_installed = true, -- also list installed plugins that didn't register
  menu_width = 34,     -- command-menu width
  keymap = "<leader>pb", -- toggle keymap (false to disable)
})

License

MIT

About

A vertical top-right floating bar of plugin icons with clickable command menus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages