Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

autobarrel.nvim

Simple Neovim plugin for generating and updating barrel files like index.ts.

Features

  • Create barrel for selected directory
  • Update barrel for selected directory
  • Auto-update nearest parent barrel on file save
  • Neo-tree integration

Installation (lazy.nvim)

{
  "da-b1rmuda/autobarrel.nvim",
  dependencies = {
    "nvim-neo-tree/neo-tree.nvim",
  },
  config = function()
    require("autobarrel").setup({
      barrel_name = "index.ts",
      auto_update = true,
      update_only_nearest = true,
      notify = false,
      neo_tree = {
        enabled = true,
      },
    })
  end,
}

Commands

  • :BarrelCreate [dir]
  • :BarrelUpdate [dir]

If dir is omitted, current buffer directory is used.

Neo-tree integration

Add to your neo-tree config:

require("neo-tree").setup({
  commands = {
    barrel_create = function(state)
      require("autobarrel.integrations.neotree").create_from_state(state)
    end,
    barrel_update = function(state)
      require("autobarrel.integrations.neotree").update_from_state(state)
    end,
  },
  filesystem = {
    window = {
      mappings = {
        ["<leader>bc"] = "barrel_create",
        ["<leader>bu"] = "barrel_update",
      },
    },
  },
})

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages