piersolenski/brewfile.nvim

github github
utility
stars 18
issues 0
subscribers 0
forks 0
CREATED

UPDATED


๐Ÿบ brewfile.nvim

If you're on macOS and use Homebrew, you probably have a Brewfile to manage your packages declaratively. brewfile.nvim lets you manage your that Brewfile from within your favourite editor, giving you even less reasons to leave Vim or go outside. Why get Vitamin D when you can be installing and uninstalling apps, casks, and extensions at blazingly fast speeds?

โœจ Features

  • Install/uninstall packages - Just position your cursor on any line in your Brewfile and hit your keybind
  • Auto-dumps Brewfile after changes - Keeps your Brewfile in sync automatically
  • Package info - Get detailed package information
  • Open Brew homepages - Open the homepage of any package in your default browser
  • Safety first - Optional confirmation prompts for destructive actions

https://github.com/user-attachments/assets/2426cb0b-2fe3-465c-a44d-5234f260028e

๐Ÿ“ฆ Package Support

This plugin supports managing packages from a variety of sources:

  • Homebrew: Standard brew packages.
  • Cask: cask packages for GUI applications.
  • Mac App Store: mas packages for App Store applications (Requires mas-cli).
  • VSCode: vscode extensions (Requires Visual Studio Code).

๐Ÿ”ฉ Installation

return {
  "piersolenski/brewfile.nvim",
  opts = {
    -- Auto-dump Brewfile after brew commands finish
    dump_on_change = true,
    -- Show confirmation prompts for uninstall actions
    confirmation_prompt = true,
  },
  keys = {
    {
      "<leader>b",
      desc = "Brewfile",
    },
    {
      "<leader>bi",
      function()
        require("brewfile").install()
      end,
      desc = "Brew install package",
      mode = { "n" },
    },
    {
      "<leader>br",
      function()
        require("brewfile").dump()
      end,
      desc = "Dump Brewfile and refresh the buffer",
      mode = { "n" },
    },
    {
      "<leader>bo",
      function()
        require("brewfile").open_homepage()
      end,
      desc = "Open package homepage",
      mode = { "n" },
    },
    {
      "<leader>bd",
      function()
        require("brewfile").uninstall()
      end,
      desc = "Brew uninstall package",
      mode = { "n" },
    },
    {
      "<leader>bD",
      function()
        require("brewfile").force_uninstall()
      end,
      desc = "Brew force uninstall package",
      mode = { "n" },
    },
    {
      "<leader>bI",
      function()
        require("brewfile").info()
      end,
      desc = "Brew package info",
      mode = { "n" },
    },
    {
      "<leader>bu",
      function()
        require("brewfile").upgrade()
      end,
      desc = "Brew upgrade package",
      mode = { "n" },
    },
  },
}

๐Ÿš€ Usage

# Position cursor on any line in your Brewfile
brew "neovim" -- to upgrade, to uninstall <leader >bi <leader >bd
cask "firefox" -- Works with casks too!
mas "Xcode", id: 497799835 -- Even Mac App Store apps!

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Related projects

  • gx.nvim - Extends gx to open Brewfile links amongst others in browser
  • package-info.nvim - Similar functionality for npm packages

๐Ÿค“ About the author

As well as a passionate Vim enthusiast, I am a Full Stack Developer and Technical Lead from London, UK.

Whether it's to discuss a project, talk shop or just say hi, I'd love to hear from you!